From 4493048b20a8a9250234dc4519185f3725c0e547 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 05:34:25 -0800 Subject: [PATCH 01/46] Changed directories. --- .../PurePerms/{cmd => Commands}/AddGroup.php | 170 ++--- .../PurePerms/{cmd => Commands}/AddParent.php | 166 ++--- .../PurePerms/{cmd => Commands}/DefGroup.php | 198 +++--- .../PurePerms/{cmd => Commands}/FPerms.php | 232 +++--- .../PurePerms/{cmd => Commands}/Groups.php | 144 ++-- .../PurePerms/{cmd => Commands}/GrpInfo.php | 234 +++---- .../{cmd => Commands}/ListGPerms.php | 262 +++---- .../{cmd => Commands}/ListUPerms.php | 248 +++---- .../PurePerms/{cmd => Commands}/PPInfo.php | 152 ++-- .../PurePerms/{cmd => Commands}/PPReload.php | 134 ++-- .../PurePerms/{cmd => Commands}/PPSudo.php | 274 ++++---- .../PurePerms/{cmd => Commands}/RmGroup.php | 170 ++--- .../PurePerms/{cmd => Commands}/RmParent.php | 156 ++--- .../PurePerms/{cmd => Commands}/SetGPerm.php | 206 +++--- .../PurePerms/{cmd => Commands}/SetGroup.php | 286 ++++---- .../PurePerms/{cmd => Commands}/SetUPerm.php | 188 ++--- .../{cmd => Commands}/UnsetGPerm.php | 206 +++--- .../{cmd => Commands}/UnsetUPerm.php | 188 ++--- .../PurePerms/{cmd => Commands}/UsrInfo.php | 218 +++--- .../{data => DataManager}/UserDataManager.php | 544 +++++++------- .../DefaultProvider.php | 314 ++++----- .../MySQLProvider.php | 662 +++++++++--------- .../ProviderInterface.php | 76 +- .../SQLite3Provider.php | 84 +-- .../YamlV1Provider.php | 350 ++++----- .../PPGroupChangedEvent.php | 150 ++-- .../PPRankExpiredEvent.php | 130 ++-- src/_64FF00/PurePerms/PPListener.php | 4 +- src/_64FF00/PurePerms/PurePerms.php | 57 +- 29 files changed, 3099 insertions(+), 3104 deletions(-) rename src/_64FF00/PurePerms/{cmd => Commands}/AddGroup.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/AddParent.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/DefGroup.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/FPerms.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/Groups.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/GrpInfo.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/ListGPerms.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/ListUPerms.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/PPInfo.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/PPReload.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/PPSudo.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/RmGroup.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/RmParent.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/SetGPerm.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/SetGroup.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/SetUPerm.php (95%) rename src/_64FF00/PurePerms/{cmd => Commands}/UnsetGPerm.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/UnsetUPerm.php (96%) rename src/_64FF00/PurePerms/{cmd => Commands}/UsrInfo.php (96%) rename src/_64FF00/PurePerms/{data => DataManager}/UserDataManager.php (95%) rename src/_64FF00/PurePerms/{provider => DataProviders}/DefaultProvider.php (95%) rename src/_64FF00/PurePerms/{provider => DataProviders}/MySQLProvider.php (96%) rename src/_64FF00/PurePerms/{provider => DataProviders}/ProviderInterface.php (94%) rename src/_64FF00/PurePerms/{provider => DataProviders}/SQLite3Provider.php (93%) rename src/_64FF00/PurePerms/{provider => DataProviders}/YamlV1Provider.php (95%) rename src/_64FF00/PurePerms/{event => EventManager}/PPGroupChangedEvent.php (94%) rename src/_64FF00/PurePerms/{event => EventManager}/PPRankExpiredEvent.php (94%) diff --git a/src/_64FF00/PurePerms/cmd/AddGroup.php b/src/_64FF00/PurePerms/Commands/AddGroup.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/AddGroup.php rename to src/_64FF00/PurePerms/Commands/AddGroup.php index 88f158bb..bdbe5657 100644 --- a/src/_64FF00/PurePerms/cmd/AddGroup.php +++ b/src/_64FF00/PurePerms/Commands/AddGroup.php @@ -1,86 +1,86 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.addgroup"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(!isset($args[0]) || count($args) > 1) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.usage")); - - return true; - } - - $result = $this->plugin->addGroup($args[0]); - - if($result === PurePerms::SUCCESS) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.group_added_successfully", $args[0])); - } - elseif($result === PurePerms::ALREADY_EXISTS) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.group_already_exists", $args[0])); - } - else - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.invalid_group_name", $args[0])); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.addgroup"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(!isset($args[0]) || count($args) > 1) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.usage")); + + return true; + } + + $result = $this->plugin->addGroup($args[0]); + + if($result === PurePerms::SUCCESS) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.group_added_successfully", $args[0])); + } + elseif($result === PurePerms::ALREADY_EXISTS) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.group_already_exists", $args[0])); + } + else + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.invalid_group_name", $args[0])); + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/AddParent.php b/src/_64FF00/PurePerms/Commands/AddParent.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/AddParent.php rename to src/_64FF00/PurePerms/Commands/AddParent.php index ded49107..46442151 100644 --- a/src/_64FF00/PurePerms/cmd/AddParent.php +++ b/src/_64FF00/PurePerms/Commands/AddParent.php @@ -1,84 +1,84 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.addparent"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.usage")); - - return true; - } - - $target_group = $this->plugin->getGroup($args[0]); - - $parent_group = $this->plugin->getGroup($args[1]); - - if($target_group->addParent($parent_group)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.messages.addparent_successfully", $parent_group->getName(), $target_group->getName())); - } - else - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.messages.target_already_inherits", $parent_group->getName(), $target_group->getName())); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.addparent"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(count($args) < 2 || count($args) > 3) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.usage")); + + return true; + } + + $target_group = $this->plugin->getGroup($args[0]); + + $parent_group = $this->plugin->getGroup($args[1]); + + if($target_group->addParent($parent_group)) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.messages.addparent_successfully", $parent_group->getName(), $target_group->getName())); + } + else + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.messages.target_already_inherits", $parent_group->getName(), $target_group->getName())); + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/DefGroup.php b/src/_64FF00/PurePerms/Commands/DefGroup.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/DefGroup.php rename to src/_64FF00/PurePerms/Commands/DefGroup.php index e9ec3da0..ca226197 100644 --- a/src/_64FF00/PurePerms/cmd/DefGroup.php +++ b/src/_64FF00/PurePerms/Commands/DefGroup.php @@ -1,100 +1,100 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.defgroup"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(!isset($args[0]) || count($args) > 2) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.usage")); - - return true; - } - - $group = $this->plugin->getGroup($args[0]); - - if($group === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.group_not_exist", $args[0])); - - return true; - } - - $levelName = null; - - if(isset($args[1])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); - - if($level === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.level_not_exist", $args[1])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $this->plugin->setDefaultGroup($group, $levelName); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.defgroup_successfully", $args[0])); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.defgroup"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(!isset($args[0]) || count($args) > 2) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.usage")); + + return true; + } + + $group = $this->plugin->getGroup($args[0]); + + if($group === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.group_not_exist", $args[0])); + + return true; + } + + $levelName = null; + + if(isset($args[1])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); + + if($level === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.level_not_exist", $args[1])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $this->plugin->setDefaultGroup($group, $levelName); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.defgroup_successfully", $args[0])); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/FPerms.php b/src/_64FF00/PurePerms/Commands/FPerms.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/FPerms.php rename to src/_64FF00/PurePerms/Commands/FPerms.php index a2935144..282b851e 100644 --- a/src/_64FF00/PurePerms/cmd/FPerms.php +++ b/src/_64FF00/PurePerms/Commands/FPerms.php @@ -1,117 +1,117 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.fperms"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(!isset($args[0]) || count($args) > 2) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.usage")); - - return true; - } - - $plugin = (strtolower($args[0]) === 'pocketmine' || strtolower($args[0]) === 'pmmp') ? 'pocketmine' : $this->plugin->getServer()->getPluginManager()->getPlugin($args[0]); - - if($plugin === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.plugin_not_exist", $args[0])); - - return true; - } - - $permissions = ($plugin instanceof PluginBase) ? $plugin->getDescription()->getPermissions() : $this->plugin->getPocketMinePerms(); - - if(empty($permissions)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.no_plugin_perms", $plugin->getName())); - - return true; - } - - $pageHeight = $sender instanceof ConsoleCommandSender ? 48 : 6; - - $chunkedPermissions = array_chunk($permissions, $pageHeight); - - $maxPageNumber = count($chunkedPermissions); - - if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) - { - $pageNumber = 1; - } - else if($args[1] > $maxPageNumber) - { - $pageNumber = $maxPageNumber; - } - else - { - $pageNumber = $args[1]; - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.plugin_perms_list", ($plugin instanceof PluginBase) ? $plugin->getName(): 'PocketMine-MP', $pageNumber, $maxPageNumber)); - - foreach($chunkedPermissions[$pageNumber - 1] as $permission) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission->getName()); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.fperms"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(!isset($args[0]) || count($args) > 2) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.usage")); + + return true; + } + + $plugin = (strtolower($args[0]) === 'pocketmine' || strtolower($args[0]) === 'pmmp') ? 'pocketmine' : $this->plugin->getServer()->getPluginManager()->getPlugin($args[0]); + + if($plugin === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.plugin_not_exist", $args[0])); + + return true; + } + + $permissions = ($plugin instanceof PluginBase) ? $plugin->getDescription()->getPermissions() : $this->plugin->getPocketMinePerms(); + + if(empty($permissions)) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.no_plugin_perms", $plugin->getName())); + + return true; + } + + $pageHeight = $sender instanceof ConsoleCommandSender ? 48 : 6; + + $chunkedPermissions = array_chunk($permissions, $pageHeight); + + $maxPageNumber = count($chunkedPermissions); + + if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) + { + $pageNumber = 1; + } + else if($args[1] > $maxPageNumber) + { + $pageNumber = $maxPageNumber; + } + else + { + $pageNumber = $args[1]; + } + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.plugin_perms_list", ($plugin instanceof PluginBase) ? $plugin->getName(): 'PocketMine-MP', $pageNumber, $maxPageNumber)); + + foreach($chunkedPermissions[$pageNumber - 1] as $permission) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission->getName()); + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/Groups.php b/src/_64FF00/PurePerms/Commands/Groups.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/Groups.php rename to src/_64FF00/PurePerms/Commands/Groups.php index 95d332aa..ebe7aa38 100644 --- a/src/_64FF00/PurePerms/cmd/Groups.php +++ b/src/_64FF00/PurePerms/Commands/Groups.php @@ -1,73 +1,73 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.groups"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - $result = []; - - foreach($this->plugin->getGroups() as $group) - { - $result[] = $group->getName(); - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.groups.messages.all_registered_groups", implode(", ", $result))); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.groups"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + $result = []; + + foreach($this->plugin->getGroups() as $group) + { + $result[] = $group->getName(); + } + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.groups.messages.all_registered_groups", implode(", ", $result))); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/GrpInfo.php b/src/_64FF00/PurePerms/Commands/GrpInfo.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/GrpInfo.php rename to src/_64FF00/PurePerms/Commands/GrpInfo.php index 6844e129..27a3907d 100644 --- a/src/_64FF00/PurePerms/cmd/GrpInfo.php +++ b/src/_64FF00/PurePerms/Commands/GrpInfo.php @@ -1,118 +1,118 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.grpinfo"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(count($args) < 1 || count($args) > 2) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.usage")); - - return true; - } - - $group = $this->plugin->getGroup($args[0]); - - if($group === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.group_not_exist", $args[0])); - - return true; - } - - $levelName = null; - - if(isset($args[1])) - { - $level = $this->plugin->getServer()->getLevelByName($args[1]); - - if($level === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.level_not_exist", $args[1])); - - return true; - } - - $levelName = $level->getName(); - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_header", $group->getName())); - - $alias = TextFormat::DARK_GREEN . $group->getAlias(); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_alias", $alias)); - - $isDefault = $group->isDefault($levelName) ? TextFormat::DARK_GREEN . "YES" : TextFormat::RED . "NO"; - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_default", $isDefault)); - - $result = TextFormat::DARK_GREEN . "..."; - - /** @var PPGroup $tempGroup */ - foreach($group->getParentGroups() as $tempGroup) - { - $parents[] = $tempGroup->getName(); - } - - if(!empty($group->getParentGroups())) - $result = TextFormat::DARK_GREEN . implode(",", $parents); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_parents", $result)); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.grpinfo"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(count($args) < 1 || count($args) > 2) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.usage")); + + return true; + } + + $group = $this->plugin->getGroup($args[0]); + + if($group === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.group_not_exist", $args[0])); + + return true; + } + + $levelName = null; + + if(isset($args[1])) + { + $level = $this->plugin->getServer()->getLevelByName($args[1]); + + if($level === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.level_not_exist", $args[1])); + + return true; + } + + $levelName = $level->getName(); + } + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_header", $group->getName())); + + $alias = TextFormat::DARK_GREEN . $group->getAlias(); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_alias", $alias)); + + $isDefault = $group->isDefault($levelName) ? TextFormat::DARK_GREEN . "YES" : TextFormat::RED . "NO"; + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_default", $isDefault)); + + $result = TextFormat::DARK_GREEN . "..."; + + /** @var PPGroup $tempGroup */ + foreach($group->getParentGroups() as $tempGroup) + { + $parents[] = $tempGroup->getName(); + } + + if(!empty($group->getParentGroups())) + $result = TextFormat::DARK_GREEN . implode(",", $parents); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_parents", $result)); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/ListGPerms.php b/src/_64FF00/PurePerms/Commands/ListGPerms.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/ListGPerms.php rename to src/_64FF00/PurePerms/Commands/ListGPerms.php index fd2f9a4e..70bd12da 100644 --- a/src/_64FF00/PurePerms/cmd/ListGPerms.php +++ b/src/_64FF00/PurePerms/Commands/ListGPerms.php @@ -1,132 +1,132 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.listgperms"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(count($args) < 1 || count($args) > 3) - { - $sender->sendMessage(TextFormat::BLUE . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.usage")); - - return true; - } - - $group = $this->plugin->getGroup($args[0]); - - if($group == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_not_exist", $args[0])); - - return true; - } - - $levelName = null; - - if(isset($args[2])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - - if($level == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $permissions = $group->getGroupPermissions($levelName); - - if(empty($permissions)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.no_group_perms", $group->getName())); - - return true; - } - - $pageHeight = $sender instanceof ConsoleCommandSender ? 24 : 6; - - $chunkedPermissions = array_chunk($permissions, $pageHeight); - - $maxPageNumber = count($chunkedPermissions); - - if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) - { - $pageNumber = 1; - } - else if($args[1] > $maxPageNumber) - { - $pageNumber = $maxPageNumber; - } - else - { - $pageNumber = $args[1]; - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_perms_list", $group->getName(), $pageNumber, $maxPageNumber)); - - foreach($chunkedPermissions[$pageNumber - 1] as $permission) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.listgperms"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(count($args) < 1 || count($args) > 3) + { + $sender->sendMessage(TextFormat::BLUE . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.usage")); + + return true; + } + + $group = $this->plugin->getGroup($args[0]); + + if($group == null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_not_exist", $args[0])); + + return true; + } + + $levelName = null; + + if(isset($args[2])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + + if($level == null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $permissions = $group->getGroupPermissions($levelName); + + if(empty($permissions)) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.no_group_perms", $group->getName())); + + return true; + } + + $pageHeight = $sender instanceof ConsoleCommandSender ? 24 : 6; + + $chunkedPermissions = array_chunk($permissions, $pageHeight); + + $maxPageNumber = count($chunkedPermissions); + + if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) + { + $pageNumber = 1; + } + else if($args[1] > $maxPageNumber) + { + $pageNumber = $maxPageNumber; + } + else + { + $pageNumber = $args[1]; + } + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_perms_list", $group->getName(), $pageNumber, $maxPageNumber)); + + foreach($chunkedPermissions[$pageNumber - 1] as $permission) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission); + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/ListUPerms.php b/src/_64FF00/PurePerms/Commands/ListUPerms.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/ListUPerms.php rename to src/_64FF00/PurePerms/Commands/ListUPerms.php index ff8390cd..854a09cd 100644 --- a/src/_64FF00/PurePerms/cmd/ListUPerms.php +++ b/src/_64FF00/PurePerms/Commands/ListUPerms.php @@ -1,125 +1,125 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.listuperms"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(count($args) < 1 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.usage")); - - return true; - } - - $player = $this->plugin->getPlayer($args[0]); - - $levelName = null; - - if(isset($args[2])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - - if($level == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $permissions = $this->plugin->getUserDataMgr()->getUserPermissions($player, $levelName); - - if(empty($permissions)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.no_user_perms", $player->getName())); - - return true; - } - - $pageHeight = $sender instanceof ConsoleCommandSender ? 24 : 6; - - $chunkedPermissions = array_chunk($permissions, $pageHeight); - - $maxPageNumber = count($chunkedPermissions); - - if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) - { - $pageNumber = 1; - } - else if($args[1] > $maxPageNumber) - { - $pageNumber = $maxPageNumber; - } - else - { - $pageNumber = $args[1]; - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.user_perms_list", $player->getName(), $pageNumber, $maxPageNumber)); - - foreach($chunkedPermissions[$pageNumber - 1] as $permission) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.listuperms"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(count($args) < 1 || count($args) > 3) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.usage")); + + return true; + } + + $player = $this->plugin->getPlayer($args[0]); + + $levelName = null; + + if(isset($args[2])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + + if($level == null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $permissions = $this->plugin->getUserDataMgr()->getUserPermissions($player, $levelName); + + if(empty($permissions)) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.no_user_perms", $player->getName())); + + return true; + } + + $pageHeight = $sender instanceof ConsoleCommandSender ? 24 : 6; + + $chunkedPermissions = array_chunk($permissions, $pageHeight); + + $maxPageNumber = count($chunkedPermissions); + + if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) + { + $pageNumber = 1; + } + else if($args[1] > $maxPageNumber) + { + $pageNumber = $maxPageNumber; + } + else + { + $pageNumber = $args[1]; + } + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.user_perms_list", $player->getName(), $pageNumber, $maxPageNumber)); + + foreach($chunkedPermissions[$pageNumber - 1] as $permission) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission); + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/PPInfo.php b/src/_64FF00/PurePerms/Commands/PPInfo.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/PPInfo.php rename to src/_64FF00/PurePerms/Commands/PPInfo.php index d19605a7..38295969 100644 --- a/src/_64FF00/PurePerms/cmd/PPInfo.php +++ b/src/_64FF00/PurePerms/Commands/PPInfo.php @@ -1,77 +1,77 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.ppinfo"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - $author = $this->plugin->getDescription()->getAuthors()[0]; - $version = $this->plugin->getDescription()->getVersion(); - - if($sender instanceof ConsoleCommandSender) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppinfo.messages.ppinfo_console", $version, $author)); - } - else - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppinfo.messages.ppinfo_player", $version, $author)); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.ppinfo"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + $author = $this->plugin->getDescription()->getAuthors()[0]; + $version = $this->plugin->getDescription()->getVersion(); + + if($sender instanceof ConsoleCommandSender) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppinfo.messages.ppinfo_console", $version, $author)); + } + else + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppinfo.messages.ppinfo_player", $version, $author)); + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/PPReload.php b/src/_64FF00/PurePerms/Commands/PPReload.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/PPReload.php rename to src/_64FF00/PurePerms/Commands/PPReload.php index 4fc44965..066360fd 100644 --- a/src/_64FF00/PurePerms/cmd/PPReload.php +++ b/src/_64FF00/PurePerms/Commands/PPReload.php @@ -1,68 +1,68 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.ppreload"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - $this->plugin->reload(); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppreload.messages.successfully_reloaded")); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.ppreload"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + $this->plugin->reload(); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppreload.messages.successfully_reloaded")); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/PPSudo.php b/src/_64FF00/PurePerms/Commands/PPSudo.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/PPSudo.php rename to src/_64FF00/PurePerms/Commands/PPSudo.php index 4a2f3f9b..157a7a9a 100644 --- a/src/_64FF00/PurePerms/cmd/PPSudo.php +++ b/src/_64FF00/PurePerms/Commands/PPSudo.php @@ -1,138 +1,138 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.noeul.ppsudo"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(!($sender instanceof Player)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.invalid_sender")); - - return true; - } - - if(!isset($args[0]) || count($args) > 2) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.usage")); - - return true; - } - - $noeulAPI = $this->plugin->getNoeulAPI(); - - switch(strtolower($args[0])) - { - case "login": - - if(!$noeulAPI->isRegistered($sender)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.not_registered")); - - return true; - } - - if(!isset($args[1])) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.login_usage")); - - return true; - } - - $hash = $this->plugin->getUserDataMgr()->getNode($sender, 'noeulPW'); - - if($noeulAPI->hashEquals($args[1], $hash)) - $noeulAPI->auth($sender); - - break; - - case "register": - - if($noeulAPI->isRegistered($sender)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' '. $this->plugin->getMessage("cmds.ppsudo.messages.already_registered")); - - return true; - } - - if(!isset($args[1])) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.register_usage")); - - return true; - } - - $mpl = $this->plugin->getConfigValue("noeul-minimum-pw-length"); - - if(mb_strlen($args[1]) < $mpl) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.password_too_short", $mpl)); - - return true; - } - - if($noeulAPI->register($sender, $args[1])) - $noeulAPI->auth($sender); - - break; - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.noeul.ppsudo"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(!($sender instanceof Player)) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.invalid_sender")); + + return true; + } + + if(!isset($args[0]) || count($args) > 2) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.usage")); + + return true; + } + + $noeulAPI = $this->plugin->getNoeulAPI(); + + switch(strtolower($args[0])) + { + case "login": + + if(!$noeulAPI->isRegistered($sender)) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.not_registered")); + + return true; + } + + if(!isset($args[1])) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.login_usage")); + + return true; + } + + $hash = $this->plugin->getUserDataMgr()->getNode($sender, 'noeulPW'); + + if($noeulAPI->hashEquals($args[1], $hash)) + $noeulAPI->auth($sender); + + break; + + case "register": + + if($noeulAPI->isRegistered($sender)) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' '. $this->plugin->getMessage("cmds.ppsudo.messages.already_registered")); + + return true; + } + + if(!isset($args[1])) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.register_usage")); + + return true; + } + + $mpl = $this->plugin->getConfigValue("noeul-minimum-pw-length"); + + if(mb_strlen($args[1]) < $mpl) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.password_too_short", $mpl)); + + return true; + } + + if($noeulAPI->register($sender, $args[1])) + $noeulAPI->auth($sender); + + break; + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/RmGroup.php b/src/_64FF00/PurePerms/Commands/RmGroup.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/RmGroup.php rename to src/_64FF00/PurePerms/Commands/RmGroup.php index 8b8b17b5..1dbe58dc 100644 --- a/src/_64FF00/PurePerms/cmd/RmGroup.php +++ b/src/_64FF00/PurePerms/Commands/RmGroup.php @@ -1,86 +1,86 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.rmgroup"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(!isset($args[0]) || count($args) > 1) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.usage")); - - return true; - } - - $result = $this->plugin->removeGroup($args[0]); - - if($result === PurePerms::SUCCESS) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.group_removed_successfully", $args[0])); - } - elseif($result === PurePerms::INVALID_NAME) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.invalid_group_name", $args[0])); - } - else - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.group_not_exist", $args[0])); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.rmgroup"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(!isset($args[0]) || count($args) > 1) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.usage")); + + return true; + } + + $result = $this->plugin->removeGroup($args[0]); + + if($result === PurePerms::SUCCESS) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.group_removed_successfully", $args[0])); + } + elseif($result === PurePerms::INVALID_NAME) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.invalid_group_name", $args[0])); + } + else + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.group_not_exist", $args[0])); + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/RmParent.php b/src/_64FF00/PurePerms/Commands/RmParent.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/RmParent.php rename to src/_64FF00/PurePerms/Commands/RmParent.php index 946640eb..c54e8e9e 100644 --- a/src/_64FF00/PurePerms/cmd/RmParent.php +++ b/src/_64FF00/PurePerms/Commands/RmParent.php @@ -1,79 +1,79 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.rmparent"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmparent.usage")); - - return true; - } - - $target_group = $this->plugin->getGroup($args[0]); - - $parent_group = $this->plugin->getGroup($args[1]); - - $target_group->removeParent($parent_group); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmparent.messages.rmparent_successfully", $parent_group->getName(), $target_group->getName())); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.rmparent"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(count($args) < 2 || count($args) > 3) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmparent.usage")); + + return true; + } + + $target_group = $this->plugin->getGroup($args[0]); + + $parent_group = $this->plugin->getGroup($args[1]); + + $target_group->removeParent($parent_group); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmparent.messages.rmparent_successfully", $parent_group->getName(), $target_group->getName())); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/SetGPerm.php b/src/_64FF00/PurePerms/Commands/SetGPerm.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/SetGPerm.php rename to src/_64FF00/PurePerms/Commands/SetGPerm.php index 60d279b4..ec58c2c7 100644 --- a/src/_64FF00/PurePerms/cmd/SetGPerm.php +++ b/src/_64FF00/PurePerms/Commands/SetGPerm.php @@ -1,104 +1,104 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.setgperm"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - { - return false; - } - - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.usage")); - - return true; - } - - $group = $this->plugin->getGroup($args[0]); - - if($group == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.group_not_exist", $args[0])); - - return true; - } - - $permission = $args[1]; - - $levelName = null; - - if(isset($args[2])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - - if($level === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $group->setGroupPermission($permission, $levelName); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.gperm_added_successfully", $permission)); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.setgperm"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + { + return false; + } + + if(count($args) < 2 || count($args) > 3) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.usage")); + + return true; + } + + $group = $this->plugin->getGroup($args[0]); + + if($group == null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.group_not_exist", $args[0])); + + return true; + } + + $permission = $args[1]; + + $levelName = null; + + if(isset($args[2])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + + if($level === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $group->setGroupPermission($permission, $levelName); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.gperm_added_successfully", $permission)); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/SetGroup.php b/src/_64FF00/PurePerms/Commands/SetGroup.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/SetGroup.php rename to src/_64FF00/PurePerms/Commands/SetGroup.php index fe1b7834..dc16b59a 100644 --- a/src/_64FF00/PurePerms/cmd/SetGroup.php +++ b/src/_64FF00/PurePerms/Commands/SetGroup.php @@ -1,144 +1,144 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.setgroup"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - { - return false; - } - - if(count($args) < 2 || count($args) > 4) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.usage")); - - return true; - } - - $player = $this->plugin->getPlayer($args[0]); - - $group = $this->plugin->getGroup($args[1]); - - if($group === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.group_not_exist", $args[1])); - - return true; - } - - $expTime = -1; - - if(isset($args[2])) - $expTime = $this->plugin->date2Int($args[2]); - - $levelName = null; - - if(isset($args[3])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[3]); - - if($level === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.level_not_exist", $args[3])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $superAdminRanks = $this->plugin->getConfigValue("superadmin-ranks"); - - foreach(array_values($superAdminRanks) as $value) - { - $tmpSuperAdminRanks[$value] = 1; - } - - if(!($sender instanceof ConsoleCommandSender)) - { - if(isset($tmpSuperAdminRanks[$group->getName()])) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_01", $group->getName())); - - return true; - } - - $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $levelName); - - if(isset($tmpSuperAdminRanks[$userGroup->getName()])) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_02", $userGroup->getName())); - - return true; - } - } - - $this->plugin->getUserDataMgr()->setGroup($player, $group, $levelName, $expTime); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.setgroup_successfully", $player->getName())); - - if($player instanceof Player) - { - if(!$this->plugin->getConfigValue("enable-multiworld-perms") || ($this->plugin->getConfigValue("enable-multiworld-perms") and $levelName === $player->getWorld()->getDisplayName())) - $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.on_player_group_change", strtolower($group->getName()))); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.setgroup"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + { + return false; + } + + if(count($args) < 2 || count($args) > 4) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.usage")); + + return true; + } + + $player = $this->plugin->getPlayer($args[0]); + + $group = $this->plugin->getGroup($args[1]); + + if($group === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.group_not_exist", $args[1])); + + return true; + } + + $expTime = -1; + + if(isset($args[2])) + $expTime = $this->plugin->date2Int($args[2]); + + $levelName = null; + + if(isset($args[3])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[3]); + + if($level === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.level_not_exist", $args[3])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $superAdminRanks = $this->plugin->getConfigValue("superadmin-ranks"); + + foreach(array_values($superAdminRanks) as $value) + { + $tmpSuperAdminRanks[$value] = 1; + } + + if(!($sender instanceof ConsoleCommandSender)) + { + if(isset($tmpSuperAdminRanks[$group->getName()])) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_01", $group->getName())); + + return true; + } + + $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $levelName); + + if(isset($tmpSuperAdminRanks[$userGroup->getName()])) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_02", $userGroup->getName())); + + return true; + } + } + + $this->plugin->getUserDataMgr()->setGroup($player, $group, $levelName, $expTime); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.setgroup_successfully", $player->getName())); + + if($player instanceof Player) + { + if(!$this->plugin->getConfigValue("enable-multiworld-perms") || ($this->plugin->getConfigValue("enable-multiworld-perms") and $levelName === $player->getWorld()->getDisplayName())) + $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.on_player_group_change", strtolower($group->getName()))); + } + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/SetUPerm.php b/src/_64FF00/PurePerms/Commands/SetUPerm.php similarity index 95% rename from src/_64FF00/PurePerms/cmd/SetUPerm.php rename to src/_64FF00/PurePerms/Commands/SetUPerm.php index 7326a17e..9ddf9ce6 100644 --- a/src/_64FF00/PurePerms/cmd/SetUPerm.php +++ b/src/_64FF00/PurePerms/Commands/SetUPerm.php @@ -1,95 +1,95 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.setuperm"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.usage")); - - return true; - } - - $player = $this->plugin->getPlayer($args[0]); - - $permission = $args[1]; - - $levelName = null; - - if(isset($args[2])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - - if($level === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.messages.level_not_exist", $args[2])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $this->plugin->getUserDataMgr()->setPermission($player, $permission, $levelName); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.messages.uperm_added_successfully", $permission, $player->getName())); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.setuperm"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(count($args) < 2 || count($args) > 3) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.usage")); + + return true; + } + + $player = $this->plugin->getPlayer($args[0]); + + $permission = $args[1]; + + $levelName = null; + + if(isset($args[2])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + + if($level === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.messages.level_not_exist", $args[2])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $this->plugin->getUserDataMgr()->setPermission($player, $permission, $levelName); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.messages.uperm_added_successfully", $permission, $player->getName())); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/UnsetGPerm.php b/src/_64FF00/PurePerms/Commands/UnsetGPerm.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/UnsetGPerm.php rename to src/_64FF00/PurePerms/Commands/UnsetGPerm.php index 728b61ee..385f7aaf 100644 --- a/src/_64FF00/PurePerms/cmd/UnsetGPerm.php +++ b/src/_64FF00/PurePerms/Commands/UnsetGPerm.php @@ -1,104 +1,104 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.unsetgperm"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - { - return false; - } - - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.usage")); - - return true; - } - - $group = $this->plugin->getGroup($args[0]); - - if($group == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' '. $this->plugin->getMessage("cmds.unsetgperm.messages.group_not_exist", $args[0])); - - return true; - } - - $permission = $args[1]; - - $levelName = null; - - if(isset($args[2])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - - if($level == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $group->unsetGroupPermission($permission, $levelName); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.gperm_removed_successfully", $permission)); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.unsetgperm"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + { + return false; + } + + if(count($args) < 2 || count($args) > 3) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.usage")); + + return true; + } + + $group = $this->plugin->getGroup($args[0]); + + if($group == null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' '. $this->plugin->getMessage("cmds.unsetgperm.messages.group_not_exist", $args[0])); + + return true; + } + + $permission = $args[1]; + + $levelName = null; + + if(isset($args[2])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + + if($level == null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $group->unsetGroupPermission($permission, $levelName); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.gperm_removed_successfully", $permission)); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/UnsetUPerm.php b/src/_64FF00/PurePerms/Commands/UnsetUPerm.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/UnsetUPerm.php rename to src/_64FF00/PurePerms/Commands/UnsetUPerm.php index 157fd471..0d7fedba 100644 --- a/src/_64FF00/PurePerms/cmd/UnsetUPerm.php +++ b/src/_64FF00/PurePerms/Commands/UnsetUPerm.php @@ -1,95 +1,95 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.unsetuperm"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetuperm.usage")); - - return true; - } - - $player = $this->plugin->getPlayer($args[0]); - - $permission = $args[1]; - - $levelName = null; - - if(isset($args[2])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - - if($level === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $this->plugin->getUserDataMgr()->unsetPermission($player, $permission, $levelName); - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetuperm.messages.uperm_removed_successfully", $permission, $player->getName())); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.unsetuperm"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(count($args) < 2 || count($args) > 3) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetuperm.usage")); + + return true; + } + + $player = $this->plugin->getPlayer($args[0]); + + $permission = $args[1]; + + $levelName = null; + + if(isset($args[2])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + + if($level === null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $this->plugin->getUserDataMgr()->unsetPermission($player, $permission, $levelName); + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetuperm.messages.uperm_removed_successfully", $permission, $player->getName())); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/cmd/UsrInfo.php b/src/_64FF00/PurePerms/Commands/UsrInfo.php similarity index 96% rename from src/_64FF00/PurePerms/cmd/UsrInfo.php rename to src/_64FF00/PurePerms/Commands/UsrInfo.php index da4321cf..4a8f390d 100644 --- a/src/_64FF00/PurePerms/cmd/UsrInfo.php +++ b/src/_64FF00/PurePerms/Commands/UsrInfo.php @@ -1,110 +1,110 @@ -plugin = $plugin; - - parent::__construct($name, $description); - - $this->setPermission("pperms.command.usrinfo"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - - if(count($args) < 1 || count($args) > 2) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.usage")); - - return true; - } - - $player = $this->plugin->getPlayer($args[0]); - - $levelName = null; - - if(isset($args[1])) - { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); - - if($level == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.level_not_exist", $args[1])); - - return true; - } - - $levelName = $level->getDisplayName(); - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_header", $player->getName())); - - $status = $player instanceof Player ? TextFormat::DARK_GREEN . $this->plugin->getMessage("cmds.usrinfo.messages.status_online") : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.status_offline"); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_status", $status)); - - $ip = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getNetworkSession()->getIp() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_ip", $ip)); - - $uuid = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getUniqueId()->toString() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_uuid", $uuid)); - - $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $levelName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_group", TextFormat::DARK_GREEN . $userGroup->getName())); - - $expDate = $this->plugin->getUserDataMgr()->getExpDate($player, $levelName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_exp", TextFormat::DARK_GREEN . $expDate)); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } +plugin = $plugin; + + parent::__construct($name, $description); + + $this->setPermission("pperms.command.usrinfo"); + } + + /** + * @param CommandSender $sender + * @param $label + * @param array $args + * @return bool + */ + public function execute(CommandSender $sender, string $label, array $args) : bool + { + if(!$this->testPermission($sender)) + return false; + + if(count($args) < 1 || count($args) > 2) + { + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.usage")); + + return true; + } + + $player = $this->plugin->getPlayer($args[0]); + + $levelName = null; + + if(isset($args[1])) + { + $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); + + if($level == null) + { + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.level_not_exist", $args[1])); + + return true; + } + + $levelName = $level->getDisplayName(); + } + + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_header", $player->getName())); + + $status = $player instanceof Player ? TextFormat::DARK_GREEN . $this->plugin->getMessage("cmds.usrinfo.messages.status_online") : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.status_offline"); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_status", $status)); + + $ip = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getNetworkSession()->getIp() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_ip", $ip)); + + $uuid = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getUniqueId()->toString() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_uuid", $uuid)); + + $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $levelName); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_group", TextFormat::DARK_GREEN . $userGroup->getName())); + + $expDate = $this->plugin->getUserDataMgr()->getExpDate($player, $levelName); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_exp", TextFormat::DARK_GREEN . $expDate)); + + return true; + } + + public function getPlugin() : Plugin + { + return $this->plugin; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/data/UserDataManager.php b/src/_64FF00/PurePerms/DataManager/UserDataManager.php similarity index 95% rename from src/_64FF00/PurePerms/data/UserDataManager.php rename to src/_64FF00/PurePerms/DataManager/UserDataManager.php index 89c80b43..b855be34 100644 --- a/src/_64FF00/PurePerms/data/UserDataManager.php +++ b/src/_64FF00/PurePerms/DataManager/UserDataManager.php @@ -1,273 +1,273 @@ -plugin = $plugin; - } - - /** - * @param IPlayer $player - * @return array - */ - public function getData(IPlayer $player) - { - return $this->plugin->getProvider()->getPlayerData($player); - } - - public function getExpDate(IPlayer $player, $levelName = null) - { - $expDate = $levelName !== null ? $this->getWorldData($player, $levelName)["expTime"] : $this->getNode($player, "expTime"); - - // TODO - return $expDate; - } - - /** - * @param IPlayer $player - * @param null $levelName - * @return PPGroup|null - */ - public function getGroup(IPlayer $player, $levelName = null) - { - $groupName = $levelName !== null ? $this->getWorldData($player, $levelName)["group"] : $this->getNode($player, "group"); - - $group = $this->plugin->getGroup($groupName); - - // TODO: ... - if($group === null) - { - $this->plugin->getLogger()->critical("Invalid group name found in " . $player->getName() . "'s player data (World: " . ($levelName === null ? "GLOBAL" : $levelName) . ")"); - $this->plugin->getLogger()->critical("Restoring the group data to 'default'"); - - $defaultGroup = $this->plugin->getDefaultGroup($levelName); - - $this->setGroup($player, $defaultGroup, $levelName); - - return $defaultGroup; - } - - return $group; - } - - /** - * @param IPlayer $player - * @param $node - * @return null|mixed - */ - public function getNode(IPlayer $player, $node) - { - $userData = $this->getData($player); - - if(!isset($userData[$node])) - return null; - - return $userData[$node]; - } - - /** - * @param null $levelName - * @return array - */ - public function getUserPermissions(IPlayer $player, $levelName = null) - { - $permissions = $levelName != null ? $this->getWorldData($player, $levelName)["permissions"] : $this->getNode($player, "permissions"); - - if(!is_array($permissions)) - { - $this->plugin->getLogger()->critical("Invalid 'permissions' node given to " . __METHOD__ . '()'); - - return []; - } - - return $permissions; - } - - /** - * @param IPlayer $player - * @param $levelName - * @return array - */ - public function getWorldData(IPlayer $player, $levelName) - { - if($levelName === null) - $levelName = $this->plugin->getServer()->getWorldManager()->getDefaultWorld()->getDisplayName(); - - if(!isset($this->getData($player)["worlds"][$levelName])) - return [ - "group" => $this->plugin->getDefaultGroup($levelName)->getName(), - "permissions" => [ - ], - "expTime" => -1 - ]; - - return $this->getData($player)["worlds"][$levelName]; - } - - public function removeNode(IPlayer $player, $node) - { - $tempUserData = $this->getData($player); - - if(isset($tempUserData[$node])) - { - unset($tempUserData[$node]); - - $this->setData($player, $tempUserData); - } - } - - /** - * @param IPlayer $player - * @param array $data - */ - public function setData(IPlayer $player, array $data) - { - $this->plugin->getProvider()->setPlayerData($player, $data); - } - - /** - * @param IPlayer $player - * @param PPGroup $group - * @param $levelName - * @param int $time - */ - public function setGroup(IPlayer $player, PPGroup $group, $levelName, $time = -1) - { - if($levelName === null) - { - $this->setNode($player, "group", $group->getName()); - $this->setNode($player, "expTime", $time); - } - else - { - $worldData = $this->getWorldData($player, $levelName); - - $worldData["group"] = $group->getName(); - $worldData["expTime"] = $time; - - $this->setWorldData($player, $levelName, $worldData); - } - - $event = new PPGroupChangedEvent($this->plugin, $player, $group, $levelName); - - $event->call(); - } - - /** - * @param IPlayer $player - * @param $node - * @param $value - */ - public function setNode(IPlayer $player, $node, $value) - { - $tempUserData = $this->getData($player); - - $tempUserData[$node] = $value; - - $this->setData($player, $tempUserData); - } - - /** - * @param IPlayer $player - * @param $permission - * @param null $levelName - */ - public function setPermission(IPlayer $player, $permission, $levelName = null) - { - if($levelName === null) - { - $tempUserData = $this->getData($player); - - $tempUserData["permissions"][] = $permission; - - $this->setData($player, $tempUserData); - } - else - { - $worldData = $this->getWorldData($player, $levelName); - - $worldData["permissions"][] = $permission; - - $this->setWorldData($player, $levelName, $worldData); - } - - $this->plugin->updatePermissions($player); - } - - public function setWorldData(IPlayer $player, $levelName, array $worldData) - { - $tempUserData = $this->getData($player); - - if(!isset($this->getData($player)["worlds"][$levelName])) - { - $tempUserData["worlds"][$levelName] = [ - "group" => $this->plugin->getDefaultGroup()->getName(), - "permissions" => [ - ], - "expTime" => -1 - ]; - - $this->setData($player, $tempUserData); - } - - $tempUserData["worlds"][$levelName] = $worldData; - - $this->setData($player, $tempUserData); - } - - /** - * @param IPlayer $player - * @param $permission - * @param null $levelName - */ - public function unsetPermission(IPlayer $player, $permission, $levelName = null) - { - if($levelName === null) - { - $tempUserData = $this->getData($player); - - if(!in_array($permission, $tempUserData["permissions"])) return; - - $tempUserData["permissions"] = array_diff($tempUserData["permissions"], [$permission]); - - $this->setData($player, $tempUserData); - } - else - { - $worldData = $this->getWorldData($player, $levelName); - - if(!in_array($permission, $worldData["permissions"])) return; - - $worldData["permissions"] = array_diff($worldData["permissions"], [$permission]); - - $this->setWorldData($player, $levelName, $worldData); - } - - $this->plugin->updatePermissions($player); - } +plugin = $plugin; + } + + /** + * @param IPlayer $player + * @return array + */ + public function getData(IPlayer $player) + { + return $this->plugin->getProvider()->getPlayerData($player); + } + + public function getExpDate(IPlayer $player, $levelName = null) + { + $expDate = $levelName !== null ? $this->getWorldData($player, $levelName)["expTime"] : $this->getNode($player, "expTime"); + + // TODO + return $expDate; + } + + /** + * @param IPlayer $player + * @param null $levelName + * @return PPGroup|null + */ + public function getGroup(IPlayer $player, $levelName = null) + { + $groupName = $levelName !== null ? $this->getWorldData($player, $levelName)["group"] : $this->getNode($player, "group"); + + $group = $this->plugin->getGroup($groupName); + + // TODO: ... + if($group === null) + { + $this->plugin->getLogger()->critical("Invalid group name found in " . $player->getName() . "'s player data (World: " . ($levelName === null ? "GLOBAL" : $levelName) . ")"); + $this->plugin->getLogger()->critical("Restoring the group data to 'default'"); + + $defaultGroup = $this->plugin->getDefaultGroup($levelName); + + $this->setGroup($player, $defaultGroup, $levelName); + + return $defaultGroup; + } + + return $group; + } + + /** + * @param IPlayer $player + * @param $node + * @return null|mixed + */ + public function getNode(IPlayer $player, $node) + { + $userData = $this->getData($player); + + if(!isset($userData[$node])) + return null; + + return $userData[$node]; + } + + /** + * @param null $levelName + * @return array + */ + public function getUserPermissions(IPlayer $player, $levelName = null) + { + $permissions = $levelName != null ? $this->getWorldData($player, $levelName)["permissions"] : $this->getNode($player, "permissions"); + + if(!is_array($permissions)) + { + $this->plugin->getLogger()->critical("Invalid 'permissions' node given to " . __METHOD__ . '()'); + + return []; + } + + return $permissions; + } + + /** + * @param IPlayer $player + * @param $levelName + * @return array + */ + public function getWorldData(IPlayer $player, $levelName) + { + if($levelName === null) + $levelName = $this->plugin->getServer()->getWorldManager()->getDefaultWorld()->getDisplayName(); + + if(!isset($this->getData($player)["worlds"][$levelName])) + return [ + "group" => $this->plugin->getDefaultGroup($levelName)->getName(), + "permissions" => [ + ], + "expTime" => -1 + ]; + + return $this->getData($player)["worlds"][$levelName]; + } + + public function removeNode(IPlayer $player, $node) + { + $tempUserData = $this->getData($player); + + if(isset($tempUserData[$node])) + { + unset($tempUserData[$node]); + + $this->setData($player, $tempUserData); + } + } + + /** + * @param IPlayer $player + * @param array $data + */ + public function setData(IPlayer $player, array $data) + { + $this->plugin->getProvider()->setPlayerData($player, $data); + } + + /** + * @param IPlayer $player + * @param PPGroup $group + * @param $levelName + * @param int $time + */ + public function setGroup(IPlayer $player, PPGroup $group, $levelName, $time = -1) + { + if($levelName === null) + { + $this->setNode($player, "group", $group->getName()); + $this->setNode($player, "expTime", $time); + } + else + { + $worldData = $this->getWorldData($player, $levelName); + + $worldData["group"] = $group->getName(); + $worldData["expTime"] = $time; + + $this->setWorldData($player, $levelName, $worldData); + } + + $event = new PPGroupChangedEvent($this->plugin, $player, $group, $levelName); + + $event->call(); + } + + /** + * @param IPlayer $player + * @param $node + * @param $value + */ + public function setNode(IPlayer $player, $node, $value) + { + $tempUserData = $this->getData($player); + + $tempUserData[$node] = $value; + + $this->setData($player, $tempUserData); + } + + /** + * @param IPlayer $player + * @param $permission + * @param null $levelName + */ + public function setPermission(IPlayer $player, $permission, $levelName = null) + { + if($levelName === null) + { + $tempUserData = $this->getData($player); + + $tempUserData["permissions"][] = $permission; + + $this->setData($player, $tempUserData); + } + else + { + $worldData = $this->getWorldData($player, $levelName); + + $worldData["permissions"][] = $permission; + + $this->setWorldData($player, $levelName, $worldData); + } + + $this->plugin->updatePermissions($player); + } + + public function setWorldData(IPlayer $player, $levelName, array $worldData) + { + $tempUserData = $this->getData($player); + + if(!isset($this->getData($player)["worlds"][$levelName])) + { + $tempUserData["worlds"][$levelName] = [ + "group" => $this->plugin->getDefaultGroup()->getName(), + "permissions" => [ + ], + "expTime" => -1 + ]; + + $this->setData($player, $tempUserData); + } + + $tempUserData["worlds"][$levelName] = $worldData; + + $this->setData($player, $tempUserData); + } + + /** + * @param IPlayer $player + * @param $permission + * @param null $levelName + */ + public function unsetPermission(IPlayer $player, $permission, $levelName = null) + { + if($levelName === null) + { + $tempUserData = $this->getData($player); + + if(!in_array($permission, $tempUserData["permissions"])) return; + + $tempUserData["permissions"] = array_diff($tempUserData["permissions"], [$permission]); + + $this->setData($player, $tempUserData); + } + else + { + $worldData = $this->getWorldData($player, $levelName); + + if(!in_array($permission, $worldData["permissions"])) return; + + $worldData["permissions"] = array_diff($worldData["permissions"], [$permission]); + + $this->setWorldData($player, $levelName, $worldData); + } + + $this->plugin->updatePermissions($player); + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/provider/DefaultProvider.php b/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php similarity index 95% rename from src/_64FF00/PurePerms/provider/DefaultProvider.php rename to src/_64FF00/PurePerms/DataProviders/DefaultProvider.php index 2e6f2d98..6489dc57 100644 --- a/src/_64FF00/PurePerms/provider/DefaultProvider.php +++ b/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php @@ -1,158 +1,158 @@ -plugin = $plugin; - - $this->plugin->saveResource("groups.yml"); - - $this->groups = new Config($this->plugin->getDataFolder() . "groups.yml", Config::YAML); - - if(empty($this->groups->getAll())){ - throw new RuntimeException($this->plugin->getMessage("logger_messages.YAMLProvider_InvalidGroupsSettings")); - } - - $this->plugin->saveResource("players.yml"); - - $this->players = new Config($this->plugin->getDataFolder() . "players.yml", Config::YAML); - } - - /** - * @param PPGroup $group - * @return mixed - */ - public function getGroupData(PPGroup $group) - { - $groupName = $group->getName(); - - if(!isset($this->getGroupsData()[$groupName]) || !is_array($this->getGroupsData()[$groupName])) return []; - - return $this->getGroupsData()[$groupName]; - } - - /** - * @return mixed - */ - public function getGroupsConfig() - { - return $this->groups; - } - - /** - * @return mixed - */ - public function getGroupsData() - { - return $this->groups->getAll(); - } - - public function getPlayerData(IPlayer $player) - { - $userName = strtolower($player->getName()); - - if(!$this->players->exists($userName)) - { - return [ - "group" => $this->plugin->getDefaultGroup()->getName(), - "permissions" => [], - "worlds" => [], - "time" => -1 - ]; - } - - return $this->players->get($userName); - } - - public function getUsers() - { - /* - if(empty($this->players->getAll())) - return null; - - return $this->players->getAll(); - */ - } - - /** - * @param PPGroup $group - * @param array $tempGroupData - */ - public function setGroupData(PPGroup $group, array $tempGroupData) - { - $groupName = $group->getName(); - - $this->groups->set($groupName, $tempGroupData); - - $this->groups->save(); - } - - /** - * @param array $tempGroupsData - */ - public function setGroupsData(array $tempGroupsData) - { - $this->groups->setAll($tempGroupsData); - - $this->groups->save(); - } - - /** - * @param IPlayer $player - * @param array $tempUserData - */ - public function setPlayerData(IPlayer $player, array $tempUserData) - { - $userName = strtolower($player->getName()); - - if(!$this->players->exists($userName)) - { - $this->players->set($userName, [ - "group" => $this->plugin->getDefaultGroup()->getName(), - "permissions" => [], - "worlds" => [], - "time" => -1 - ]); - } - - if(isset($tempUserData["userName"])) - unset($tempUserData["userName"]); - - $this->players->set($userName, $tempUserData); - - $this->players->save(); - } - - public function close() - { - } +plugin = $plugin; + + $this->plugin->saveResource("groups.yml"); + + $this->groups = new Config($this->plugin->getDataFolder() . "groups.yml", Config::YAML); + + if(empty($this->groups->getAll())){ + throw new RuntimeException($this->plugin->getMessage("logger_messages.YAMLProvider_InvalidGroupsSettings")); + } + + $this->plugin->saveResource("players.yml"); + + $this->players = new Config($this->plugin->getDataFolder() . "players.yml", Config::YAML); + } + + /** + * @param PPGroup $group + * @return mixed + */ + public function getGroupData(PPGroup $group) + { + $groupName = $group->getName(); + + if(!isset($this->getGroupsData()[$groupName]) || !is_array($this->getGroupsData()[$groupName])) return []; + + return $this->getGroupsData()[$groupName]; + } + + /** + * @return mixed + */ + public function getGroupsConfig() + { + return $this->groups; + } + + /** + * @return mixed + */ + public function getGroupsData() + { + return $this->groups->getAll(); + } + + public function getPlayerData(IPlayer $player) + { + $userName = strtolower($player->getName()); + + if(!$this->players->exists($userName)) + { + return [ + "group" => $this->plugin->getDefaultGroup()->getName(), + "permissions" => [], + "worlds" => [], + "time" => -1 + ]; + } + + return $this->players->get($userName); + } + + public function getUsers() + { + /* + if(empty($this->players->getAll())) + return null; + + return $this->players->getAll(); + */ + } + + /** + * @param PPGroup $group + * @param array $tempGroupData + */ + public function setGroupData(PPGroup $group, array $tempGroupData) + { + $groupName = $group->getName(); + + $this->groups->set($groupName, $tempGroupData); + + $this->groups->save(); + } + + /** + * @param array $tempGroupsData + */ + public function setGroupsData(array $tempGroupsData) + { + $this->groups->setAll($tempGroupsData); + + $this->groups->save(); + } + + /** + * @param IPlayer $player + * @param array $tempUserData + */ + public function setPlayerData(IPlayer $player, array $tempUserData) + { + $userName = strtolower($player->getName()); + + if(!$this->players->exists($userName)) + { + $this->players->set($userName, [ + "group" => $this->plugin->getDefaultGroup()->getName(), + "permissions" => [], + "worlds" => [], + "time" => -1 + ]); + } + + if(isset($tempUserData["userName"])) + unset($tempUserData["userName"]); + + $this->players->set($userName, $tempUserData); + + $this->players->save(); + } + + public function close() + { + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/provider/MySQLProvider.php b/src/_64FF00/PurePerms/DataProviders/MySQLProvider.php similarity index 96% rename from src/_64FF00/PurePerms/provider/MySQLProvider.php rename to src/_64FF00/PurePerms/DataProviders/MySQLProvider.php index 3fa1c734..281b4c2a 100644 --- a/src/_64FF00/PurePerms/provider/MySQLProvider.php +++ b/src/_64FF00/PurePerms/DataProviders/MySQLProvider.php @@ -1,332 +1,332 @@ -plugin = $plugin; - - $mySQLSettings = $this->plugin->getConfigValue("mysql-settings"); - - if(!isset($mySQLSettings["host"]) || !isset($mySQLSettings["port"]) || !isset($mySQLSettings["user"]) || !isset($mySQLSettings["password"]) || !isset($mySQLSettings["db"])) - throw new RuntimeException("Failed to connect to the MySQL database: Invalid MySQL settings"); - - - $this->db = new \mysqli($mySQLSettings["host"], $mySQLSettings["user"], $mySQLSettings["password"], $mySQLSettings["db"], $mySQLSettings["port"]); - - if($this->db->connect_error) - throw new RuntimeException("Failed to connect to the MySQL database: " . $this->db->connect_error); - - $resource = $this->plugin->getResource("mysql_deploy_01.sql"); - - $this->db->multi_query(stream_get_contents($resource)); - - while($this->db->more_results()) - { - $this->db->next_result(); - } - - fclose($resource); - - $this->loadGroupsData(); - - $this->plugin->getScheduler()->scheduleRepeatingTask(new PPMySQLTask($this->plugin, $this->db), 1200); - } - - /** - * @param PPGroup $group - * @return array - */ - public function getGroupData(PPGroup $group) - { - $groupName = $group->getName(); - - if(!isset($this->getGroupsData()[$groupName]) || !is_array($this->getGroupsData()[$groupName])) return []; - - return $this->getGroupsData()[$groupName]; - } - - /** - * @return array - */ - public function getGroupsData() - { - return $this->groupsData; - } - - /** - * @param IPlayer $player - * @return array - */ - public function getPlayerData(IPlayer $player) - { - $userData = [ - "userName" => $player->getName(), - "group" => $this->plugin->getDefaultGroup()->getName(), - "permissions" => [] - ]; - - $result01 = $this->db->query("SELECT * FROM players WHERE userName = '" . $this->db->escape_string($player->getName()) . "';"); - - if($result01 instanceof \mysqli_result) - { - while($currentRow = $result01->fetch_assoc()) - { - $userData["group"] = $currentRow["userGroup"]; - $userData["permissions"] = explode(",", $currentRow["permissions"]); - } - - $result01->free(); - } - - $result02 = $this->db->query("SELECT * FROM players_mw WHERE userName = '" . $this->db->escape_string($player->getName()) . "';"); - - if($result02 instanceof \mysqli_result) - { - while($currentRow = $result02->fetch_assoc()) - { - $userGroup = $currentRow["userGroup"]; - $worldName = $currentRow["worldName"]; - $worldPerms = explode(",", $currentRow["permissions"]); - - $userData["worlds"][$worldName]["group"] = $userGroup; - - $userData["worlds"][$worldName]["permissions"] = $worldPerms; - } - - $result02->free(); - } - - return $userData; - } - - public function getUsers() - { - // TODO - } - - public function loadGroupsData() - { - $result01 = $this->db->query("SELECT * FROM groups;"); - - if($result01 instanceof \mysqli_result) - { - if($result01->num_rows <= 0) - { - $this->plugin->getLogger()->notice("No groups found in table 'groups', loading groups defined in default SQL script"); - - $resource = $this->plugin->getResource("mysql_deploy_02.sql"); - - $this->db->multi_query(stream_get_contents($resource)); - - while($this->db->more_results()) - { - $this->db->next_result(); - } - - fclose($resource); - - $result01 = $this->db->query("SELECT * FROM groups;"); - } - - while($currentRow = $result01->fetch_assoc()) - { - $groupName = $currentRow["groupName"]; - - $this->groupsData[$groupName]["alias"] = $currentRow["alias"]; - $this->groupsData[$groupName]["isDefault"] = $currentRow["isDefault"] === "1" ? true : false; - $this->groupsData[$groupName]["inheritance"] = $currentRow["inheritance"] !== "" ? explode(",", $currentRow["inheritance"]) : []; - $this->groupsData[$groupName]["permissions"] = explode(",", $currentRow["permissions"]); - } - - $result01->free(); - } - - $result02 = $this->db->query("SELECT * FROM groups_mw;"); - - if($result02 instanceof \mysqli_result) - { - while($currentRow = $result02->fetch_assoc()) - { - $isDefault = $currentRow["isDefault"] === "1" ? true : false; - $groupName = $currentRow["groupName"]; - $worldName = $currentRow["worldName"]; - $worldPerms = explode(",", $currentRow["permissions"]); - - $this->groupsData[$groupName]["worlds"][$worldName]["isDefault"] = $isDefault; - $this->groupsData[$groupName]["worlds"][$worldName]["permissions"] = $worldPerms; - } - - $result02->free(); - } - } - - /** - * @param $groupName - */ - public function removeGroupData($groupName) - { - $this->db->query(" - DELETE FROM groups - WHERE groupName = '" . $this->db->escape_string($groupName) . "';"); - - $this->db->query(" - DELETE OR IGNORE FROM groups_mw - WHERE groupName = '" . $this->db->escape_string($groupName) . "';"); - } - - - /** - * @param PPGroup $group - * @param array $tempGroupData - */ - public function setGroupData(PPGroup $group, array $tempGroupData) - { - $groupName = $group->getName(); - - $this->updateGroupData($groupName, $tempGroupData); - - $this->loadGroupsData(); - } - - /** - * @param array $tempGroupsData - */ - public function setGroupsData(array $tempGroupsData) - { - $tempGroupData01 = array_diff_key($this->groupsData, $tempGroupsData); - - $tempGroupName01 = key($tempGroupData01); - - if($tempGroupData01 !== []) $this->removeGroupData($tempGroupName01); - - foreach($tempGroupsData as $tempGroupName02 => $tempGroupData02) - { - $this->updateGroupData($tempGroupName02, $tempGroupData02); - } - - $this->loadGroupsData(); - } - - /** - * @param IPlayer $player - * @param array $tempUserData - */ - public function setPlayerData(IPlayer $player, array $tempUserData) - { - if(isset($tempUserData["group"]) and isset($tempUserData["permissions"])) - { - $userName = $player->getName(); - $userGroup = $tempUserData["group"]; - $permissions = implode(",", $tempUserData["permissions"]); - - $this->db->query("INSERT INTO players - (userName, userGroup, permissions) - VALUES - ('" . $this->db->escape_string($userName) . "', '" . $this->db->escape_string($userGroup) . "', '" . $this->db->escape_string($permissions) . "') - ON DUPLICATE KEY UPDATE - userGroup = VALUES(userGroup), - permissions = VALUES(permissions);"); - - if(isset($tempGroupData["worlds"])) - { - foreach($tempGroupData["worlds"] as $worldName => $worldData) - { - $worldGroup = $worldData["group"]; - $worldPerms = implode(",", $worldData["permissions"]); - - if(!is_array($worldPerms)) - { - $this->db->query("INSERT INTO players_mw - (userName, worldName, userGroup, permissions) - VALUES - ('" . $this->db->escape_string($userName) . "', '" . $this->db->escape_string($worldName) . "', '" . $this->db->escape_string($worldGroup) . "', '" . $this->db->escape_string($worldPerms) . "') - ON DUPLICATE KEY UPDATE - userGroup = VALUES(userGroup), - permissions = VALUES(permissions);"); - } - } - } - } - } - - /** - * @param $groupName - * @param array $tempGroupData - */ - public function updateGroupData($groupName, array $tempGroupData) - { - if(isset($tempGroupData["isDefault"]) and isset($tempGroupData["inheritance"]) and isset($tempGroupData["permissions"])) - { - $alias = $tempGroupData["alias"]; - $isDefault = $tempGroupData["isDefault"] === true ? "1" : "0"; - $inheritance = implode(",", $tempGroupData["inheritance"]); - $permissions = implode(",", $tempGroupData["permissions"]); - - $this->db->query("INSERT INTO groups - (groupName, alias, isDefault, inheritance, permissions) - VALUES - ('" . $this->db->escape_string($groupName) . "', '" . $this->db->escape_string($alias) . "', '" . $this->db->escape_string($isDefault) . "', '" . $this->db->escape_string($inheritance) . "', '" . $this->db->escape_string($permissions) . "') - ON DUPLICATE KEY UPDATE - alias = VALUES(alias), - isDefault = VALUES(isDefault), - inheritance = VALUES(inheritance), - permissions = VALUES(permissions);"); - - if(isset($tempGroupData["worlds"])) - { - foreach($tempGroupData["worlds"] as $worldName => $worldData) - { - $isDefault = $worldData["isDefault"] === true ? "1" : "0"; - $worldPerms = implode(",", $worldData["permissions"]); - - if(!is_array($worldPerms)) - { - $this->db->query("INSERT INTO groups_mw - (groupName, isDefault, worldName, permissions) - VALUES - ('" . $this->db->escape_string($groupName) . "', '" . $this->db->escape_string($isDefault) . "', '" . $this->db->escape_string($worldName) . "', '" . $this->db->escape_string($worldPerms) . "') - ON DUPLICATE KEY UPDATE - isDefault = VALUES(isDefault), - worldName = VALUES(worldName), - permissions = VALUES(permissions);"); - } - } - } - } - } - - public function close() - { - $this->db->close(); - } +plugin = $plugin; + + $mySQLSettings = $this->plugin->getConfigValue("mysql-settings"); + + if(!isset($mySQLSettings["host"]) || !isset($mySQLSettings["port"]) || !isset($mySQLSettings["user"]) || !isset($mySQLSettings["password"]) || !isset($mySQLSettings["db"])) + throw new RuntimeException("Failed to connect to the MySQL database: Invalid MySQL settings"); + + + $this->db = new \mysqli($mySQLSettings["host"], $mySQLSettings["user"], $mySQLSettings["password"], $mySQLSettings["db"], $mySQLSettings["port"]); + + if($this->db->connect_error) + throw new RuntimeException("Failed to connect to the MySQL database: " . $this->db->connect_error); + + $resource = $this->plugin->getResource("mysql_deploy_01.sql"); + + $this->db->multi_query(stream_get_contents($resource)); + + while($this->db->more_results()) + { + $this->db->next_result(); + } + + fclose($resource); + + $this->loadGroupsData(); + + $this->plugin->getScheduler()->scheduleRepeatingTask(new PPMySQLTask($this->plugin, $this->db), 1200); + } + + /** + * @param PPGroup $group + * @return array + */ + public function getGroupData(PPGroup $group) + { + $groupName = $group->getName(); + + if(!isset($this->getGroupsData()[$groupName]) || !is_array($this->getGroupsData()[$groupName])) return []; + + return $this->getGroupsData()[$groupName]; + } + + /** + * @return array + */ + public function getGroupsData() + { + return $this->groupsData; + } + + /** + * @param IPlayer $player + * @return array + */ + public function getPlayerData(IPlayer $player) + { + $userData = [ + "userName" => $player->getName(), + "group" => $this->plugin->getDefaultGroup()->getName(), + "permissions" => [] + ]; + + $result01 = $this->db->query("SELECT * FROM players WHERE userName = '" . $this->db->escape_string($player->getName()) . "';"); + + if($result01 instanceof \mysqli_result) + { + while($currentRow = $result01->fetch_assoc()) + { + $userData["group"] = $currentRow["userGroup"]; + $userData["permissions"] = explode(",", $currentRow["permissions"]); + } + + $result01->free(); + } + + $result02 = $this->db->query("SELECT * FROM players_mw WHERE userName = '" . $this->db->escape_string($player->getName()) . "';"); + + if($result02 instanceof \mysqli_result) + { + while($currentRow = $result02->fetch_assoc()) + { + $userGroup = $currentRow["userGroup"]; + $worldName = $currentRow["worldName"]; + $worldPerms = explode(",", $currentRow["permissions"]); + + $userData["worlds"][$worldName]["group"] = $userGroup; + + $userData["worlds"][$worldName]["permissions"] = $worldPerms; + } + + $result02->free(); + } + + return $userData; + } + + public function getUsers() + { + // TODO + } + + public function loadGroupsData() + { + $result01 = $this->db->query("SELECT * FROM groups;"); + + if($result01 instanceof \mysqli_result) + { + if($result01->num_rows <= 0) + { + $this->plugin->getLogger()->notice("No groups found in table 'groups', loading groups defined in default SQL script"); + + $resource = $this->plugin->getResource("mysql_deploy_02.sql"); + + $this->db->multi_query(stream_get_contents($resource)); + + while($this->db->more_results()) + { + $this->db->next_result(); + } + + fclose($resource); + + $result01 = $this->db->query("SELECT * FROM groups;"); + } + + while($currentRow = $result01->fetch_assoc()) + { + $groupName = $currentRow["groupName"]; + + $this->groupsData[$groupName]["alias"] = $currentRow["alias"]; + $this->groupsData[$groupName]["isDefault"] = $currentRow["isDefault"] === "1" ? true : false; + $this->groupsData[$groupName]["inheritance"] = $currentRow["inheritance"] !== "" ? explode(",", $currentRow["inheritance"]) : []; + $this->groupsData[$groupName]["permissions"] = explode(",", $currentRow["permissions"]); + } + + $result01->free(); + } + + $result02 = $this->db->query("SELECT * FROM groups_mw;"); + + if($result02 instanceof \mysqli_result) + { + while($currentRow = $result02->fetch_assoc()) + { + $isDefault = $currentRow["isDefault"] === "1" ? true : false; + $groupName = $currentRow["groupName"]; + $worldName = $currentRow["worldName"]; + $worldPerms = explode(",", $currentRow["permissions"]); + + $this->groupsData[$groupName]["worlds"][$worldName]["isDefault"] = $isDefault; + $this->groupsData[$groupName]["worlds"][$worldName]["permissions"] = $worldPerms; + } + + $result02->free(); + } + } + + /** + * @param $groupName + */ + public function removeGroupData($groupName) + { + $this->db->query(" + DELETE FROM groups + WHERE groupName = '" . $this->db->escape_string($groupName) . "';"); + + $this->db->query(" + DELETE OR IGNORE FROM groups_mw + WHERE groupName = '" . $this->db->escape_string($groupName) . "';"); + } + + + /** + * @param PPGroup $group + * @param array $tempGroupData + */ + public function setGroupData(PPGroup $group, array $tempGroupData) + { + $groupName = $group->getName(); + + $this->updateGroupData($groupName, $tempGroupData); + + $this->loadGroupsData(); + } + + /** + * @param array $tempGroupsData + */ + public function setGroupsData(array $tempGroupsData) + { + $tempGroupData01 = array_diff_key($this->groupsData, $tempGroupsData); + + $tempGroupName01 = key($tempGroupData01); + + if($tempGroupData01 !== []) $this->removeGroupData($tempGroupName01); + + foreach($tempGroupsData as $tempGroupName02 => $tempGroupData02) + { + $this->updateGroupData($tempGroupName02, $tempGroupData02); + } + + $this->loadGroupsData(); + } + + /** + * @param IPlayer $player + * @param array $tempUserData + */ + public function setPlayerData(IPlayer $player, array $tempUserData) + { + if(isset($tempUserData["group"]) and isset($tempUserData["permissions"])) + { + $userName = $player->getName(); + $userGroup = $tempUserData["group"]; + $permissions = implode(",", $tempUserData["permissions"]); + + $this->db->query("INSERT INTO players + (userName, userGroup, permissions) + VALUES + ('" . $this->db->escape_string($userName) . "', '" . $this->db->escape_string($userGroup) . "', '" . $this->db->escape_string($permissions) . "') + ON DUPLICATE KEY UPDATE + userGroup = VALUES(userGroup), + permissions = VALUES(permissions);"); + + if(isset($tempGroupData["worlds"])) + { + foreach($tempGroupData["worlds"] as $worldName => $worldData) + { + $worldGroup = $worldData["group"]; + $worldPerms = implode(",", $worldData["permissions"]); + + if(!is_array($worldPerms)) + { + $this->db->query("INSERT INTO players_mw + (userName, worldName, userGroup, permissions) + VALUES + ('" . $this->db->escape_string($userName) . "', '" . $this->db->escape_string($worldName) . "', '" . $this->db->escape_string($worldGroup) . "', '" . $this->db->escape_string($worldPerms) . "') + ON DUPLICATE KEY UPDATE + userGroup = VALUES(userGroup), + permissions = VALUES(permissions);"); + } + } + } + } + } + + /** + * @param $groupName + * @param array $tempGroupData + */ + public function updateGroupData($groupName, array $tempGroupData) + { + if(isset($tempGroupData["isDefault"]) and isset($tempGroupData["inheritance"]) and isset($tempGroupData["permissions"])) + { + $alias = $tempGroupData["alias"]; + $isDefault = $tempGroupData["isDefault"] === true ? "1" : "0"; + $inheritance = implode(",", $tempGroupData["inheritance"]); + $permissions = implode(",", $tempGroupData["permissions"]); + + $this->db->query("INSERT INTO groups + (groupName, alias, isDefault, inheritance, permissions) + VALUES + ('" . $this->db->escape_string($groupName) . "', '" . $this->db->escape_string($alias) . "', '" . $this->db->escape_string($isDefault) . "', '" . $this->db->escape_string($inheritance) . "', '" . $this->db->escape_string($permissions) . "') + ON DUPLICATE KEY UPDATE + alias = VALUES(alias), + isDefault = VALUES(isDefault), + inheritance = VALUES(inheritance), + permissions = VALUES(permissions);"); + + if(isset($tempGroupData["worlds"])) + { + foreach($tempGroupData["worlds"] as $worldName => $worldData) + { + $isDefault = $worldData["isDefault"] === true ? "1" : "0"; + $worldPerms = implode(",", $worldData["permissions"]); + + if(!is_array($worldPerms)) + { + $this->db->query("INSERT INTO groups_mw + (groupName, isDefault, worldName, permissions) + VALUES + ('" . $this->db->escape_string($groupName) . "', '" . $this->db->escape_string($isDefault) . "', '" . $this->db->escape_string($worldName) . "', '" . $this->db->escape_string($worldPerms) . "') + ON DUPLICATE KEY UPDATE + isDefault = VALUES(isDefault), + worldName = VALUES(worldName), + permissions = VALUES(permissions);"); + } + } + } + } + } + + public function close() + { + $this->db->close(); + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/provider/ProviderInterface.php b/src/_64FF00/PurePerms/DataProviders/ProviderInterface.php similarity index 94% rename from src/_64FF00/PurePerms/provider/ProviderInterface.php rename to src/_64FF00/PurePerms/DataProviders/ProviderInterface.php index 44aab334..d4f68532 100644 --- a/src/_64FF00/PurePerms/provider/ProviderInterface.php +++ b/src/_64FF00/PurePerms/DataProviders/ProviderInterface.php @@ -1,39 +1,39 @@ -plugin = $plugin; - - $this->db = new \SQLite3($plugin->getDataFolder()."pureperms.db"); - - $this->db->exec(""); - - $this->loadGroupsData(); - } - - public function loadGroupsData() - { - // - } +plugin = $plugin; + + $this->db = new \SQLite3($plugin->getDataFolder()."pureperms.db"); + + $this->db->exec(""); + + $this->loadGroupsData(); + } + + public function loadGroupsData() + { + // + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/provider/YamlV1Provider.php b/src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php similarity index 95% rename from src/_64FF00/PurePerms/provider/YamlV1Provider.php rename to src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php index be5bc471..82a84e3a 100644 --- a/src/_64FF00/PurePerms/provider/YamlV1Provider.php +++ b/src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php @@ -1,176 +1,176 @@ -plugin = $plugin; - - $this->plugin->saveResource("groups.yml"); - - $this->groups = new Config($this->plugin->getDataFolder() . "groups.yml", Config::YAML, []); - - $this->userDataFolder = $this->plugin->getDataFolder() . "players/"; - - if(!file_exists($this->userDataFolder)) - @mkdir($this->userDataFolder, 0777, true); - } - /** - * @param PPGroup $group - * @return mixed - */ - public function getGroupData(PPGroup $group) - { - $groupName = $group->getName(); - - if(!isset($this->getGroupsData()[$groupName]) || !is_array($this->getGroupsData()[$groupName])) - return []; - - return $this->getGroupsData()[$groupName]; - } - - /** - * @return Config - */ - public function getGroupsConfig() - { - return $this->groups; - } - /** - * @return mixed - */ - public function getGroupsData() - { - return $this->groups->getAll(); - } - /** - * @param IPlayer $player - * @param bool $onUpdate - * @return array|Config - */ - public function getPlayerConfig(IPlayer $player, $onUpdate = false) - { - $userName = $player->getName(); - - // TODO - if($onUpdate === true) - { - if(!file_exists($this->userDataFolder . strtolower($userName) . ".yml")) - { - return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ - "userName" => $userName, - "group" => $this->plugin->getDefaultGroup()->getName(), - "permissions" => [], - "worlds" => [], - "time" => -1 - ]); - } - else - { - return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ - ]); - } - } - else - { - if(file_exists($this->userDataFolder . strtolower($userName) . ".yml")) - { - return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ - ]); - } - else - { - return [ - "userName" => $userName, - "group" => $this->plugin->getDefaultGroup()->getName(), - "permissions" => [], - "worlds" => [], - "time" => -1 - ]; - } - } - } - /** - * @param IPlayer $player - * @return array|Config - */ - public function getPlayerData(IPlayer $player) - { - $userConfig = $this->getPlayerConfig($player); - - return (($userConfig instanceof Config) ? $userConfig->getAll() : $userConfig); - } - - public function getUsers() - { - // TODO: Implement getUsers() method. - } - - /** - * @param PPGroup $group - * @param array $tempGroupData - */ - public function setGroupData(PPGroup $group, array $tempGroupData) - { - $groupName = $group->getName(); - $this->groups->set($groupName, $tempGroupData); - $this->groups->save(); - } - /** - * @param array $tempGroupsData - */ - public function setGroupsData(array $tempGroupsData) - { - $this->groups->setAll($tempGroupsData); - $this->groups->save(); - } - /** - * @param IPlayer $player - * @param array $tempUserData - */ - public function setPlayerData(IPlayer $player, array $tempUserData) - { - $userData = $this->getPlayerConfig($player, true); - - if(!$userData instanceof Config) - throw new RuntimeException("Failed to update player data: Invalid data type (" . get_class($userData) . ")"); - - $userData->setAll($tempUserData); - - $userData->save(); - } - - public function close() - { - } +plugin = $plugin; + + $this->plugin->saveResource("groups.yml"); + + $this->groups = new Config($this->plugin->getDataFolder() . "groups.yml", Config::YAML, []); + + $this->userDataFolder = $this->plugin->getDataFolder() . "players/"; + + if(!file_exists($this->userDataFolder)) + @mkdir($this->userDataFolder, 0777, true); + } + /** + * @param PPGroup $group + * @return mixed + */ + public function getGroupData(PPGroup $group) + { + $groupName = $group->getName(); + + if(!isset($this->getGroupsData()[$groupName]) || !is_array($this->getGroupsData()[$groupName])) + return []; + + return $this->getGroupsData()[$groupName]; + } + + /** + * @return Config + */ + public function getGroupsConfig() + { + return $this->groups; + } + /** + * @return mixed + */ + public function getGroupsData() + { + return $this->groups->getAll(); + } + /** + * @param IPlayer $player + * @param bool $onUpdate + * @return array|Config + */ + public function getPlayerConfig(IPlayer $player, $onUpdate = false) + { + $userName = $player->getName(); + + // TODO + if($onUpdate === true) + { + if(!file_exists($this->userDataFolder . strtolower($userName) . ".yml")) + { + return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ + "userName" => $userName, + "group" => $this->plugin->getDefaultGroup()->getName(), + "permissions" => [], + "worlds" => [], + "time" => -1 + ]); + } + else + { + return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ + ]); + } + } + else + { + if(file_exists($this->userDataFolder . strtolower($userName) . ".yml")) + { + return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ + ]); + } + else + { + return [ + "userName" => $userName, + "group" => $this->plugin->getDefaultGroup()->getName(), + "permissions" => [], + "worlds" => [], + "time" => -1 + ]; + } + } + } + /** + * @param IPlayer $player + * @return array|Config + */ + public function getPlayerData(IPlayer $player) + { + $userConfig = $this->getPlayerConfig($player); + + return (($userConfig instanceof Config) ? $userConfig->getAll() : $userConfig); + } + + public function getUsers() + { + // TODO: Implement getUsers() method. + } + + /** + * @param PPGroup $group + * @param array $tempGroupData + */ + public function setGroupData(PPGroup $group, array $tempGroupData) + { + $groupName = $group->getName(); + $this->groups->set($groupName, $tempGroupData); + $this->groups->save(); + } + /** + * @param array $tempGroupsData + */ + public function setGroupsData(array $tempGroupsData) + { + $this->groups->setAll($tempGroupsData); + $this->groups->save(); + } + /** + * @param IPlayer $player + * @param array $tempUserData + */ + public function setPlayerData(IPlayer $player, array $tempUserData) + { + $userData = $this->getPlayerConfig($player, true); + + if(!$userData instanceof Config) + throw new RuntimeException("Failed to update player data: Invalid data type (" . get_class($userData) . ")"); + + $userData->setAll($tempUserData); + + $userData->save(); + } + + public function close() + { + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/event/PPGroupChangedEvent.php b/src/_64FF00/PurePerms/EventManager/PPGroupChangedEvent.php similarity index 94% rename from src/_64FF00/PurePerms/event/PPGroupChangedEvent.php rename to src/_64FF00/PurePerms/EventManager/PPGroupChangedEvent.php index eecd138b..4d89ff17 100644 --- a/src/_64FF00/PurePerms/event/PPGroupChangedEvent.php +++ b/src/_64FF00/PurePerms/EventManager/PPGroupChangedEvent.php @@ -1,76 +1,76 @@ -group = $group; - $this->player = $player; - $this->worldName = $worldName; - } - - /** - * @return PPGroup - */ - public function getGroup() - { - return $this->group; - } - - /** - * @return World - */ - public function getLevel() - { - return $this->getPlugin()->getServer()->getWorldManager()->getWorldByName($this->worldName); - } - - /** - * @return string - */ - public function getWorldName(): ?string - { - return $this->worldName; - } - - /** - * @return IPlayer - */ - public function getPlayer() - { - return $this->player; - } +group = $group; + $this->player = $player; + $this->worldName = $worldName; + } + + /** + * @return PPGroup + */ + public function getGroup() + { + return $this->group; + } + + /** + * @return World + */ + public function getLevel() + { + return $this->getPlugin()->getServer()->getWorldManager()->getWorldByName($this->worldName); + } + + /** + * @return string + */ + public function getWorldName(): ?string + { + return $this->worldName; + } + + /** + * @return IPlayer + */ + public function getPlayer() + { + return $this->player; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/event/PPRankExpiredEvent.php b/src/_64FF00/PurePerms/EventManager/PPRankExpiredEvent.php similarity index 94% rename from src/_64FF00/PurePerms/event/PPRankExpiredEvent.php rename to src/_64FF00/PurePerms/EventManager/PPRankExpiredEvent.php index 0f106505..3bcd94cf 100644 --- a/src/_64FF00/PurePerms/event/PPRankExpiredEvent.php +++ b/src/_64FF00/PurePerms/EventManager/PPRankExpiredEvent.php @@ -1,66 +1,66 @@ -player = $player; - $this->worldName = $worldName; - } - - /** - * @return World - */ - public function getWorld() - { - return $this->getPlugin()->getServer()->getLevelByName($this->worldName); - } - - /** - * @return string - */ - public function getLevelName() - { - return $this->worldName; - } - - /** - * @return IPlayer - */ - public function getPlayer() - { - return $this->player; - } +player = $player; + $this->worldName = $worldName; + } + + /** + * @return World + */ + public function getWorld() + { + return $this->getPlugin()->getServer()->getLevelByName($this->worldName); + } + + /** + * @return string + */ + public function getLevelName() + { + return $this->worldName; + } + + /** + * @return IPlayer + */ + public function getPlayer() + { + return $this->player; + } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/PPListener.php b/src/_64FF00/PurePerms/PPListener.php index 428840f0..5f8420fd 100644 --- a/src/_64FF00/PurePerms/PPListener.php +++ b/src/_64FF00/PurePerms/PPListener.php @@ -2,8 +2,8 @@ namespace _64FF00\PurePerms; -use _64FF00\PurePerms\event\PPGroupChangedEvent; -use _64FF00\PurePerms\event\PPRankExpiredEvent; +use _64FF00\PurePerms\EventManager\PPGroupChangedEvent; +use _64FF00\PurePerms\EventManager\PPRankExpiredEvent; use pocketmine\event\Listener; use pocketmine\event\entity\EntityTeleportEvent; use pocketmine\event\player\PlayerCommandPreprocessEvent; diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 92f799c9..284d4091 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -2,44 +2,39 @@ namespace _64FF00\PurePerms; -use _64FF00\PurePerms\cmd\AddGroup; -use _64FF00\PurePerms\cmd\AddParent; -use _64FF00\PurePerms\cmd\DefGroup; -use _64FF00\PurePerms\cmd\FPerms; -use _64FF00\PurePerms\cmd\Groups; -use _64FF00\PurePerms\cmd\GrpInfo; -use _64FF00\PurePerms\cmd\ListGPerms; -use _64FF00\PurePerms\cmd\ListUPerms; -use _64FF00\PurePerms\cmd\PPInfo; -use _64FF00\PurePerms\cmd\PPReload; -use _64FF00\PurePerms\cmd\PPSudo; -use _64FF00\PurePerms\cmd\RmGroup; -use _64FF00\PurePerms\cmd\RmParent; -use _64FF00\PurePerms\cmd\SetGPerm; -use _64FF00\PurePerms\cmd\SetGroup; -use _64FF00\PurePerms\cmd\SetUPerm; -use _64FF00\PurePerms\cmd\UnsetGPerm; -use _64FF00\PurePerms\cmd\UnsetUPerm; -use _64FF00\PurePerms\cmd\UsrInfo; -use _64FF00\PurePerms\data\UserDataManager; -use _64FF00\PurePerms\noeul\NoeulAPI; -use _64FF00\PurePerms\provider\DefaultProvider; -use _64FF00\PurePerms\provider\MySQLProvider; -use _64FF00\PurePerms\provider\ProviderInterface; -use _64FF00\PurePerms\provider\YamlV1Provider; -use _64FF00\PurePerms\task\PPExpDateCheckTask; +use _64FF00\PurePerms\Commands\AddGroup; +use _64FF00\PurePerms\Commands\AddParent; +use _64FF00\PurePerms\Commands\DefGroup; +use _64FF00\PurePerms\Commands\FPerms; +use _64FF00\PurePerms\Commands\Groups; +use _64FF00\PurePerms\Commands\GrpInfo; +use _64FF00\PurePerms\Commands\ListGPerms; +use _64FF00\PurePerms\Commands\ListUPerms; +use _64FF00\PurePerms\Commands\PPInfo; +use _64FF00\PurePerms\Commands\PPReload; +use _64FF00\PurePerms\Commands\PPSudo; +use _64FF00\PurePerms\Commands\RmGroup; +use _64FF00\PurePerms\Commands\RmParent; +use _64FF00\PurePerms\Commands\SetGPerm; +use _64FF00\PurePerms\Commands\SetGroup; +use _64FF00\PurePerms\Commands\SetUPerm; +use _64FF00\PurePerms\Commands\UnsetGPerm; +use _64FF00\PurePerms\Commands\UnsetUPerm; +use _64FF00\PurePerms\Commands\UsrInfo; +use _64FF00\PurePerms\DataManager\UserDataManager; +use _64FF00\PurePerms\Noeul\NoeulAPI; +use _64FF00\PurePerms\DataProviders\DefaultProvider; +use _64FF00\PurePerms\DataProviders\MySQLProvider; +use _64FF00\PurePerms\DataProviders\ProviderInterface; +use _64FF00\PurePerms\DataProviders\YamlV1Provider; +use _64FF00\PurePerms\Task\PPExpDateCheckTask; use pocketmine\permission\PermissionManager; use pocketmine\player\IPlayer; - use pocketmine\world\World; - use pocketmine\permission\DefaultPermissions; - use pocketmine\player\Player; - use pocketmine\plugin\PluginBase; - use Ramsey\Uuid\Uuid; use RuntimeException; From c2c81f5bf84fafbad53291fd0cd6bc31d5a59095 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 05:36:43 -0800 Subject: [PATCH 02/46] Changed directories. (part 1) --- src/_64FF00/PurePerms/noeul/NoeulAPI.php | 2 +- src/_64FF00/PurePerms/task/PPExpDateCheckTask.php | 4 ++-- src/_64FF00/PurePerms/task/PPMySQLTask.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/_64FF00/PurePerms/noeul/NoeulAPI.php b/src/_64FF00/PurePerms/noeul/NoeulAPI.php index ae39ec1f..54ef511d 100644 --- a/src/_64FF00/PurePerms/noeul/NoeulAPI.php +++ b/src/_64FF00/PurePerms/noeul/NoeulAPI.php @@ -1,6 +1,6 @@ Date: Sun, 21 Nov 2021 05:38:04 -0800 Subject: [PATCH 03/46] Delete src/_64FF00/PurePerms/noeul directory --- src/_64FF00/PurePerms/noeul/NoeulAPI.php | 197 ----------------------- 1 file changed, 197 deletions(-) delete mode 100644 src/_64FF00/PurePerms/noeul/NoeulAPI.php diff --git a/src/_64FF00/PurePerms/noeul/NoeulAPI.php b/src/_64FF00/PurePerms/noeul/NoeulAPI.php deleted file mode 100644 index 54ef511d..00000000 --- a/src/_64FF00/PurePerms/noeul/NoeulAPI.php +++ /dev/null @@ -1,197 +0,0 @@ -plugin = $plugin; - } - - /** - * @param Player $player - * @return bool - */ - public function auth(Player $player) - { - // TODO - - if($this->isAuthed($player)) - return true; - - if(isset($this->needAuth[spl_object_hash($player)])) - { - $attachment = $this->needAuth[spl_object_hash($player)]; - - $player->removeAttachment($attachment); - - unset($this->needAuth[spl_object_hash($player)]); - } - - $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.successfully_logged_in")); - - return true; - } - - /** - * @param Player $player - * @return bool - */ - public function deAuth(Player $player) - { - $attachment = $player->addAttachment($this->plugin); - - $this->removePermissions($attachment); - - $this->needAuth[spl_object_hash($player)] = $attachment; - - $this->sendAuthMsg($player); - - return true; - } - - /** - * @param $password - * @return bool|string - */ - public function hash($password) - { - return password_hash($password, PASSWORD_BCRYPT); - } - - /** - * @param $password - * @param $hash - * @return bool - */ - public function hashEquals($password, $hash) - { - return password_verify($password, $hash); - } - - /** - * @param Player $player - * @return bool - */ - public function isAuthed(Player $player) - { - return !isset($this->needAuth[spl_object_hash($player)]); - } - - /** - * @return bool - */ - public function isNoeulEnabled() - { - return $this->plugin->getConfigValue("enable-noeul-sixtyfour"); - } - - /** - * @return bool - */ - public function isRegistered($player) - { - return !($this->plugin->getUserDataMgr()->getNode($player, 'noeulPW') === null); - } - - /** - * @param IPlayer $player - * @param $password - * @return bool - */ - public function register(IPlayer $player, $password) - { - if(!$this->isRegistered($player)) - { - $hash = $this->hash($password); - - $this->plugin->getUserDataMgr()->setNode($player, 'noeulPW', $hash); - - return true; - } - - return false; - } - - /** - * @param PermissionAttachment $attachment - */ - private function removePermissions(PermissionAttachment $attachment) - { - $permissions = []; - - foreach(PermissionManager::getInstance()->getPermissions() as $permission) - { - $permissions[$permission->getName()] = false; - } - - $permissions["pocketmine.command.help"] = true; - $permissions["pperms.noeul.ppsudo"] = true; - - ksort($permissions); - - $attachment->setPermissions($permissions); - } - - /** - * @param Player $player - */ - public function sendAuthMsg(Player $player) - { - $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_01", self::NOEUL_VERSION)); - $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_02")); - - $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_03")); - } - - /** - * @param IPlayer $player - * @return bool - */ - public function unregister(IPlayer $player) - { - if($this->isRegistered($player)) - { - $this->plugin->getUserDataMgr()->removeNode($player, 'noeulPW'); - - return true; - } - - return false; - } -} \ No newline at end of file From 6900b2c58b4771eeac8a341524a3bfab4c8376e2 Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Sun, 21 Nov 2021 05:38:13 -0800 Subject: [PATCH 04/46] Delete src/_64FF00/PurePerms/task directory --- .../PurePerms/task/PPExpDateCheckTask.php | 49 ------------------- src/_64FF00/PurePerms/task/PPMySQLTask.php | 49 ------------------- 2 files changed, 98 deletions(-) delete mode 100644 src/_64FF00/PurePerms/task/PPExpDateCheckTask.php delete mode 100644 src/_64FF00/PurePerms/task/PPMySQLTask.php diff --git a/src/_64FF00/PurePerms/task/PPExpDateCheckTask.php b/src/_64FF00/PurePerms/task/PPExpDateCheckTask.php deleted file mode 100644 index 9fe12b13..00000000 --- a/src/_64FF00/PurePerms/task/PPExpDateCheckTask.php +++ /dev/null @@ -1,49 +0,0 @@ -plugin = $plugin; - } - - public function onRun():void - { - foreach($this->plugin->getServer()->getOnlinePlayers() as $player) - { - if(time() === $this->plugin->getUserDataMgr()->getNode($player, "expTime")) - { - $levelName = $this->plugin->getConfigValue("enable-multiworld-perms") ? $player->getWorld()->getDisplayName() : null; - - $event = new PPRankExpiredEvent($this->plugin, $player, $levelName); - - $event->call(); - } - } - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/task/PPMySQLTask.php b/src/_64FF00/PurePerms/task/PPMySQLTask.php deleted file mode 100644 index 47290eab..00000000 --- a/src/_64FF00/PurePerms/task/PPMySQLTask.php +++ /dev/null @@ -1,49 +0,0 @@ -plugin = $plugin; - $this->db = $db; - } - - public function onRun(): void - { - if($this->db->ping()) - { - $this->plugin->getLogger()->debug("Connected to MySQLi Server"); - } - else - { - $this->plugin->getLogger()->debug("[MySQL] Warning: " . $this->db->error); - } - } -} \ No newline at end of file From db12b81248b0b9d378d72e28b5488527983cec27 Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Sun, 21 Nov 2021 08:38:36 -0500 Subject: [PATCH 05/46] Changed directories (part 2) --- src/_64FF00/PurePerms/Noeul/NoeulAPI.php | 197 ++++++++++++++++++ .../PurePerms/Task/PPExpDateCheckTask.php | 49 +++++ src/_64FF00/PurePerms/Task/PPMySQLTask.php | 49 +++++ 3 files changed, 295 insertions(+) create mode 100644 src/_64FF00/PurePerms/Noeul/NoeulAPI.php create mode 100644 src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php create mode 100644 src/_64FF00/PurePerms/Task/PPMySQLTask.php diff --git a/src/_64FF00/PurePerms/Noeul/NoeulAPI.php b/src/_64FF00/PurePerms/Noeul/NoeulAPI.php new file mode 100644 index 00000000..54ef511d --- /dev/null +++ b/src/_64FF00/PurePerms/Noeul/NoeulAPI.php @@ -0,0 +1,197 @@ +plugin = $plugin; + } + + /** + * @param Player $player + * @return bool + */ + public function auth(Player $player) + { + // TODO + + if($this->isAuthed($player)) + return true; + + if(isset($this->needAuth[spl_object_hash($player)])) + { + $attachment = $this->needAuth[spl_object_hash($player)]; + + $player->removeAttachment($attachment); + + unset($this->needAuth[spl_object_hash($player)]); + } + + $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.successfully_logged_in")); + + return true; + } + + /** + * @param Player $player + * @return bool + */ + public function deAuth(Player $player) + { + $attachment = $player->addAttachment($this->plugin); + + $this->removePermissions($attachment); + + $this->needAuth[spl_object_hash($player)] = $attachment; + + $this->sendAuthMsg($player); + + return true; + } + + /** + * @param $password + * @return bool|string + */ + public function hash($password) + { + return password_hash($password, PASSWORD_BCRYPT); + } + + /** + * @param $password + * @param $hash + * @return bool + */ + public function hashEquals($password, $hash) + { + return password_verify($password, $hash); + } + + /** + * @param Player $player + * @return bool + */ + public function isAuthed(Player $player) + { + return !isset($this->needAuth[spl_object_hash($player)]); + } + + /** + * @return bool + */ + public function isNoeulEnabled() + { + return $this->plugin->getConfigValue("enable-noeul-sixtyfour"); + } + + /** + * @return bool + */ + public function isRegistered($player) + { + return !($this->plugin->getUserDataMgr()->getNode($player, 'noeulPW') === null); + } + + /** + * @param IPlayer $player + * @param $password + * @return bool + */ + public function register(IPlayer $player, $password) + { + if(!$this->isRegistered($player)) + { + $hash = $this->hash($password); + + $this->plugin->getUserDataMgr()->setNode($player, 'noeulPW', $hash); + + return true; + } + + return false; + } + + /** + * @param PermissionAttachment $attachment + */ + private function removePermissions(PermissionAttachment $attachment) + { + $permissions = []; + + foreach(PermissionManager::getInstance()->getPermissions() as $permission) + { + $permissions[$permission->getName()] = false; + } + + $permissions["pocketmine.command.help"] = true; + $permissions["pperms.noeul.ppsudo"] = true; + + ksort($permissions); + + $attachment->setPermissions($permissions); + } + + /** + * @param Player $player + */ + public function sendAuthMsg(Player $player) + { + $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_01", self::NOEUL_VERSION)); + $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_02")); + + $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_03")); + } + + /** + * @param IPlayer $player + * @return bool + */ + public function unregister(IPlayer $player) + { + if($this->isRegistered($player)) + { + $this->plugin->getUserDataMgr()->removeNode($player, 'noeulPW'); + + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php b/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php new file mode 100644 index 00000000..9fe12b13 --- /dev/null +++ b/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php @@ -0,0 +1,49 @@ +plugin = $plugin; + } + + public function onRun():void + { + foreach($this->plugin->getServer()->getOnlinePlayers() as $player) + { + if(time() === $this->plugin->getUserDataMgr()->getNode($player, "expTime")) + { + $levelName = $this->plugin->getConfigValue("enable-multiworld-perms") ? $player->getWorld()->getDisplayName() : null; + + $event = new PPRankExpiredEvent($this->plugin, $player, $levelName); + + $event->call(); + } + } + } +} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Task/PPMySQLTask.php b/src/_64FF00/PurePerms/Task/PPMySQLTask.php new file mode 100644 index 00000000..47290eab --- /dev/null +++ b/src/_64FF00/PurePerms/Task/PPMySQLTask.php @@ -0,0 +1,49 @@ +plugin = $plugin; + $this->db = $db; + } + + public function onRun(): void + { + if($this->db->ping()) + { + $this->plugin->getLogger()->debug("Connected to MySQLi Server"); + } + else + { + $this->plugin->getLogger()->debug("[MySQL] Warning: " . $this->db->error); + } + } +} \ No newline at end of file From 3e4f4718eb74aef9ffb47f81c68f40fa586d6d7c Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 07:29:14 -0800 Subject: [PATCH 06/46] Removed pointless extra lines --- src/_64FF00/PurePerms/Commands/AddGroup.php | 5 -- src/_64FF00/PurePerms/Commands/AddParent.php | 5 -- src/_64FF00/PurePerms/Commands/DefGroup.php | 11 --- src/_64FF00/PurePerms/Commands/FPerms.php | 15 +--- src/_64FF00/PurePerms/Commands/Groups.php | 5 -- src/_64FF00/PurePerms/Commands/GrpInfo.php | 17 ---- src/_64FF00/PurePerms/Commands/ListGPerms.php | 19 +---- src/_64FF00/PurePerms/Commands/ListUPerms.php | 17 +--- src/_64FF00/PurePerms/Commands/PPInfo.php | 4 - src/_64FF00/PurePerms/Commands/PPReload.php | 5 -- src/_64FF00/PurePerms/Commands/PPSudo.php | 20 ----- src/_64FF00/PurePerms/Commands/RmGroup.php | 5 -- src/_64FF00/PurePerms/Commands/RmParent.php | 7 -- src/_64FF00/PurePerms/Commands/SetGPerm.php | 11 --- src/_64FF00/PurePerms/Commands/SetGroup.php | 14 --- src/_64FF00/PurePerms/Commands/SetUPerm.php | 11 --- src/_64FF00/PurePerms/Commands/UnsetGPerm.php | 10 --- src/_64FF00/PurePerms/Commands/UnsetUPerm.php | 11 --- src/_64FF00/PurePerms/Commands/UsrInfo.php | 13 --- .../PurePerms/DataManager/UserDataManager.php | 32 ------- .../DataProviders/DefaultProvider.php | 13 --- .../PurePerms/DataProviders/MySQLProvider.php | 34 -------- .../DataProviders/ProviderInterface.php | 7 -- .../DataProviders/SQLite3Provider.php | 4 - .../DataProviders/YamlV1Provider.php | 4 - .../EventManager/PPGroupChangedEvent.php | 1 - src/_64FF00/PurePerms/PPGroup.php | 51 ----------- src/_64FF00/PurePerms/PPListener.php | 10 --- src/_64FF00/PurePerms/PPMessages.php | 18 ---- src/_64FF00/PurePerms/PurePerms.php | 85 ------------------- 30 files changed, 3 insertions(+), 461 deletions(-) diff --git a/src/_64FF00/PurePerms/Commands/AddGroup.php b/src/_64FF00/PurePerms/Commands/AddGroup.php index bdbe5657..3ed1a8b1 100644 --- a/src/_64FF00/PurePerms/Commands/AddGroup.php +++ b/src/_64FF00/PurePerms/Commands/AddGroup.php @@ -37,9 +37,7 @@ class AddGroup extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.addgroup"); } @@ -53,16 +51,13 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(!isset($args[0]) || count($args) > 1) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.usage")); - return true; } $result = $this->plugin->addGroup($args[0]); - if($result === PurePerms::SUCCESS) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.group_added_successfully", $args[0])); diff --git a/src/_64FF00/PurePerms/Commands/AddParent.php b/src/_64FF00/PurePerms/Commands/AddParent.php index 46442151..a5e6f171 100644 --- a/src/_64FF00/PurePerms/Commands/AddParent.php +++ b/src/_64FF00/PurePerms/Commands/AddParent.php @@ -37,9 +37,7 @@ class AddParent extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.addparent"); } @@ -53,7 +51,6 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(count($args) < 2 || count($args) > 3) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.usage")); @@ -62,9 +59,7 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $target_group = $this->plugin->getGroup($args[0]); - $parent_group = $this->plugin->getGroup($args[1]); - if($target_group->addParent($parent_group)) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.messages.addparent_successfully", $parent_group->getName(), $target_group->getName())); diff --git a/src/_64FF00/PurePerms/Commands/DefGroup.php b/src/_64FF00/PurePerms/Commands/DefGroup.php index ca226197..962967e8 100644 --- a/src/_64FF00/PurePerms/Commands/DefGroup.php +++ b/src/_64FF00/PurePerms/Commands/DefGroup.php @@ -37,9 +37,7 @@ class DefGroup extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.defgroup"); } @@ -57,37 +55,28 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(!isset($args[0]) || count($args) > 2) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.usage")); - return true; } $group = $this->plugin->getGroup($args[0]); - if($group === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.group_not_exist", $args[0])); - return true; } - $levelName = null; - if(isset($args[1])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); - if($level === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.level_not_exist", $args[1])); - return true; } $levelName = $level->getDisplayName(); } - $this->plugin->setDefaultGroup($group, $levelName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.defgroup_successfully", $args[0])); return true; diff --git a/src/_64FF00/PurePerms/Commands/FPerms.php b/src/_64FF00/PurePerms/Commands/FPerms.php index 282b851e..4f06ed04 100644 --- a/src/_64FF00/PurePerms/Commands/FPerms.php +++ b/src/_64FF00/PurePerms/Commands/FPerms.php @@ -39,9 +39,7 @@ class FPerms extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.fperms"); } @@ -55,38 +53,29 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(!isset($args[0]) || count($args) > 2) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.usage")); - return true; } $plugin = (strtolower($args[0]) === 'pocketmine' || strtolower($args[0]) === 'pmmp') ? 'pocketmine' : $this->plugin->getServer()->getPluginManager()->getPlugin($args[0]); - if($plugin === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.plugin_not_exist", $args[0])); - return true; } $permissions = ($plugin instanceof PluginBase) ? $plugin->getDescription()->getPermissions() : $this->plugin->getPocketMinePerms(); - if(empty($permissions)) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.no_plugin_perms", $plugin->getName())); - return true; } $pageHeight = $sender instanceof ConsoleCommandSender ? 48 : 6; - - $chunkedPermissions = array_chunk($permissions, $pageHeight); - + $chunkedPermissions = array_chunk($permissions, $pageHeight); $maxPageNumber = count($chunkedPermissions); - if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) { $pageNumber = 1; @@ -101,12 +90,10 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.plugin_perms_list", ($plugin instanceof PluginBase) ? $plugin->getName(): 'PocketMine-MP', $pageNumber, $maxPageNumber)); - foreach($chunkedPermissions[$pageNumber - 1] as $permission) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission->getName()); } - return true; } diff --git a/src/_64FF00/PurePerms/Commands/Groups.php b/src/_64FF00/PurePerms/Commands/Groups.php index ebe7aa38..638c9749 100644 --- a/src/_64FF00/PurePerms/Commands/Groups.php +++ b/src/_64FF00/PurePerms/Commands/Groups.php @@ -37,9 +37,7 @@ class Groups extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.groups"); } @@ -55,14 +53,11 @@ public function execute(CommandSender $sender, string $label, array $args) : boo return false; $result = []; - foreach($this->plugin->getGroups() as $group) { $result[] = $group->getName(); } - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.groups.messages.all_registered_groups", implode(", ", $result))); - return true; } diff --git a/src/_64FF00/PurePerms/Commands/GrpInfo.php b/src/_64FF00/PurePerms/Commands/GrpInfo.php index 27a3907d..59aa0f5d 100644 --- a/src/_64FF00/PurePerms/Commands/GrpInfo.php +++ b/src/_64FF00/PurePerms/Commands/GrpInfo.php @@ -38,9 +38,7 @@ class GrpInfo extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.grpinfo"); } @@ -54,47 +52,35 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(count($args) < 1 || count($args) > 2) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.usage")); - return true; } $group = $this->plugin->getGroup($args[0]); - if($group === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.group_not_exist", $args[0])); - return true; } - $levelName = null; if(isset($args[1])) { $level = $this->plugin->getServer()->getLevelByName($args[1]); - if($level === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.level_not_exist", $args[1])); - return true; } - $levelName = $level->getName(); } - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_header", $group->getName())); - $alias = TextFormat::DARK_GREEN . $group->getAlias(); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_alias", $alias)); - $isDefault = $group->isDefault($levelName) ? TextFormat::DARK_GREEN . "YES" : TextFormat::RED . "NO"; $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_default", $isDefault)); - $result = TextFormat::DARK_GREEN . "..."; /** @var PPGroup $tempGroup */ @@ -102,12 +88,9 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { $parents[] = $tempGroup->getName(); } - if(!empty($group->getParentGroups())) $result = TextFormat::DARK_GREEN . implode(",", $parents); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_parents", $result)); - return true; } diff --git a/src/_64FF00/PurePerms/Commands/ListGPerms.php b/src/_64FF00/PurePerms/Commands/ListGPerms.php index 70bd12da..d644fbb8 100644 --- a/src/_64FF00/PurePerms/Commands/ListGPerms.php +++ b/src/_64FF00/PurePerms/Commands/ListGPerms.php @@ -38,9 +38,7 @@ class ListGPerms extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.listgperms"); } @@ -54,36 +52,28 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(count($args) < 1 || count($args) > 3) { $sender->sendMessage(TextFormat::BLUE . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.usage")); - return true; } $group = $this->plugin->getGroup($args[0]); - if($group == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_not_exist", $args[0])); - return true; } $levelName = null; - if(isset($args[2])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - return true; } - $levelName = $level->getDisplayName(); } @@ -92,16 +82,11 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(empty($permissions)) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.no_group_perms", $group->getName())); - return true; } - $pageHeight = $sender instanceof ConsoleCommandSender ? 24 : 6; - - $chunkedPermissions = array_chunk($permissions, $pageHeight); - + $chunkedPermissions = array_chunk($permissions, $pageHeight); $maxPageNumber = count($chunkedPermissions); - if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) { $pageNumber = 1; @@ -116,12 +101,10 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_perms_list", $group->getName(), $pageNumber, $maxPageNumber)); - foreach($chunkedPermissions[$pageNumber - 1] as $permission) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission); } - return true; } diff --git a/src/_64FF00/PurePerms/Commands/ListUPerms.php b/src/_64FF00/PurePerms/Commands/ListUPerms.php index 854a09cd..4ee03f18 100644 --- a/src/_64FF00/PurePerms/Commands/ListUPerms.php +++ b/src/_64FF00/PurePerms/Commands/ListUPerms.php @@ -38,9 +38,7 @@ class ListUPerms extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.listuperms"); } @@ -54,26 +52,20 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(count($args) < 1 || count($args) > 3) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.usage")); - return true; } $player = $this->plugin->getPlayer($args[0]); - $levelName = null; - if(isset($args[2])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - return true; } @@ -81,20 +73,14 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $permissions = $this->plugin->getUserDataMgr()->getUserPermissions($player, $levelName); - if(empty($permissions)) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.no_user_perms", $player->getName())); - return true; } - $pageHeight = $sender instanceof ConsoleCommandSender ? 24 : 6; - - $chunkedPermissions = array_chunk($permissions, $pageHeight); - + $chunkedPermissions = array_chunk($permissions, $pageHeight); $maxPageNumber = count($chunkedPermissions); - if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) { $pageNumber = 1; @@ -109,7 +95,6 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.user_perms_list", $player->getName(), $pageNumber, $maxPageNumber)); - foreach($chunkedPermissions[$pageNumber - 1] as $permission) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission); diff --git a/src/_64FF00/PurePerms/Commands/PPInfo.php b/src/_64FF00/PurePerms/Commands/PPInfo.php index 38295969..f13894ef 100644 --- a/src/_64FF00/PurePerms/Commands/PPInfo.php +++ b/src/_64FF00/PurePerms/Commands/PPInfo.php @@ -38,9 +38,7 @@ class PPInfo extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.ppinfo"); } @@ -54,10 +52,8 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - $author = $this->plugin->getDescription()->getAuthors()[0]; $version = $this->plugin->getDescription()->getVersion(); - if($sender instanceof ConsoleCommandSender) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppinfo.messages.ppinfo_console", $version, $author)); diff --git a/src/_64FF00/PurePerms/Commands/PPReload.php b/src/_64FF00/PurePerms/Commands/PPReload.php index 066360fd..bf47aa9a 100644 --- a/src/_64FF00/PurePerms/Commands/PPReload.php +++ b/src/_64FF00/PurePerms/Commands/PPReload.php @@ -37,9 +37,7 @@ class PPReload extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.ppreload"); } @@ -53,11 +51,8 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - $this->plugin->reload(); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppreload.messages.successfully_reloaded")); - return true; } diff --git a/src/_64FF00/PurePerms/Commands/PPSudo.php b/src/_64FF00/PurePerms/Commands/PPSudo.php index 157a7a9a..8b71a8a8 100644 --- a/src/_64FF00/PurePerms/Commands/PPSudo.php +++ b/src/_64FF00/PurePerms/Commands/PPSudo.php @@ -39,9 +39,7 @@ class PPSudo extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.noeul.ppsudo"); } @@ -55,23 +53,18 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(!($sender instanceof Player)) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.invalid_sender")); - return true; } - if(!isset($args[0]) || count($args) > 2) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.usage")); return true; } - $noeulAPI = $this->plugin->getNoeulAPI(); - switch(strtolower($args[0])) { case "login": @@ -79,55 +72,42 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(!$noeulAPI->isRegistered($sender)) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.not_registered")); - return true; } - if(!isset($args[1])) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.login_usage")); return true; } - $hash = $this->plugin->getUserDataMgr()->getNode($sender, 'noeulPW'); if($noeulAPI->hashEquals($args[1], $hash)) $noeulAPI->auth($sender); - break; case "register": - if($noeulAPI->isRegistered($sender)) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' '. $this->plugin->getMessage("cmds.ppsudo.messages.already_registered")); - return true; } - if(!isset($args[1])) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.register_usage")); - return true; } - $mpl = $this->plugin->getConfigValue("noeul-minimum-pw-length"); if(mb_strlen($args[1]) < $mpl) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.password_too_short", $mpl)); - return true; } - if($noeulAPI->register($sender, $args[1])) $noeulAPI->auth($sender); - break; } - return true; } diff --git a/src/_64FF00/PurePerms/Commands/RmGroup.php b/src/_64FF00/PurePerms/Commands/RmGroup.php index 1dbe58dc..0d348cc1 100644 --- a/src/_64FF00/PurePerms/Commands/RmGroup.php +++ b/src/_64FF00/PurePerms/Commands/RmGroup.php @@ -37,9 +37,7 @@ class RmGroup extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.rmgroup"); } @@ -53,16 +51,13 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(!isset($args[0]) || count($args) > 1) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.usage")); - return true; } $result = $this->plugin->removeGroup($args[0]); - if($result === PurePerms::SUCCESS) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.group_removed_successfully", $args[0])); diff --git a/src/_64FF00/PurePerms/Commands/RmParent.php b/src/_64FF00/PurePerms/Commands/RmParent.php index c54e8e9e..15357e96 100644 --- a/src/_64FF00/PurePerms/Commands/RmParent.php +++ b/src/_64FF00/PurePerms/Commands/RmParent.php @@ -37,9 +37,7 @@ class RmParent extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.rmparent"); } @@ -53,20 +51,15 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(count($args) < 2 || count($args) > 3) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmparent.usage")); - return true; } $target_group = $this->plugin->getGroup($args[0]); - $parent_group = $this->plugin->getGroup($args[1]); - $target_group->removeParent($parent_group); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmparent.messages.rmparent_successfully", $parent_group->getName(), $target_group->getName())); return true; diff --git a/src/_64FF00/PurePerms/Commands/SetGPerm.php b/src/_64FF00/PurePerms/Commands/SetGPerm.php index ec58c2c7..ed87d405 100644 --- a/src/_64FF00/PurePerms/Commands/SetGPerm.php +++ b/src/_64FF00/PurePerms/Commands/SetGPerm.php @@ -37,9 +37,7 @@ class SetGPerm extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.setgperm"); } @@ -59,31 +57,24 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(count($args) < 2 || count($args) > 3) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.usage")); - return true; } $group = $this->plugin->getGroup($args[0]); - if($group == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.group_not_exist", $args[0])); - return true; } $permission = $args[1]; - $levelName = null; - if(isset($args[2])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - return true; } @@ -91,9 +82,7 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $group->setGroupPermission($permission, $levelName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.gperm_added_successfully", $permission)); - return true; } diff --git a/src/_64FF00/PurePerms/Commands/SetGroup.php b/src/_64FF00/PurePerms/Commands/SetGroup.php index dc16b59a..a3c9ca1c 100644 --- a/src/_64FF00/PurePerms/Commands/SetGroup.php +++ b/src/_64FF00/PurePerms/Commands/SetGroup.php @@ -40,9 +40,7 @@ class SetGroup extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.setgroup"); } @@ -62,36 +60,28 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(count($args) < 2 || count($args) > 4) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.usage")); - return true; } $player = $this->plugin->getPlayer($args[0]); - $group = $this->plugin->getGroup($args[1]); if($group === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.group_not_exist", $args[1])); - return true; } $expTime = -1; - if(isset($args[2])) $expTime = $this->plugin->date2Int($args[2]); - $levelName = null; - if(isset($args[3])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[3]); - if($level === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.level_not_exist", $args[3])); - return true; } @@ -99,7 +89,6 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $superAdminRanks = $this->plugin->getConfigValue("superadmin-ranks"); - foreach(array_values($superAdminRanks) as $value) { $tmpSuperAdminRanks[$value] = 1; @@ -110,16 +99,13 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(isset($tmpSuperAdminRanks[$group->getName()])) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_01", $group->getName())); - return true; } $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $levelName); - if(isset($tmpSuperAdminRanks[$userGroup->getName()])) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_02", $userGroup->getName())); - return true; } } diff --git a/src/_64FF00/PurePerms/Commands/SetUPerm.php b/src/_64FF00/PurePerms/Commands/SetUPerm.php index 9ddf9ce6..b409c984 100644 --- a/src/_64FF00/PurePerms/Commands/SetUPerm.php +++ b/src/_64FF00/PurePerms/Commands/SetUPerm.php @@ -37,9 +37,7 @@ class SetUPerm extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.setuperm"); } @@ -53,28 +51,21 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(count($args) < 2 || count($args) > 3) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.usage")); - return true; } $player = $this->plugin->getPlayer($args[0]); - $permission = $args[1]; - $levelName = null; - if(isset($args[2])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.messages.level_not_exist", $args[2])); - return true; } @@ -82,9 +73,7 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $this->plugin->getUserDataMgr()->setPermission($player, $permission, $levelName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.messages.uperm_added_successfully", $permission, $player->getName())); - return true; } diff --git a/src/_64FF00/PurePerms/Commands/UnsetGPerm.php b/src/_64FF00/PurePerms/Commands/UnsetGPerm.php index 385f7aaf..4dea60df 100644 --- a/src/_64FF00/PurePerms/Commands/UnsetGPerm.php +++ b/src/_64FF00/PurePerms/Commands/UnsetGPerm.php @@ -37,9 +37,7 @@ class UnsetGPerm extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.unsetgperm"); } @@ -59,31 +57,24 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(count($args) < 2 || count($args) > 3) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.usage")); - return true; } $group = $this->plugin->getGroup($args[0]); - if($group == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' '. $this->plugin->getMessage("cmds.unsetgperm.messages.group_not_exist", $args[0])); - return true; } $permission = $args[1]; - $levelName = null; - if(isset($args[2])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); - return true; } @@ -91,7 +82,6 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $group->unsetGroupPermission($permission, $levelName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.gperm_removed_successfully", $permission)); return true; diff --git a/src/_64FF00/PurePerms/Commands/UnsetUPerm.php b/src/_64FF00/PurePerms/Commands/UnsetUPerm.php index 0d7fedba..67fdbbf9 100644 --- a/src/_64FF00/PurePerms/Commands/UnsetUPerm.php +++ b/src/_64FF00/PurePerms/Commands/UnsetUPerm.php @@ -37,9 +37,7 @@ class UnsetUPerm extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.unsetuperm"); } @@ -53,38 +51,29 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(count($args) < 2 || count($args) > 3) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetuperm.usage")); - return true; } $player = $this->plugin->getPlayer($args[0]); - $permission = $args[1]; - $levelName = null; if(isset($args[2])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); - return true; } $levelName = $level->getDisplayName(); } - $this->plugin->getUserDataMgr()->unsetPermission($player, $permission, $levelName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetuperm.messages.uperm_removed_successfully", $permission, $player->getName())); - return true; } diff --git a/src/_64FF00/PurePerms/Commands/UsrInfo.php b/src/_64FF00/PurePerms/Commands/UsrInfo.php index 4a8f390d..c9389728 100644 --- a/src/_64FF00/PurePerms/Commands/UsrInfo.php +++ b/src/_64FF00/PurePerms/Commands/UsrInfo.php @@ -41,9 +41,7 @@ class UsrInfo extends Command implements PluginOwned public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.usrinfo"); } @@ -57,18 +55,13 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(!$this->testPermission($sender)) return false; - if(count($args) < 1 || count($args) > 2) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.usage")); - return true; } - $player = $this->plugin->getPlayer($args[0]); - $levelName = null; - if(isset($args[1])) { $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); @@ -79,24 +72,18 @@ public function execute(CommandSender $sender, string $label, array $args) : boo return true; } - $levelName = $level->getDisplayName(); } $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_header", $player->getName())); - $status = $player instanceof Player ? TextFormat::DARK_GREEN . $this->plugin->getMessage("cmds.usrinfo.messages.status_online") : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.status_offline"); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_status", $status)); - $ip = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getNetworkSession()->getIp() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_ip", $ip)); - $uuid = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getUniqueId()->toString() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_uuid", $uuid)); - $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $levelName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_group", TextFormat::DARK_GREEN . $userGroup->getName())); - $expDate = $this->plugin->getUserDataMgr()->getExpDate($player, $levelName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_exp", TextFormat::DARK_GREEN . $expDate)); diff --git a/src/_64FF00/PurePerms/DataManager/UserDataManager.php b/src/_64FF00/PurePerms/DataManager/UserDataManager.php index b855be34..1b348e3d 100644 --- a/src/_64FF00/PurePerms/DataManager/UserDataManager.php +++ b/src/_64FF00/PurePerms/DataManager/UserDataManager.php @@ -43,7 +43,6 @@ public function getData(IPlayer $player) public function getExpDate(IPlayer $player, $levelName = null) { $expDate = $levelName !== null ? $this->getWorldData($player, $levelName)["expTime"] : $this->getNode($player, "expTime"); - // TODO return $expDate; } @@ -56,19 +55,14 @@ public function getExpDate(IPlayer $player, $levelName = null) public function getGroup(IPlayer $player, $levelName = null) { $groupName = $levelName !== null ? $this->getWorldData($player, $levelName)["group"] : $this->getNode($player, "group"); - $group = $this->plugin->getGroup($groupName); - // TODO: ... if($group === null) { $this->plugin->getLogger()->critical("Invalid group name found in " . $player->getName() . "'s player data (World: " . ($levelName === null ? "GLOBAL" : $levelName) . ")"); $this->plugin->getLogger()->critical("Restoring the group data to 'default'"); - $defaultGroup = $this->plugin->getDefaultGroup($levelName); - $this->setGroup($player, $defaultGroup, $levelName); - return $defaultGroup; } @@ -83,10 +77,8 @@ public function getGroup(IPlayer $player, $levelName = null) public function getNode(IPlayer $player, $node) { $userData = $this->getData($player); - if(!isset($userData[$node])) return null; - return $userData[$node]; } @@ -97,14 +89,11 @@ public function getNode(IPlayer $player, $node) public function getUserPermissions(IPlayer $player, $levelName = null) { $permissions = $levelName != null ? $this->getWorldData($player, $levelName)["permissions"] : $this->getNode($player, "permissions"); - if(!is_array($permissions)) { $this->plugin->getLogger()->critical("Invalid 'permissions' node given to " . __METHOD__ . '()'); - return []; } - return $permissions; } @@ -117,7 +106,6 @@ public function getWorldData(IPlayer $player, $levelName) { if($levelName === null) $levelName = $this->plugin->getServer()->getWorldManager()->getDefaultWorld()->getDisplayName(); - if(!isset($this->getData($player)["worlds"][$levelName])) return [ "group" => $this->plugin->getDefaultGroup($levelName)->getName(), @@ -125,18 +113,15 @@ public function getWorldData(IPlayer $player, $levelName) ], "expTime" => -1 ]; - return $this->getData($player)["worlds"][$levelName]; } public function removeNode(IPlayer $player, $node) { $tempUserData = $this->getData($player); - if(isset($tempUserData[$node])) { unset($tempUserData[$node]); - $this->setData($player, $tempUserData); } } @@ -166,10 +151,8 @@ public function setGroup(IPlayer $player, PPGroup $group, $levelName, $time = -1 else { $worldData = $this->getWorldData($player, $levelName); - $worldData["group"] = $group->getName(); $worldData["expTime"] = $time; - $this->setWorldData($player, $levelName, $worldData); } @@ -186,9 +169,7 @@ public function setGroup(IPlayer $player, PPGroup $group, $levelName, $time = -1 public function setNode(IPlayer $player, $node, $value) { $tempUserData = $this->getData($player); - $tempUserData[$node] = $value; - $this->setData($player, $tempUserData); } @@ -202,17 +183,13 @@ public function setPermission(IPlayer $player, $permission, $levelName = null) if($levelName === null) { $tempUserData = $this->getData($player); - $tempUserData["permissions"][] = $permission; - $this->setData($player, $tempUserData); } else { $worldData = $this->getWorldData($player, $levelName); - $worldData["permissions"][] = $permission; - $this->setWorldData($player, $levelName, $worldData); } @@ -222,7 +199,6 @@ public function setPermission(IPlayer $player, $permission, $levelName = null) public function setWorldData(IPlayer $player, $levelName, array $worldData) { $tempUserData = $this->getData($player); - if(!isset($this->getData($player)["worlds"][$levelName])) { $tempUserData["worlds"][$levelName] = [ @@ -234,9 +210,7 @@ public function setWorldData(IPlayer $player, $levelName, array $worldData) $this->setData($player, $tempUserData); } - $tempUserData["worlds"][$levelName] = $worldData; - $this->setData($player, $tempUserData); } @@ -250,21 +224,15 @@ public function unsetPermission(IPlayer $player, $permission, $levelName = null) if($levelName === null) { $tempUserData = $this->getData($player); - if(!in_array($permission, $tempUserData["permissions"])) return; - $tempUserData["permissions"] = array_diff($tempUserData["permissions"], [$permission]); - $this->setData($player, $tempUserData); } else { $worldData = $this->getWorldData($player, $levelName); - if(!in_array($permission, $worldData["permissions"])) return; - $worldData["permissions"] = array_diff($worldData["permissions"], [$permission]); - $this->setWorldData($player, $levelName, $worldData); } diff --git a/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php b/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php index 6489dc57..0aca4269 100644 --- a/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php +++ b/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php @@ -33,17 +33,12 @@ class DefaultProvider implements ProviderInterface public function __construct(PurePerms $plugin) { $this->plugin = $plugin; - $this->plugin->saveResource("groups.yml"); - $this->groups = new Config($this->plugin->getDataFolder() . "groups.yml", Config::YAML); - if(empty($this->groups->getAll())){ throw new RuntimeException($this->plugin->getMessage("logger_messages.YAMLProvider_InvalidGroupsSettings")); } - $this->plugin->saveResource("players.yml"); - $this->players = new Config($this->plugin->getDataFolder() . "players.yml", Config::YAML); } @@ -54,9 +49,7 @@ public function __construct(PurePerms $plugin) public function getGroupData(PPGroup $group) { $groupName = $group->getName(); - if(!isset($this->getGroupsData()[$groupName]) || !is_array($this->getGroupsData()[$groupName])) return []; - return $this->getGroupsData()[$groupName]; } @@ -110,9 +103,7 @@ public function getUsers() public function setGroupData(PPGroup $group, array $tempGroupData) { $groupName = $group->getName(); - $this->groups->set($groupName, $tempGroupData); - $this->groups->save(); } @@ -122,7 +113,6 @@ public function setGroupData(PPGroup $group, array $tempGroupData) public function setGroupsData(array $tempGroupsData) { $this->groups->setAll($tempGroupsData); - $this->groups->save(); } @@ -133,7 +123,6 @@ public function setGroupsData(array $tempGroupsData) public function setPlayerData(IPlayer $player, array $tempUserData) { $userName = strtolower($player->getName()); - if(!$this->players->exists($userName)) { $this->players->set($userName, [ @@ -146,9 +135,7 @@ public function setPlayerData(IPlayer $player, array $tempUserData) if(isset($tempUserData["userName"])) unset($tempUserData["userName"]); - $this->players->set($userName, $tempUserData); - $this->players->save(); } diff --git a/src/_64FF00/PurePerms/DataProviders/MySQLProvider.php b/src/_64FF00/PurePerms/DataProviders/MySQLProvider.php index 281b4c2a..38d4116f 100644 --- a/src/_64FF00/PurePerms/DataProviders/MySQLProvider.php +++ b/src/_64FF00/PurePerms/DataProviders/MySQLProvider.php @@ -34,31 +34,21 @@ class MySQLProvider implements ProviderInterface public function __construct(PurePerms $plugin) { $this->plugin = $plugin; - $mySQLSettings = $this->plugin->getConfigValue("mysql-settings"); - if(!isset($mySQLSettings["host"]) || !isset($mySQLSettings["port"]) || !isset($mySQLSettings["user"]) || !isset($mySQLSettings["password"]) || !isset($mySQLSettings["db"])) throw new RuntimeException("Failed to connect to the MySQL database: Invalid MySQL settings"); - - $this->db = new \mysqli($mySQLSettings["host"], $mySQLSettings["user"], $mySQLSettings["password"], $mySQLSettings["db"], $mySQLSettings["port"]); - if($this->db->connect_error) throw new RuntimeException("Failed to connect to the MySQL database: " . $this->db->connect_error); - $resource = $this->plugin->getResource("mysql_deploy_01.sql"); $this->db->multi_query(stream_get_contents($resource)); - while($this->db->more_results()) { $this->db->next_result(); } - fclose($resource); - $this->loadGroupsData(); - $this->plugin->getScheduler()->scheduleRepeatingTask(new PPMySQLTask($this->plugin, $this->db), 1200); } @@ -69,9 +59,7 @@ public function __construct(PurePerms $plugin) public function getGroupData(PPGroup $group) { $groupName = $group->getName(); - if(!isset($this->getGroupsData()[$groupName]) || !is_array($this->getGroupsData()[$groupName])) return []; - return $this->getGroupsData()[$groupName]; } @@ -96,7 +84,6 @@ public function getPlayerData(IPlayer $player) ]; $result01 = $this->db->query("SELECT * FROM players WHERE userName = '" . $this->db->escape_string($player->getName()) . "';"); - if($result01 instanceof \mysqli_result) { while($currentRow = $result01->fetch_assoc()) @@ -107,9 +94,7 @@ public function getPlayerData(IPlayer $player) $result01->free(); } - $result02 = $this->db->query("SELECT * FROM players_mw WHERE userName = '" . $this->db->escape_string($player->getName()) . "';"); - if($result02 instanceof \mysqli_result) { while($currentRow = $result02->fetch_assoc()) @@ -125,7 +110,6 @@ public function getPlayerData(IPlayer $player) $result02->free(); } - return $userData; } @@ -143,11 +127,8 @@ public function loadGroupsData() if($result01->num_rows <= 0) { $this->plugin->getLogger()->notice("No groups found in table 'groups', loading groups defined in default SQL script"); - $resource = $this->plugin->getResource("mysql_deploy_02.sql"); - $this->db->multi_query(stream_get_contents($resource)); - while($this->db->more_results()) { $this->db->next_result(); @@ -157,22 +138,18 @@ public function loadGroupsData() $result01 = $this->db->query("SELECT * FROM groups;"); } - while($currentRow = $result01->fetch_assoc()) { $groupName = $currentRow["groupName"]; - $this->groupsData[$groupName]["alias"] = $currentRow["alias"]; $this->groupsData[$groupName]["isDefault"] = $currentRow["isDefault"] === "1" ? true : false; $this->groupsData[$groupName]["inheritance"] = $currentRow["inheritance"] !== "" ? explode(",", $currentRow["inheritance"]) : []; $this->groupsData[$groupName]["permissions"] = explode(",", $currentRow["permissions"]); } - $result01->free(); } $result02 = $this->db->query("SELECT * FROM groups_mw;"); - if($result02 instanceof \mysqli_result) { while($currentRow = $result02->fetch_assoc()) @@ -181,7 +158,6 @@ public function loadGroupsData() $groupName = $currentRow["groupName"]; $worldName = $currentRow["worldName"]; $worldPerms = explode(",", $currentRow["permissions"]); - $this->groupsData[$groupName]["worlds"][$worldName]["isDefault"] = $isDefault; $this->groupsData[$groupName]["worlds"][$worldName]["permissions"] = $worldPerms; } @@ -198,13 +174,11 @@ public function removeGroupData($groupName) $this->db->query(" DELETE FROM groups WHERE groupName = '" . $this->db->escape_string($groupName) . "';"); - $this->db->query(" DELETE OR IGNORE FROM groups_mw WHERE groupName = '" . $this->db->escape_string($groupName) . "';"); } - /** * @param PPGroup $group * @param array $tempGroupData @@ -212,9 +186,7 @@ public function removeGroupData($groupName) public function setGroupData(PPGroup $group, array $tempGroupData) { $groupName = $group->getName(); - $this->updateGroupData($groupName, $tempGroupData); - $this->loadGroupsData(); } @@ -224,16 +196,12 @@ public function setGroupData(PPGroup $group, array $tempGroupData) public function setGroupsData(array $tempGroupsData) { $tempGroupData01 = array_diff_key($this->groupsData, $tempGroupsData); - $tempGroupName01 = key($tempGroupData01); - if($tempGroupData01 !== []) $this->removeGroupData($tempGroupName01); - foreach($tempGroupsData as $tempGroupName02 => $tempGroupData02) { $this->updateGroupData($tempGroupName02, $tempGroupData02); } - $this->loadGroupsData(); } @@ -291,7 +259,6 @@ public function updateGroupData($groupName, array $tempGroupData) $isDefault = $tempGroupData["isDefault"] === true ? "1" : "0"; $inheritance = implode(",", $tempGroupData["inheritance"]); $permissions = implode(",", $tempGroupData["permissions"]); - $this->db->query("INSERT INTO groups (groupName, alias, isDefault, inheritance, permissions) VALUES @@ -308,7 +275,6 @@ public function updateGroupData($groupName, array $tempGroupData) { $isDefault = $worldData["isDefault"] === true ? "1" : "0"; $worldPerms = implode(",", $worldData["permissions"]); - if(!is_array($worldPerms)) { $this->db->query("INSERT INTO groups_mw diff --git a/src/_64FF00/PurePerms/DataProviders/ProviderInterface.php b/src/_64FF00/PurePerms/DataProviders/ProviderInterface.php index d4f68532..2bc4e7c5 100644 --- a/src/_64FF00/PurePerms/DataProviders/ProviderInterface.php +++ b/src/_64FF00/PurePerms/DataProviders/ProviderInterface.php @@ -22,18 +22,11 @@ interface ProviderInterface */ public function getGroupData(PPGroup $group); - public function getGroupsData(); - public function getPlayerData(IPlayer $player); - public function getUsers(); - public function setGroupData(PPGroup $group, array $tempGroupData); - public function setGroupsData(array $tempGroupsData); - public function setPlayerData(IPlayer $player, array $tempPlayerData); - public function close(); } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php b/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php index 45d9da13..465a25f1 100644 --- a/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php +++ b/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php @@ -19,7 +19,6 @@ class SQLite3Provider implements ProviderInterface */ private $db, $plugin; - private $groupsData = []; /** @@ -28,11 +27,8 @@ class SQLite3Provider implements ProviderInterface public function __construct(PurePerms $plugin) { $this->plugin = $plugin; - $this->db = new \SQLite3($plugin->getDataFolder()."pureperms.db"); - $this->db->exec(""); - $this->loadGroupsData(); } diff --git a/src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php b/src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php index 82a84e3a..e381c3d1 100644 --- a/src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php +++ b/src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php @@ -35,13 +35,9 @@ class YamlV1Provider implements ProviderInterface public function __construct(PurePerms $plugin) { $this->plugin = $plugin; - $this->plugin->saveResource("groups.yml"); - $this->groups = new Config($this->plugin->getDataFolder() . "groups.yml", Config::YAML, []); - $this->userDataFolder = $this->plugin->getDataFolder() . "players/"; - if(!file_exists($this->userDataFolder)) @mkdir($this->userDataFolder, 0777, true); } diff --git a/src/_64FF00/PurePerms/EventManager/PPGroupChangedEvent.php b/src/_64FF00/PurePerms/EventManager/PPGroupChangedEvent.php index 4d89ff17..d4cd5343 100644 --- a/src/_64FF00/PurePerms/EventManager/PPGroupChangedEvent.php +++ b/src/_64FF00/PurePerms/EventManager/PPGroupChangedEvent.php @@ -36,7 +36,6 @@ class PPGroupChangedEvent extends PluginEvent public function __construct(PurePerms $plugin, IPlayer $player, PPGroup $group, ?string $worldName) { parent::__construct($plugin); - $this->group = $group; $this->player = $player; $this->worldName = $worldName; diff --git a/src/_64FF00/PurePerms/PPGroup.php b/src/_64FF00/PurePerms/PPGroup.php index 2bb29797..91d3f940 100644 --- a/src/_64FF00/PurePerms/PPGroup.php +++ b/src/_64FF00/PurePerms/PPGroup.php @@ -18,7 +18,6 @@ class PPGroup */ private $name, $plugin; - private $parents = []; /** @@ -46,16 +45,11 @@ public function __toString() public function addParent(PPGroup $group) { $tempGroupData = $this->getData(); - if($this === $group || in_array($this->getName(), $group->getParentGroups())) return false; - $tempGroupData["inheritance"][] = $group->getName(); - $this->setData($tempGroupData); - $this->plugin->updatePlayersInGroup($this); - return true; } @@ -73,7 +67,6 @@ public function createWorldData($levelName) "permissions" => [ ] ]; - $this->setData($tempGroupData); } } @@ -85,7 +78,6 @@ public function getAlias() { if($this->getNode("alias") === null) return $this->name; - return $this->getNode("alias"); } @@ -104,11 +96,9 @@ public function getData() public function getGroupPermissions($levelName = null) { $permissions = $levelName !== null ? $this->getWorldData($levelName)["permissions"] : $this->getNode("permissions"); - if(!is_array($permissions)) { $this->plugin->getLogger()->critical("Invalid 'permissions' node given to " . __METHOD__); - return []; } @@ -116,14 +106,11 @@ public function getGroupPermissions($levelName = null) foreach($this->getParentGroups() as $parentGroup) { $parentPermissions = $parentGroup->getGroupPermissions($levelName); - if($parentPermissions === null) $parentPermissions = []; - // Fixed by @mad-hon (https://github.com/mad-hon) / Tysm! :D $permissions = array_merge($parentPermissions, $permissions); } - return $permissions; } @@ -142,7 +129,6 @@ public function getName() public function getNode($node) { if(!isset($this->getData()[$node])) return null; - return $this->getData()[$node]; } @@ -156,14 +142,12 @@ public function getParentGroups() if(!is_array($this->getNode("inheritance"))) { $this->plugin->getLogger()->critical("Invalid 'inheritance' node given to " . __METHOD__); - return []; } foreach($this->getNode("inheritance") as $parentGroupName) { $parentGroup = $this->plugin->getGroup($parentGroupName); - if($parentGroup !== null) $this->parents[] = $parentGroup; } @@ -180,9 +164,7 @@ public function getWorldData($levelName) { if($levelName === null) return null; - $this->createWorldData($levelName); - return $this->getData()["worlds"][$levelName]; } @@ -194,7 +176,6 @@ public function getWorldData($levelName) public function getWorldNode($levelName, $node) { if(!isset($this->getWorldData($levelName)[$node])) return null; - return $this->getWorldData($levelName)[$node]; } @@ -220,7 +201,6 @@ public function isDefault($levelName = null) public function removeNode($node) { $tempGroupData = $this->getData(); - if(isset($tempGroupData[$node])) { unset($tempGroupData[$node]); @@ -236,11 +216,8 @@ public function removeNode($node) public function removeParent(PPGroup $group) { $tempGroupData = $this->getData(); - $tempGroupData["inheritance"] = array_diff($tempGroupData["inheritance"], [$group->getName()]); - $this->setData($tempGroupData); - $this->plugin->updatePlayersInGroup($this); return true; @@ -253,11 +230,9 @@ public function removeParent(PPGroup $group) public function removeWorldNode($levelName, $node) { $worldData = $this->getWorldData($levelName); - if(isset($worldData[$node])) { unset($worldData[$node]); - $this->setWorldData($levelName, $worldData); } } @@ -282,9 +257,7 @@ public function setDefault($levelName = null) else { $worldData = $this->getWorldData($levelName); - $worldData["isDefault"] = true; - $this->setWorldData($levelName, $worldData); } } @@ -300,20 +273,15 @@ public function setGroupPermission($permission, $levelName = null) if($levelName == null) { $tempGroupData = $this->getData(); - $tempGroupData["permissions"][] = $permission; - $this->setData($tempGroupData); } else { $worldData = $this->getWorldData($levelName); - $worldData["permissions"][] = $permission; - $this->setWorldData($levelName, $worldData); } - $this->plugin->updatePlayersInGroup($this); return true; @@ -326,9 +294,7 @@ public function setGroupPermission($permission, $levelName = null) public function setNode($node, $value) { $tempGroupData = $this->getData(); - $tempGroupData[$node] = $value; - $this->setData($tempGroupData); } @@ -341,9 +307,7 @@ public function setWorldData($levelName, array $worldData) if(isset($this->getData()["worlds"][$levelName])) { $tempGroupData = $this->getData(); - $tempGroupData["worlds"][$levelName] = $worldData; - $this->setData($tempGroupData); } } @@ -356,35 +320,28 @@ public function setWorldData($levelName, array $worldData) public function setWorldNode($levelName, $node, $value) { $worldData = $this->getWorldData($levelName); - $worldData[$node] = $value; - $this->setWorldData($levelName, $worldData); } public function sortPermissions() { $tempGroupData = $this->getData(); - if(isset($tempGroupData["permissions"])) { $tempGroupData["permissions"] = array_unique($tempGroupData["permissions"]); - sort($tempGroupData["permissions"]); } $isMultiWorldPermsEnabled = $this->plugin->getConfigValue("enable-multiworld-perms"); - if($isMultiWorldPermsEnabled and isset($tempGroupData["worlds"])) { foreach($this->plugin->getServer()->getWorldManager()->getWorlds() as $level) { $levelName = $level->getDisplayName(); - if(isset($tempGroupData["worlds"][$levelName])) { $tempGroupData["worlds"][$levelName]["permissions"] = array_unique($tempGroupData["worlds"][$levelName]["permissions"]); - sort($tempGroupData["worlds"][$levelName]["permissions"]); } } @@ -403,26 +360,18 @@ public function unsetGroupPermission($permission, $levelName = null) if($levelName == null) { $tempGroupData = $this->getData(); - if(!in_array($permission, $tempGroupData["permissions"])) return false; - $tempGroupData["permissions"] = array_diff($tempGroupData["permissions"], [$permission]); - $this->setData($tempGroupData); } else { $worldData = $this->getWorldData($levelName); - if(!in_array($permission, $worldData["permissions"])) return false; - $worldData["permissions"] = array_diff($worldData["permissions"], [$permission]); - $this->setWorldData($levelName, $worldData); } - $this->plugin->updatePlayersInGroup($this); - return true; } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/PPListener.php b/src/_64FF00/PurePerms/PPListener.php index 5f8420fd..088e92ac 100644 --- a/src/_64FF00/PurePerms/PPListener.php +++ b/src/_64FF00/PurePerms/PPListener.php @@ -45,7 +45,6 @@ public function __construct(PurePerms $plugin) public function onGroupChanged(PPGroupChangedEvent $event) { $player = $event->getPlayer(); - $this->plugin->updatePermissions($player); } @@ -56,7 +55,6 @@ public function onGroupChanged(PPGroupChangedEvent $event) public function onLevelChange(EntityTeleportEvent $event) { if($event->isCancelled()) return; - $player = $event->getEntity(); if($player instanceof Player) { $this->plugin->updatePermissions($player, $event->getTo()->getWorld()->getDisplayName()); @@ -76,7 +74,6 @@ public function onPlayerCommand(PlayerCommandPreprocessEvent $event) if(!$this->plugin->getNoeulAPI()->isAuthed($event->getPlayer())) { $event->cancel(); - if($args[0] === "ppsudo" or $args[0] === "help") { $this->plugin->getServer()->dispatchCommand($player, $command); @@ -89,11 +86,9 @@ public function onPlayerCommand(PlayerCommandPreprocessEvent $event) else { $disableOp = $this->plugin->getConfigValue("disable-op"); - if($disableOp and $args[0] === "op") { $event->cancel(); - $player->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission")); } } @@ -107,12 +102,9 @@ public function onPlayerCommand(PlayerCommandPreprocessEvent $event) public function onPlayerLogin(PlayerLoginEvent $event) { $player = $event->getPlayer(); - $this->plugin->registerPlayer($player); - if($this->plugin->getNoeulAPI()->isNoeulEnabled()) $this->plugin->getNoeulAPI()->deAuth($player); - if(!$this->plugin->getNoeulAPI()->isAuthed($player)) $this->plugin->getNoeulAPI()->sendAuthMsg($player); } @@ -124,7 +116,6 @@ public function onPlayerLogin(PlayerLoginEvent $event) public function onPlayerQuit(PlayerQuitEvent $event) { $player = $event->getPlayer(); - $this->plugin->unregisterPlayer($player); } @@ -135,7 +126,6 @@ public function onPlayerQuit(PlayerQuitEvent $event) public function onRankExpired(PPRankExpiredEvent $event) { $player = $event->getPlayer(); - $this->plugin->setGroup($player, $this->plugin->getDefaultGroup()); } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/PPMessages.php b/src/_64FF00/PurePerms/PPMessages.php index af8a755a..f494563c 100644 --- a/src/_64FF00/PurePerms/PPMessages.php +++ b/src/_64FF00/PurePerms/PPMessages.php @@ -21,10 +21,8 @@ class PPMessages /** @var $language */ private string $language; - /** @var Config $messages */ private Config $messages; - private array $langList = []; /** @@ -33,21 +31,17 @@ class PPMessages public function __construct(PurePerms $plugin) { $this->plugin = $plugin; - $this->registerLanguages(); - $this->loadMessages(); } public function registerLanguages() { $result = []; - foreach($this->plugin->getResources() as $resource) { if(mb_strpos($resource, "messages-") !== false) $result[] = substr($resource, -6, -4); } - $this->langList = $result; } @@ -59,21 +53,16 @@ public function registerLanguages() public function getMessage($node, ...$vars) { $msg = $this->messages->getNested($node); - if($msg != null) { $number = 0; - foreach($vars as $v) { $msg = str_replace("%var$number%", $v, $msg); - $number++; } - return $msg; } - return null; } @@ -83,14 +72,12 @@ public function getMessage($node, ...$vars) public function getVersion() : string { $version = $this->messages->get("messages-version"); - return $version; } public function loadMessages() { $defaultLang = $this->plugin->getConfigValue("default-language"); - foreach($this->langList as $langName) { if(strtolower($defaultLang) == $langName) @@ -102,21 +89,16 @@ public function loadMessages() if(!isset($this->language)) { $this->plugin->getLogger()->warning("Language resource " . $defaultLang . " not found. Using default language resource by " . $this->plugin->getDescription()->getAuthors()[0]); - $this->language = "en"; } $this->plugin->saveResource("messages-" . $this->language . ".yml"); - $this->messages = new Config($this->plugin->getDataFolder() . "messages-" . $this->language . ".yml", Config::YAML, [ ]); - $this->plugin->getLogger()->info("Setting default language to '" . $defaultLang . "'"); - if(version_compare($this->getVersion(), $this->plugin->getPPVersion()) === -1) { $this->plugin->saveResource("messages-" . $this->language . ".yml", true); - $this->messages = new Config($this->plugin->getDataFolder() . "messages-" . $this->language . ".yml", Config::YAML, [ ]); } diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 284d4091..99440af9 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -81,15 +81,10 @@ class PurePerms extends PluginBase public function onLoad(): void { $this->saveDefaultConfig(); - $this->fixConfig(); - $this->messages = new PPMessages($this); - $this->noeulAPI = new NoeulAPI($this); - $this->userDataMgr = new UserDataManager($this); - if($this->getConfigValue("enable-multiworld-perms") === false) { $this->getLogger()->info($this->getMessage("logger_messages.onLoad_01")); @@ -104,20 +99,15 @@ public function onLoad(): void public function onEnable(): void { $this->registerCommands(); - $this->setProvider(); - $this->registerPlayers(); - $this->getServer()->getPluginManager()->registerEvents(new PPListener($this), $this); - $this->getScheduler()->scheduleRepeatingTask(new PPExpDateCheckTask($this), 72000); } public function onDisable(): void { $this->unregisterPlayers(); - if($this->isValidProvider()) $this->provider->close(); } @@ -125,25 +115,18 @@ public function onDisable(): void private function fixConfig() { $config = $this->getConfig(); - if(!$config->exists("default-language")) $config->set("default-language", "en"); - if(!$config->exists("disable-op")) $config->set("disable-op", true); - if(!$config->exists("enable-multiworld-perms")) $config->set("enable-multiworld-perms", false); - if(!$config->exists("enable-noeul-sixtyfour")) $config->set("enable-noeul-sixtyfour", false); - if(!$config->exists("noeul-minimum-pw-length")) $config->set("noeul-minimum-pw-length", 6); - if(!$config->exists("superadmin-ranks")) $config->set("superadmin-ranks", ["OP"]); - $this->saveConfig(); $this->reloadConfig(); } @@ -151,10 +134,8 @@ private function fixConfig() private function registerCommands() { $commandMap = $this->getServer()->getCommandMap(); - if($this->getNoeulAPI()->isNoeulEnabled()) $commandMap->register("pureperms", new PPSudo($this, "ppsudo", $this->getMessage("cmds.ppsudo.desc") . ' #64FF00')); - $commandMap->register("pureperms", new AddGroup($this, "addgroup", $this->getMessage("cmds.addgroup.desc") . ' #64FF00')); $commandMap->register("pureperms", new AddParent($this, "addparent", $this->getMessage("cmds.addparent.desc") . ' #64FF00')); $commandMap->register("pureperms", new DefGroup($this, "defgroup", $this->getMessage("cmds.defgroup.desc") . ' #64FF00')); @@ -182,49 +163,33 @@ private function registerCommands() private function setProvider($onEnable = true) { $providerName = $this->getConfigValue("data-provider"); - switch(strtolower($providerName)) { case "mysql": - $provider = new MySQLProvider($this); if($onEnable === true) $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_MySQL")); - break; case "yamlv1": - $provider = new YamlV1Provider($this); - if($onEnable === true) $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_YAMLv1")); - break; - case "yamlv2": - $provider = new DefaultProvider($this); - if($onEnable === true) $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_YAMLv2")); - break; - default: - $provider = new DefaultProvider($this); - if($onEnable === true) $this->getLogger()->warning($this->getMessage("logger_messages.setProvider_NotFound", "'$providerName'")); - break; } - if($provider instanceof ProviderInterface) $this->provider = $provider; - $this->updateGroups(); } @@ -246,13 +211,10 @@ private function setProvider($onEnable = true) public function addGroup($groupName) { $groupsData = $this->getProvider()->getGroupsData(); - if(!$this->isValidGroupName($groupName)) return self::INVALID_NAME; - if(isset($groupsData[$groupName])) return self::ALREADY_EXISTS; - $groupsData[$groupName] = [ "alias" => "", "isDefault" => false, @@ -263,11 +225,8 @@ public function addGroup($groupName) "worlds" => [ ] ]; - $this->getProvider()->setGroupsData($groupsData); - $this->updateGroups(); - return self::SUCCESS; } @@ -280,7 +239,6 @@ public function date2Int($date) { if(preg_match("/([0-9]+)d([0-9]+)h([0-9]+)m/", $date, $result_array) and count($result_array) === 4) return time() + ($result_array[1] * 86400) + ($result_array[2] * 3600) + ($result_array[3] * 60); - return -1; } @@ -291,10 +249,8 @@ public function date2Int($date) public function getAttachment(Player $player) { $uniqueId = $this->getValidUUID($player); - if(!isset($this->attachments[$uniqueId])) throw new RuntimeException("Tried to calculate permissions on " . $player->getName() . " using null attachment"); - return $this->attachments[$uniqueId]; } @@ -305,7 +261,6 @@ public function getAttachment(Player $player) public function getConfigValue($key) { $value = $this->getConfig()->getNested($key); - if($value === null) { $this->getLogger()->warning($this->getMessage("logger_messages.getConfigValue_01", $key)); @@ -323,7 +278,6 @@ public function getConfigValue($key) public function getDefaultGroup($levelName = null) { $defaultGroups = []; - foreach($this->getGroups() as $defaultGroup) { if($defaultGroup->isDefault($levelName)) @@ -375,9 +329,7 @@ public function getGroup($groupName) if($group->getAlias() === $groupName) return $group; } - $this->getLogger()->debug($this->getMessage("logger_messages.getGroup_01", $groupName)); - return null; } @@ -387,7 +339,6 @@ public function getGroup($groupName) if(empty($group->getData())) { $this->getLogger()->warning($this->getMessage("logger_messages.getGroup_02", $groupName)); - return null; } @@ -401,7 +352,6 @@ public function getGroups() { if($this->isGroupsLoaded !== true) throw new RuntimeException("No groups loaded, maybe a provider error?"); - return $this->groups; } @@ -425,13 +375,11 @@ public function getNoeulAPI() public function getOnlinePlayersInGroup(PPGroup $group) { $users = []; - foreach($this->getServer()->getOnlinePlayers() as $player) { foreach($this->getServer()->getWorldManager()->getWorlds() as $level) { $levelName = $level->getDisplayName(); - if($this->userDataMgr->getGroup($player, $levelName) === $group) $users[] = $player; } @@ -449,7 +397,6 @@ public function getPermissions(IPlayer $player, $levelName) { // TODO: Fix this $group = $this->userDataMgr->getGroup($player, $levelName); - $groupPerms = $group->getGroupPermissions($levelName); $userPerms = $this->userDataMgr->getUserPermissions($player, $levelName); @@ -463,7 +410,6 @@ public function getPermissions(IPlayer $player, $levelName) public function getPlayer($userName) { $player = $this->getServer()->getPlayerByPrefix($userName); - return $player instanceof Player ? $player : $this->getServer()->getOfflinePlayer($userName); } @@ -519,10 +465,8 @@ public function getUserDataMgr() public function getValidUUID(Player $player) { $uuid = $player->getUniqueId(); - if($uuid instanceof Uuid) return $uuid->toString(); - $this->getLogger()->debug("Invalid UUID detected! *cri* (userName: " . $player->getName() . ", isConnected: " . ($player->isConnected() ? "true" : "false") . ", isOnline: " . ($player->isOnline() ? "true" : "false") . ", isValid: " . (Uuid::isValid($uuid) ? "true" : "false") . ")"); return null; @@ -544,7 +488,6 @@ public function isValidProvider() { if(!isset($this->provider) || ($this->provider === null) || !($this->provider instanceof ProviderInterface)) return false; - return true; } @@ -554,15 +497,11 @@ public function isValidProvider() public function registerPlayer(Player $player) { $this->getLogger()->debug($this->getMessage("logger_messages.registerPlayer", $player->getName())); - $uniqueId = $this->getValidUUID($player); - if(!isset($this->attachments[$uniqueId])) { $attachment = $player->addAttachment($this); - $this->attachments[$uniqueId] = $attachment; - $this->updatePermissions($player); } } @@ -579,11 +518,8 @@ public function reload() { $this->reloadConfig(); $this->saveDefaultConfig(); - $this->messages->reloadMessages(); - $this->setProvider(false); - foreach($this->getServer()->getOnlinePlayers() as $player) { $this->updatePermissions($player); @@ -598,18 +534,12 @@ public function removeGroup($groupName) { if(!$this->isValidGroupName($groupName)) return self::INVALID_NAME; - $groupsData = $this->getProvider()->getGroupsData(); - if(!isset($groupsData[$groupName])) return self::NOT_FOUND; - unset($groupsData[$groupName]); - $this->getProvider()->setGroupsData($groupsData); - $this->updateGroups(); - return self::SUCCESS; } @@ -631,7 +561,6 @@ public function setDefaultGroup(PPGroup $group, $levelName = null) else { $isDefault = $currentGroup->getWorldNode($levelName, "isDefault"); - if($isDefault) $currentGroup->removeWorldNode($levelName, "isDefault"); } @@ -674,20 +603,15 @@ public function updateGroups() { if(!$this->isValidProvider()) throw new RuntimeException("Failed to load groups: Invalid data provider"); - // Make group list empty first to reload it $this->groups = []; - foreach(array_keys($this->getProvider()->getGroupsData()) as $groupName) { $this->groups[$groupName] = new PPGroup($this, $groupName); } - if(empty($this->groups)) throw new RuntimeException("No groups found, I guess there's definitely something wrong with your data provider... *cough cough*"); - $this->isGroupsLoaded = true; - $this->sortGroupData(); } @@ -704,9 +628,7 @@ public function updatePermissions(IPlayer $player, string $levelName = null) }elseif($levelName == null) { $levelName = $player->getWorld()->getDisplayName(); } - $permissions = []; - /** @var string $permission */ foreach($this->getPermissions($player, $levelName) as $permission) { @@ -720,7 +642,6 @@ public function updatePermissions(IPlayer $player, string $levelName = null) else { $isNegative = substr($permission, 0, 1) === "-"; - if($isNegative) $permission = substr($permission, 1); @@ -729,12 +650,9 @@ public function updatePermissions(IPlayer $player, string $levelName = null) } $permissions[self::CORE_PERM] = true; - /** @var \pocketmine\permission\PermissionAttachment $attachment */ $attachment = $this->getAttachment($player); - $attachment->clearPermissions(); - $attachment->setPermissions($permissions); } } @@ -757,15 +675,12 @@ public function updatePlayersInGroup(PPGroup $group) public function unregisterPlayer(Player $player) { $this->getLogger()->debug($this->getMessage("logger_messages.unregisterPlayer", $player->getName())); - $uniqueId = $this->getValidUUID($player); - // Do not try to remove attachments with invalid unique ids if($uniqueId !== null) { if(isset($this->attachments[$uniqueId])) $player->removeAttachment($this->attachments[$uniqueId]); - unset($this->attachments[$uniqueId]); } } From 237a7f86d51cd92fa302b3067cb27162108b540f Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 07:30:23 -0800 Subject: [PATCH 07/46] Removed pointless extra lines (part 1) --- src/_64FF00/PurePerms/Noeul/NoeulAPI.php | 17 ----------------- .../PurePerms/Task/PPExpDateCheckTask.php | 4 +--- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/_64FF00/PurePerms/Noeul/NoeulAPI.php b/src/_64FF00/PurePerms/Noeul/NoeulAPI.php index 54ef511d..67b73e16 100644 --- a/src/_64FF00/PurePerms/Noeul/NoeulAPI.php +++ b/src/_64FF00/PurePerms/Noeul/NoeulAPI.php @@ -50,19 +50,15 @@ public function __construct(PurePerms $plugin) public function auth(Player $player) { // TODO - if($this->isAuthed($player)) return true; if(isset($this->needAuth[spl_object_hash($player)])) { $attachment = $this->needAuth[spl_object_hash($player)]; - $player->removeAttachment($attachment); - unset($this->needAuth[spl_object_hash($player)]); } - $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.successfully_logged_in")); return true; @@ -75,13 +71,9 @@ public function auth(Player $player) public function deAuth(Player $player) { $attachment = $player->addAttachment($this->plugin); - $this->removePermissions($attachment); - $this->needAuth[spl_object_hash($player)] = $attachment; - $this->sendAuthMsg($player); - return true; } @@ -139,9 +131,7 @@ public function register(IPlayer $player, $password) if(!$this->isRegistered($player)) { $hash = $this->hash($password); - $this->plugin->getUserDataMgr()->setNode($player, 'noeulPW', $hash); - return true; } @@ -154,17 +144,13 @@ public function register(IPlayer $player, $password) private function removePermissions(PermissionAttachment $attachment) { $permissions = []; - foreach(PermissionManager::getInstance()->getPermissions() as $permission) { $permissions[$permission->getName()] = false; } - $permissions["pocketmine.command.help"] = true; $permissions["pperms.noeul.ppsudo"] = true; - ksort($permissions); - $attachment->setPermissions($permissions); } @@ -175,7 +161,6 @@ public function sendAuthMsg(Player $player) { $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_01", self::NOEUL_VERSION)); $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_02")); - $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_03")); } @@ -188,10 +173,8 @@ public function unregister(IPlayer $player) if($this->isRegistered($player)) { $this->plugin->getUserDataMgr()->removeNode($player, 'noeulPW'); - return true; } - return false; } } \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php b/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php index 9fe12b13..9848cabb 100644 --- a/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php +++ b/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php @@ -39,11 +39,9 @@ public function onRun():void if(time() === $this->plugin->getUserDataMgr()->getNode($player, "expTime")) { $levelName = $this->plugin->getConfigValue("enable-multiworld-perms") ? $player->getWorld()->getDisplayName() : null; - $event = new PPRankExpiredEvent($this->plugin, $player, $levelName); - $event->call(); } } } -} \ No newline at end of file +} From ece7ef4877288b29b88b6192d898fe249e53ae90 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 07:47:00 -0800 Subject: [PATCH 08/46] Changed values from level to World --- src/_64FF00/PurePerms/Commands/DefGroup.php | 10 +- src/_64FF00/PurePerms/Commands/GrpInfo.php | 10 +- src/_64FF00/PurePerms/Commands/ListGPerms.php | 12 +- src/_64FF00/PurePerms/Commands/ListUPerms.php | 12 +- src/_64FF00/PurePerms/Commands/SetGPerm.php | 12 +- src/_64FF00/PurePerms/Commands/SetGroup.php | 18 ++- src/_64FF00/PurePerms/Commands/SetUPerm.php | 12 +- src/_64FF00/PurePerms/Commands/UnsetGPerm.php | 12 +- src/_64FF00/PurePerms/Commands/UnsetUPerm.php | 12 +- src/_64FF00/PurePerms/Commands/UsrInfo.php | 12 +- .../PurePerms/DataManager/UserDataManager.php | 76 ++++++------- src/_64FF00/PurePerms/PPGroup.php | 105 +++++++++--------- src/_64FF00/PurePerms/PurePerms.php | 63 ++++++----- .../PurePerms/Task/PPExpDateCheckTask.php | 4 +- 14 files changed, 183 insertions(+), 187 deletions(-) diff --git a/src/_64FF00/PurePerms/Commands/DefGroup.php b/src/_64FF00/PurePerms/Commands/DefGroup.php index 962967e8..291de22d 100644 --- a/src/_64FF00/PurePerms/Commands/DefGroup.php +++ b/src/_64FF00/PurePerms/Commands/DefGroup.php @@ -64,19 +64,19 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.group_not_exist", $args[0])); return true; } - $levelName = null; + $WorldName = null; if(isset($args[1])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); - if($level === null) + $World = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); + if($World === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.level_not_exist", $args[1])); return true; } - $levelName = $level->getDisplayName(); + $WorldName = $World->getDisplayName(); } - $this->plugin->setDefaultGroup($group, $levelName); + $this->plugin->setDefaultGroup($group, $WorldName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.defgroup_successfully", $args[0])); return true; diff --git a/src/_64FF00/PurePerms/Commands/GrpInfo.php b/src/_64FF00/PurePerms/Commands/GrpInfo.php index 59aa0f5d..822d8bae 100644 --- a/src/_64FF00/PurePerms/Commands/GrpInfo.php +++ b/src/_64FF00/PurePerms/Commands/GrpInfo.php @@ -64,22 +64,22 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.group_not_exist", $args[0])); return true; } - $levelName = null; + $WorldName = null; if(isset($args[1])) { - $level = $this->plugin->getServer()->getLevelByName($args[1]); - if($level === null) + $World = $this->plugin->getServer()->getLevelByName($args[1]); + if($World === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.level_not_exist", $args[1])); return true; } - $levelName = $level->getName(); + $WorldName = $World->getName(); } $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_header", $group->getName())); $alias = TextFormat::DARK_GREEN . $group->getAlias(); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_alias", $alias)); - $isDefault = $group->isDefault($levelName) ? TextFormat::DARK_GREEN . "YES" : TextFormat::RED . "NO"; + $isDefault = $group->isDefault($WorldName) ? TextFormat::DARK_GREEN . "YES" : TextFormat::RED . "NO"; $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_default", $isDefault)); $result = TextFormat::DARK_GREEN . "..."; diff --git a/src/_64FF00/PurePerms/Commands/ListGPerms.php b/src/_64FF00/PurePerms/Commands/ListGPerms.php index d644fbb8..f41e1492 100644 --- a/src/_64FF00/PurePerms/Commands/ListGPerms.php +++ b/src/_64FF00/PurePerms/Commands/ListGPerms.php @@ -64,20 +64,20 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_not_exist", $args[0])); return true; } - - $levelName = null; + + $WorldName = null; if(isset($args[2])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level == null) + $World = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + if($World == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); return true; } - $levelName = $level->getDisplayName(); + $WorldName = $World->getDisplayName(); } - $permissions = $group->getGroupPermissions($levelName); + $permissions = $group->getGroupPermissions($WorldName); if(empty($permissions)) { diff --git a/src/_64FF00/PurePerms/Commands/ListUPerms.php b/src/_64FF00/PurePerms/Commands/ListUPerms.php index 4ee03f18..5ac32d26 100644 --- a/src/_64FF00/PurePerms/Commands/ListUPerms.php +++ b/src/_64FF00/PurePerms/Commands/ListUPerms.php @@ -59,20 +59,20 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $player = $this->plugin->getPlayer($args[0]); - $levelName = null; + $WorldName = null; if(isset($args[2])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level == null) + $World = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + if($World == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); return true; } - - $levelName = $level->getDisplayName(); + + $WorldName = $World->getDisplayName(); } - $permissions = $this->plugin->getUserDataMgr()->getUserPermissions($player, $levelName); + $permissions = $this->plugin->getUserDataMgr()->getUserPermissions($player, $WorldName); if(empty($permissions)) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.no_user_perms", $player->getName())); diff --git a/src/_64FF00/PurePerms/Commands/SetGPerm.php b/src/_64FF00/PurePerms/Commands/SetGPerm.php index ed87d405..5dac4341 100644 --- a/src/_64FF00/PurePerms/Commands/SetGPerm.php +++ b/src/_64FF00/PurePerms/Commands/SetGPerm.php @@ -68,20 +68,20 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $permission = $args[1]; - $levelName = null; + $WorldName = null; if(isset($args[2])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level === null) + $World = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + if($World === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); return true; } - - $levelName = $level->getDisplayName(); + + $WorldName = $World->getDisplayName(); } - $group->setGroupPermission($permission, $levelName); + $group->setGroupPermission($permission, $WorldName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.gperm_added_successfully", $permission)); return true; } diff --git a/src/_64FF00/PurePerms/Commands/SetGroup.php b/src/_64FF00/PurePerms/Commands/SetGroup.php index a3c9ca1c..7b4b55ed 100644 --- a/src/_64FF00/PurePerms/Commands/SetGroup.php +++ b/src/_64FF00/PurePerms/Commands/SetGroup.php @@ -62,10 +62,8 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.usage")); return true; } - $player = $this->plugin->getPlayer($args[0]); $group = $this->plugin->getGroup($args[1]); - if($group === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.group_not_exist", $args[1])); @@ -75,17 +73,17 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $expTime = -1; if(isset($args[2])) $expTime = $this->plugin->date2Int($args[2]); - $levelName = null; + $WorldName = null; if(isset($args[3])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[3]); - if($level === null) + $world = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[3]); + if($world === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.level_not_exist", $args[3])); return true; } - - $levelName = $level->getDisplayName(); + + $WorldName = $world->getDisplayName(); } $superAdminRanks = $this->plugin->getConfigValue("superadmin-ranks"); @@ -102,7 +100,7 @@ public function execute(CommandSender $sender, string $label, array $args) : boo return true; } - $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $levelName); + $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $WorldName); if(isset($tmpSuperAdminRanks[$userGroup->getName()])) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_02", $userGroup->getName())); @@ -110,13 +108,13 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } } - $this->plugin->getUserDataMgr()->setGroup($player, $group, $levelName, $expTime); + $this->plugin->getUserDataMgr()->setGroup($player, $group, $WorldName, $expTime); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.setgroup_successfully", $player->getName())); if($player instanceof Player) { - if(!$this->plugin->getConfigValue("enable-multiworld-perms") || ($this->plugin->getConfigValue("enable-multiworld-perms") and $levelName === $player->getWorld()->getDisplayName())) + if(!$this->plugin->getConfigValue("enable-multiworld-perms") || ($this->plugin->getConfigValue("enable-multiworld-perms") and $WorldName === $player->getWorld()->getDisplayName())) $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.on_player_group_change", strtolower($group->getName()))); } diff --git a/src/_64FF00/PurePerms/Commands/SetUPerm.php b/src/_64FF00/PurePerms/Commands/SetUPerm.php index b409c984..6648f391 100644 --- a/src/_64FF00/PurePerms/Commands/SetUPerm.php +++ b/src/_64FF00/PurePerms/Commands/SetUPerm.php @@ -59,20 +59,20 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $player = $this->plugin->getPlayer($args[0]); $permission = $args[1]; - $levelName = null; + $WorldName = null; if(isset($args[2])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level === null) + $world = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + if($world === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.messages.level_not_exist", $args[2])); return true; } - - $levelName = $level->getDisplayName(); + + $WorldName = $world->getDisplayName(); } - $this->plugin->getUserDataMgr()->setPermission($player, $permission, $levelName); + $this->plugin->getUserDataMgr()->setPermission($player, $permission, $WorldName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setuperm.messages.uperm_added_successfully", $permission, $player->getName())); return true; } diff --git a/src/_64FF00/PurePerms/Commands/UnsetGPerm.php b/src/_64FF00/PurePerms/Commands/UnsetGPerm.php index 4dea60df..70f69aa0 100644 --- a/src/_64FF00/PurePerms/Commands/UnsetGPerm.php +++ b/src/_64FF00/PurePerms/Commands/UnsetGPerm.php @@ -68,20 +68,20 @@ public function execute(CommandSender $sender, string $label, array $args) : boo } $permission = $args[1]; - $levelName = null; + $WorldName = null; if(isset($args[2])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level == null) + $world = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + if($world == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); return true; } - - $levelName = $level->getDisplayName(); + + $WorldName = $world->getDisplayName(); } - $group->unsetGroupPermission($permission, $levelName); + $group->unsetGroupPermission($permission, $WorldName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.gperm_removed_successfully", $permission)); return true; diff --git a/src/_64FF00/PurePerms/Commands/UnsetUPerm.php b/src/_64FF00/PurePerms/Commands/UnsetUPerm.php index 67fdbbf9..4fb5014a 100644 --- a/src/_64FF00/PurePerms/Commands/UnsetUPerm.php +++ b/src/_64FF00/PurePerms/Commands/UnsetUPerm.php @@ -59,20 +59,20 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $player = $this->plugin->getPlayer($args[0]); $permission = $args[1]; - $levelName = null; + $WorldName = null; if(isset($args[2])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($level === null) + $world = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); + if($world === null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); return true; } - - $levelName = $level->getDisplayName(); + + $WorldName = $world->getDisplayName(); } - $this->plugin->getUserDataMgr()->unsetPermission($player, $permission, $levelName); + $this->plugin->getUserDataMgr()->unsetPermission($player, $permission, $WorldName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetuperm.messages.uperm_removed_successfully", $permission, $player->getName())); return true; } diff --git a/src/_64FF00/PurePerms/Commands/UsrInfo.php b/src/_64FF00/PurePerms/Commands/UsrInfo.php index c9389728..34eeebb4 100644 --- a/src/_64FF00/PurePerms/Commands/UsrInfo.php +++ b/src/_64FF00/PurePerms/Commands/UsrInfo.php @@ -61,18 +61,18 @@ public function execute(CommandSender $sender, string $label, array $args) : boo return true; } $player = $this->plugin->getPlayer($args[0]); - $levelName = null; + $WorldName = null; if(isset($args[1])) { - $level = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); + $world = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); - if($level == null) + if($world == null) { $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.level_not_exist", $args[1])); return true; } - $levelName = $level->getDisplayName(); + $WorldName = $world->getDisplayName(); } $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_header", $player->getName())); @@ -82,9 +82,9 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_ip", $ip)); $uuid = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getUniqueId()->toString() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_uuid", $uuid)); - $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $levelName); + $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $WorldName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_group", TextFormat::DARK_GREEN . $userGroup->getName())); - $expDate = $this->plugin->getUserDataMgr()->getExpDate($player, $levelName); + $expDate = $this->plugin->getUserDataMgr()->getExpDate($player, $WorldName); $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_exp", TextFormat::DARK_GREEN . $expDate)); return true; diff --git a/src/_64FF00/PurePerms/DataManager/UserDataManager.php b/src/_64FF00/PurePerms/DataManager/UserDataManager.php index 1b348e3d..01481301 100644 --- a/src/_64FF00/PurePerms/DataManager/UserDataManager.php +++ b/src/_64FF00/PurePerms/DataManager/UserDataManager.php @@ -40,29 +40,29 @@ public function getData(IPlayer $player) return $this->plugin->getProvider()->getPlayerData($player); } - public function getExpDate(IPlayer $player, $levelName = null) + public function getExpDate(IPlayer $player, $WorldName = null) { - $expDate = $levelName !== null ? $this->getWorldData($player, $levelName)["expTime"] : $this->getNode($player, "expTime"); + $expDate = $WorldName !== null ? $this->getWorldData($player, $WorldName)["expTime"] : $this->getNode($player, "expTime"); // TODO return $expDate; } /** * @param IPlayer $player - * @param null $levelName + * @param null $WorldName * @return PPGroup|null */ - public function getGroup(IPlayer $player, $levelName = null) + public function getGroup(IPlayer $player, $WorldName = null) { - $groupName = $levelName !== null ? $this->getWorldData($player, $levelName)["group"] : $this->getNode($player, "group"); + $groupName = $WorldName !== null ? $this->getWorldData($player, $WorldName)["group"] : $this->getNode($player, "group"); $group = $this->plugin->getGroup($groupName); // TODO: ... if($group === null) { - $this->plugin->getLogger()->critical("Invalid group name found in " . $player->getName() . "'s player data (World: " . ($levelName === null ? "GLOBAL" : $levelName) . ")"); + $this->plugin->getLogger()->critical("Invalid group name found in " . $player->getName() . "'s player data (World: " . ($WorldName === null ? "GLOBAL" : $WorldName) . ")"); $this->plugin->getLogger()->critical("Restoring the group data to 'default'"); - $defaultGroup = $this->plugin->getDefaultGroup($levelName); - $this->setGroup($player, $defaultGroup, $levelName); + $defaultGroup = $this->plugin->getDefaultGroup($WorldName); + $this->setGroup($player, $defaultGroup, $WorldName); return $defaultGroup; } @@ -83,12 +83,12 @@ public function getNode(IPlayer $player, $node) } /** - * @param null $levelName + * @param null $WorldName * @return array */ - public function getUserPermissions(IPlayer $player, $levelName = null) + public function getUserPermissions(IPlayer $player, $WorldName = null) { - $permissions = $levelName != null ? $this->getWorldData($player, $levelName)["permissions"] : $this->getNode($player, "permissions"); + $permissions = $WorldName != null ? $this->getWorldData($player, $WorldName)["permissions"] : $this->getNode($player, "permissions"); if(!is_array($permissions)) { $this->plugin->getLogger()->critical("Invalid 'permissions' node given to " . __METHOD__ . '()'); @@ -99,21 +99,21 @@ public function getUserPermissions(IPlayer $player, $levelName = null) /** * @param IPlayer $player - * @param $levelName + * @param $WorldName * @return array */ - public function getWorldData(IPlayer $player, $levelName) + public function getWorldData(IPlayer $player, $WorldName) { - if($levelName === null) - $levelName = $this->plugin->getServer()->getWorldManager()->getDefaultWorld()->getDisplayName(); - if(!isset($this->getData($player)["worlds"][$levelName])) + if($WorldName === null) + $WorldName = $this->plugin->getServer()->getWorldManager()->getDefaultWorld()->getDisplayName(); + if(!isset($this->getData($player)["worlds"][$WorldName])) return [ - "group" => $this->plugin->getDefaultGroup($levelName)->getName(), + "group" => $this->plugin->getDefaultGroup($WorldName)->getName(), "permissions" => [ ], "expTime" => -1 ]; - return $this->getData($player)["worlds"][$levelName]; + return $this->getData($player)["worlds"][$WorldName]; } public function removeNode(IPlayer $player, $node) @@ -138,25 +138,25 @@ public function setData(IPlayer $player, array $data) /** * @param IPlayer $player * @param PPGroup $group - * @param $levelName + * @param $WorldName * @param int $time */ - public function setGroup(IPlayer $player, PPGroup $group, $levelName, $time = -1) + public function setGroup(IPlayer $player, PPGroup $group, $WorldName, $time = -1) { - if($levelName === null) + if($WorldName === null) { $this->setNode($player, "group", $group->getName()); $this->setNode($player, "expTime", $time); } else { - $worldData = $this->getWorldData($player, $levelName); + $worldData = $this->getWorldData($player, $WorldName); $worldData["group"] = $group->getName(); $worldData["expTime"] = $time; - $this->setWorldData($player, $levelName, $worldData); + $this->setWorldData($player, $WorldName, $worldData); } - $event = new PPGroupChangedEvent($this->plugin, $player, $group, $levelName); + $event = new PPGroupChangedEvent($this->plugin, $player, $group, $WorldName); $event->call(); } @@ -176,11 +176,11 @@ public function setNode(IPlayer $player, $node, $value) /** * @param IPlayer $player * @param $permission - * @param null $levelName + * @param null $WorldName */ - public function setPermission(IPlayer $player, $permission, $levelName = null) + public function setPermission(IPlayer $player, $permission, $WorldName = null) { - if($levelName === null) + if($WorldName === null) { $tempUserData = $this->getData($player); $tempUserData["permissions"][] = $permission; @@ -188,20 +188,20 @@ public function setPermission(IPlayer $player, $permission, $levelName = null) } else { - $worldData = $this->getWorldData($player, $levelName); + $worldData = $this->getWorldData($player, $WorldName); $worldData["permissions"][] = $permission; - $this->setWorldData($player, $levelName, $worldData); + $this->setWorldData($player, $WorldName, $worldData); } $this->plugin->updatePermissions($player); } - public function setWorldData(IPlayer $player, $levelName, array $worldData) + public function setWorldData(IPlayer $player, $WorldName, array $worldData) { $tempUserData = $this->getData($player); - if(!isset($this->getData($player)["worlds"][$levelName])) + if(!isset($this->getData($player)["worlds"][$WorldName])) { - $tempUserData["worlds"][$levelName] = [ + $tempUserData["worlds"][$WorldName] = [ "group" => $this->plugin->getDefaultGroup()->getName(), "permissions" => [ ], @@ -210,18 +210,18 @@ public function setWorldData(IPlayer $player, $levelName, array $worldData) $this->setData($player, $tempUserData); } - $tempUserData["worlds"][$levelName] = $worldData; + $tempUserData["worlds"][$WorldName] = $worldData; $this->setData($player, $tempUserData); } /** * @param IPlayer $player * @param $permission - * @param null $levelName + * @param null $WorldName */ - public function unsetPermission(IPlayer $player, $permission, $levelName = null) + public function unsetPermission(IPlayer $player, $permission, $WorldName = null) { - if($levelName === null) + if($WorldName === null) { $tempUserData = $this->getData($player); if(!in_array($permission, $tempUserData["permissions"])) return; @@ -230,10 +230,10 @@ public function unsetPermission(IPlayer $player, $permission, $levelName = null) } else { - $worldData = $this->getWorldData($player, $levelName); + $worldData = $this->getWorldData($player, $WorldName); if(!in_array($permission, $worldData["permissions"])) return; $worldData["permissions"] = array_diff($worldData["permissions"], [$permission]); - $this->setWorldData($player, $levelName, $worldData); + $this->setWorldData($player, $WorldName, $worldData); } $this->plugin->updatePermissions($player); diff --git a/src/_64FF00/PurePerms/PPGroup.php b/src/_64FF00/PurePerms/PPGroup.php index 91d3f940..47d59c51 100644 --- a/src/_64FF00/PurePerms/PPGroup.php +++ b/src/_64FF00/PurePerms/PPGroup.php @@ -54,15 +54,15 @@ public function addParent(PPGroup $group) } /** - * @param $levelName + * @param $WorldName */ - public function createWorldData($levelName) + public function createWorldData($WorldName) { - if(!isset($this->getData()["worlds"][$levelName])) + if(!isset($this->getData()["worlds"][$WorldName])) { $tempGroupData = $this->getData(); - $tempGroupData["worlds"][$levelName] = [ + $tempGroupData["worlds"][$WorldName] = [ "isDefault" => false, "permissions" => [ ] @@ -90,12 +90,12 @@ public function getData() } /** - * @param null $levelName + * @param null $WorldName * @return array */ - public function getGroupPermissions($levelName = null) + public function getGroupPermissions($WorldName = null) { - $permissions = $levelName !== null ? $this->getWorldData($levelName)["permissions"] : $this->getNode("permissions"); + $permissions = $WorldName !== null ? $this->getWorldData($WorldName)["permissions"] : $this->getNode("permissions"); if(!is_array($permissions)) { $this->plugin->getLogger()->critical("Invalid 'permissions' node given to " . __METHOD__); @@ -105,7 +105,7 @@ public function getGroupPermissions($levelName = null) /** @var PPGroup $parentGroup */ foreach($this->getParentGroups() as $parentGroup) { - $parentPermissions = $parentGroup->getGroupPermissions($levelName); + $parentPermissions = $parentGroup->getGroupPermissions($WorldName); if($parentPermissions === null) $parentPermissions = []; // Fixed by @mad-hon (https://github.com/mad-hon) / Tysm! :D @@ -157,41 +157,41 @@ public function getParentGroups() } /** - * @param $levelName + * @param $WorldName * @return null */ - public function getWorldData($levelName) + public function getWorldData($WorldName) { - if($levelName === null) + if($WorldName === null) return null; - $this->createWorldData($levelName); - return $this->getData()["worlds"][$levelName]; + $this->createWorldData($WorldName); + return $this->getData()["worlds"][$WorldName]; } /** - * @param $levelName + * @param $WorldName * @param $node * @return null */ - public function getWorldNode($levelName, $node) + public function getWorldNode($WorldName, $node) { - if(!isset($this->getWorldData($levelName)[$node])) return null; - return $this->getWorldData($levelName)[$node]; + if(!isset($this->getWorldData($WorldName)[$node])) return null; + return $this->getWorldData($WorldName)[$node]; } /** - * @param null $levelName + * @param null $WorldName * @return bool */ - public function isDefault($levelName = null) + public function isDefault($WorldName = null) { - if($levelName === null) + if($WorldName === null) { return ($this->getNode("isDefault") === true); } else { - return ($this->getWorldData($levelName)["isDefault"] === true); + return ($this->getWorldData($WorldName)["isDefault"] === true); } } @@ -224,16 +224,16 @@ public function removeParent(PPGroup $group) } /** - * @param $levelName + * @param $WorldName * @param $node */ - public function removeWorldNode($levelName, $node) + public function removeWorldNode($WorldName, $node) { - $worldData = $this->getWorldData($levelName); + $worldData = $this->getWorldData($WorldName); if(isset($worldData[$node])) { unset($worldData[$node]); - $this->setWorldData($levelName, $worldData); + $this->setWorldData($WorldName, $worldData); } } @@ -246,31 +246,31 @@ public function setData(array $data) } /** - * @param null $levelName + * @param null $WorldName */ - public function setDefault($levelName = null) + public function setDefault($WorldName = null) { - if($levelName === null) + if($WorldName === null) { $this->setNode("isDefault", true); } else { - $worldData = $this->getWorldData($levelName); + $worldData = $this->getWorldData($WorldName); $worldData["isDefault"] = true; - $this->setWorldData($levelName, $worldData); + $this->setWorldData($WorldName, $worldData); } } /** * @param string $permission - * @param string|null $levelName + * @param string|null $WorldName * * @return bool */ - public function setGroupPermission($permission, $levelName = null) + public function setGroupPermission($permission, $WorldName = null) { - if($levelName == null) + if($WorldName == null) { $tempGroupData = $this->getData(); $tempGroupData["permissions"][] = $permission; @@ -278,9 +278,9 @@ public function setGroupPermission($permission, $levelName = null) } else { - $worldData = $this->getWorldData($levelName); + $worldData = $this->getWorldData($WorldName); $worldData["permissions"][] = $permission; - $this->setWorldData($levelName, $worldData); + $this->setWorldData($WorldName, $worldData); } $this->plugin->updatePlayersInGroup($this); @@ -299,29 +299,29 @@ public function setNode($node, $value) } /** - * @param $levelName + * @param $WorldName * @param array $worldData */ - public function setWorldData($levelName, array $worldData) + public function setWorldData($WorldName, array $worldData) { - if(isset($this->getData()["worlds"][$levelName])) + if(isset($this->getData()["worlds"][$WorldName])) { $tempGroupData = $this->getData(); - $tempGroupData["worlds"][$levelName] = $worldData; + $tempGroupData["worlds"][$WorldName] = $worldData; $this->setData($tempGroupData); } } /** - * @param $levelName + * @param $WorldName * @param $node * @param $value */ - public function setWorldNode($levelName, $node, $value) + public function setWorldNode($WorldName, $node, $value) { - $worldData = $this->getWorldData($levelName); + $worldData = $this->getWorldData($WorldName); $worldData[$node] = $value; - $this->setWorldData($levelName, $worldData); + $this->setWorldData($WorldName, $worldData); } public function sortPermissions() @@ -336,17 +336,16 @@ public function sortPermissions() $isMultiWorldPermsEnabled = $this->plugin->getConfigValue("enable-multiworld-perms"); if($isMultiWorldPermsEnabled and isset($tempGroupData["worlds"])) { - foreach($this->plugin->getServer()->getWorldManager()->getWorlds() as $level) + foreach($this->plugin->getServer()->getWorldManager()->getWorlds() as $world) { - $levelName = $level->getDisplayName(); - if(isset($tempGroupData["worlds"][$levelName])) + $WorldName = $world->getDisplayName(); + if(isset($tempGroupData["worlds"][$WorldName])) { - $tempGroupData["worlds"][$levelName]["permissions"] = array_unique($tempGroupData["worlds"][$levelName]["permissions"]); - sort($tempGroupData["worlds"][$levelName]["permissions"]); + $tempGroupData["worlds"][$WorldName]["permissions"] = array_unique($tempGroupData["worlds"][$WorldName]["permissions"]); + sort($tempGroupData["worlds"][$WorldName]["permissions"]); } } } - $this->setData($tempGroupData); } @@ -355,9 +354,9 @@ public function sortPermissions() * @param null $levelName * @return bool */ - public function unsetGroupPermission($permission, $levelName = null) + public function unsetGroupPermission($permission, $WorldName = null) { - if($levelName == null) + if($WorldName == null) { $tempGroupData = $this->getData(); if(!in_array($permission, $tempGroupData["permissions"])) return false; @@ -366,10 +365,10 @@ public function unsetGroupPermission($permission, $levelName = null) } else { - $worldData = $this->getWorldData($levelName); + $worldData = $this->getWorldData($WorldName); if(!in_array($permission, $worldData["permissions"])) return false; $worldData["permissions"] = array_diff($worldData["permissions"], [$permission]); - $this->setWorldData($levelName, $worldData); + $this->setWorldData($WorldName, $worldData); } $this->plugin->updatePlayersInGroup($this); return true; diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 99440af9..a36c79b2 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -272,15 +272,15 @@ public function getConfigValue($key) } /** - * @param null $levelName + * @param null $WorldName * @return PPGroup|null */ - public function getDefaultGroup($levelName = null) + public function getDefaultGroup($WorldName = null) { $defaultGroups = []; foreach($this->getGroups() as $defaultGroup) { - if($defaultGroup->isDefault($levelName)) + if($defaultGroup->isDefault($WorldName)) $defaultGroups[] = $defaultGroup; } @@ -305,7 +305,7 @@ public function getDefaultGroup($levelName = null) { if(count($tempGroup->getParentGroups()) === 0) { - $this->setDefaultGroup($tempGroup, $levelName); + $this->setDefaultGroup($tempGroup, $WorldName); return $tempGroup; } @@ -377,10 +377,10 @@ public function getOnlinePlayersInGroup(PPGroup $group) $users = []; foreach($this->getServer()->getOnlinePlayers() as $player) { - foreach($this->getServer()->getWorldManager()->getWorlds() as $level) + foreach($this->getServer()->getWorldManager()->getWorlds() as $World) { - $levelName = $level->getDisplayName(); - if($this->userDataMgr->getGroup($player, $levelName) === $group) + $WorldName = $World->getDisplayName(); + if($this->userDataMgr->getGroup($player, $WorldName) === $group) $users[] = $player; } } @@ -390,15 +390,15 @@ public function getOnlinePlayersInGroup(PPGroup $group) /** * @param IPlayer $player - * @param $levelName + * @param $WorldName * @return array */ - public function getPermissions(IPlayer $player, $levelName) + public function getPermissions(IPlayer $player, $WorldName) { // TODO: Fix this - $group = $this->userDataMgr->getGroup($player, $levelName); - $groupPerms = $group->getGroupPermissions($levelName); - $userPerms = $this->userDataMgr->getUserPermissions($player, $levelName); + $group = $this->userDataMgr->getGroup($player, $WorldName); + $groupPerms = $group->getGroupPermissions($WorldName); + $userPerms = $this->userDataMgr->getUserPermissions($player, $WorldName); return array_merge($groupPerms, $userPerms); } @@ -545,13 +545,13 @@ public function removeGroup($groupName) /** * @param PPGroup $group - * @param $levelName + * @param $WorldName */ - public function setDefaultGroup(PPGroup $group, $levelName = null) + public function setDefaultGroup(PPGroup $group, $WorldName = null) { foreach($this->getGroups() as $currentGroup) { - if($levelName === null) + if($WorldName === null) { $isDefault = $currentGroup->getNode("isDefault"); @@ -560,24 +560,24 @@ public function setDefaultGroup(PPGroup $group, $levelName = null) } else { - $isDefault = $currentGroup->getWorldNode($levelName, "isDefault"); + $isDefault = $currentGroup->getWorldNode($WorldName, "isDefault"); if($isDefault) - $currentGroup->removeWorldNode($levelName, "isDefault"); + $currentGroup->removeWorldNode($WorldName, "isDefault"); } } - $group->setDefault($levelName); + $group->setDefault($WorldName); } /** * @param IPlayer $player * @param PPGroup $group - * @param null $levelName + * @param null $WorldName * @param int $time */ - public function setGroup(IPlayer $player, PPGroup $group, $levelName = null, $time = -1) + public function setGroup(IPlayer $player, PPGroup $group, $WorldName = null, $time = -1) { - $this->userDataMgr->setGroup($player, $group, $levelName, $time); + $this->userDataMgr->setGroup($player, $group, $WorldName, $time); } public function sortGroupData() @@ -588,12 +588,11 @@ public function sortGroupData() if($this->getConfigValue("enable-multiworld-perms")) { - /** @var World $level */ - foreach($this->getServer()->getWorldManager()->getWorlds() as $level) + /** @var World $World */ + foreach($this->getServer()->getWorldManager()->getWorlds() as $World) { - $levelName = $level->getDisplayName(); - - $ppGroup->createWorldData($levelName); + $WorldName = $World->getDisplayName(); + $ppGroup->createWorldData($WorldName); } } } @@ -617,20 +616,20 @@ public function updateGroups() /** * @param IPlayer $player - * @param string|null $levelName + * @param string|null $WorldName */ - public function updatePermissions(IPlayer $player, string $levelName = null) + public function updatePermissions(IPlayer $player, string $WorldName = null) { if($player instanceof Player) { if($this->getConfigValue("enable-multiworld-perms") == null) { - $levelName = null; - }elseif($levelName == null) { - $levelName = $player->getWorld()->getDisplayName(); + $WorldName = null; + }elseif($WorldName == null) { + $WorldName = $player->getWorld()->getDisplayName(); } $permissions = []; /** @var string $permission */ - foreach($this->getPermissions($player, $levelName) as $permission) + foreach($this->getPermissions($player, $WorldName) as $permission) { if($permission === '*') { diff --git a/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php b/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php index 9848cabb..c7ee4cba 100644 --- a/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php +++ b/src/_64FF00/PurePerms/Task/PPExpDateCheckTask.php @@ -38,8 +38,8 @@ public function onRun():void { if(time() === $this->plugin->getUserDataMgr()->getNode($player, "expTime")) { - $levelName = $this->plugin->getConfigValue("enable-multiworld-perms") ? $player->getWorld()->getDisplayName() : null; - $event = new PPRankExpiredEvent($this->plugin, $player, $levelName); + $WorldName = $this->plugin->getConfigValue("enable-multiworld-perms") ? $player->getWorld()->getDisplayName() : null; + $event = new PPRankExpiredEvent($this->plugin, $player, $WorldName); $event->call(); } } From 22ddd183a2bc288c3a78cf886149d0932602af4b Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 07:58:55 -0800 Subject: [PATCH 09/46] Renamed YAMLv1 to YAML --- resources/config.yml | 5 +++-- resources/messages-cz.yml | 3 +-- resources/messages-de.yml | 3 +-- resources/messages-en.yml | 3 +-- resources/messages-id.yml | 3 +-- resources/messages-it.yml | 3 +-- resources/messages-jp.yml | 3 +-- resources/messages-ko.yml | 3 +-- resources/messages-ru.yml | 3 +-- resources/messages-sk.yml | 3 +-- resources/messages-sp.yml | 3 +-- resources/messages-tr.yml | 3 +-- resources/messages-ua.yml | 3 +-- .../{YamlV1Provider.php => YamlProvider.php} | 2 +- src/_64FF00/PurePerms/PurePerms.php | 13 ++++--------- 15 files changed, 20 insertions(+), 36 deletions(-) rename src/_64FF00/PurePerms/DataProviders/{YamlV1Provider.php => YamlProvider.php} (99%) diff --git a/resources/config.yml b/resources/config.yml index 4aaac929..ae5cc65e 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -5,8 +5,9 @@ --- # Set default data provider for PurePerms -# - mysql, yamlv1, yamlv2 -data-provider: yamlv1 +# - mysql (MYSQL Database) +# - yaml (YAML Database) +data-provider: yml # Set the default language for PurePerms (<3) # - en, ko, jp, ru, ua, it, sp, cz, sk, de, idn, tr diff --git a/resources/messages-cz.yml b/resources/messages-cz.yml index 09b68963..97dfbbcf 100644 --- a/resources/messages-cz.yml +++ b/resources/messages-cz.yml @@ -163,8 +163,7 @@ logger_messages: onLoad_03: "Podpora Multisveta povolena." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Nastavte poskytovatele dat do MySQL." - setProvider_YAMLv1: "Nastavte poskytovatele dat na YAMLv1." - setProvider_YAMLv2: "Nastavte poskytovatele dat na YAMLv2." + setProvider_YAML: "Nastavte poskytovatele dat na YAML" setProvider_NotFound: "Poskytovatel %var0% neexistuje. Nastavuji zprostredkovatele dat na vychozi nastaveni." unregisterPlayer: "Unregistering player %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-de.yml b/resources/messages-de.yml index 87951b0d..6aee3828 100644 --- a/resources/messages-de.yml +++ b/resources/messages-de.yml @@ -163,8 +163,7 @@ logger_messages: onLoad_03: "Unterstützung für mehrere Welten ist aktiviert." registerPlayer: "Spieler %var0% wird angemeldet" setProvider_MySQL: "Datenprovider wird auf MySQL gesetzt." - setProvider_YAMLv1: "Datenprovider wird auf YAMLv1 gesetzt." - setProvider_YAMLv2: "Datenprovider wird auf YAMLv2 gesetzt." + setProvider_YAML: "Datenprovider wird auf YAML gesetzt." setProvider_NotFound: "Provider %var0% existiert NICHT. Datenprovider wird auf Standard zurückgesetzt." unregisterPlayer: "Spieler %var0% wird abgemeldet" YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-en.yml b/resources/messages-en.yml index e74e6291..a30adbb8 100644 --- a/resources/messages-en.yml +++ b/resources/messages-en.yml @@ -161,8 +161,7 @@ logger_messages: onLoad_03: "Multiworld support enabled." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Set data provider to MySQL." - setProvider_YAMLv1: "Set data provider to YAMLv1." - setProvider_YAMLv2: "Set data provider to YAMLv2." + setProvider_YAML: "Set data provider to YAML." setProvider_NotFound: "Provider %var0% does NOT exist. Setting the data provider to default." unregisterPlayer: "Unregistering player %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-id.yml b/resources/messages-id.yml index 5e07e67e..bab4e6af 100644 --- a/resources/messages-id.yml +++ b/resources/messages-id.yml @@ -164,8 +164,7 @@ logger_messages: onLoad_03: "Akses Multiworld diaktifkan." registerPlayer: "Mendaftarkan Pemain %var0%..." setProvider_MySQL: "Set data provider ke MySQL." - setProvider_YAMLv1: "Set data provider ke YAMLv1." - setProvider_YAMLv2: "Set data provider ke YAMLv2." + setProvider_YAML: "Set data provider ke YAML" setProvider_NotFound: "Provider %var0% tidak ada. Set data provider ke default." unregisterPlayer: "Menghapus pemain %var0% dari daftar..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-it.yml b/resources/messages-it.yml index 8c72da75..aa7cb1a2 100644 --- a/resources/messages-it.yml +++ b/resources/messages-it.yml @@ -163,8 +163,7 @@ logger_messages: onLoad_03: "Il supporto multimondo è abilitato." registerPlayer: "Registrando giocatore %var0%..." setProvider_MySQL: "Il fornitore dati impostato è MySQL." - setProvider_YAMLv1: "Il fornitore dati impostato è YAMLv1." - setProvider_YAMLv2: "Il fornitore dati impostato è YAMLv2." + setProvider_YAML: "Il fornitore dati impostato è YAML" setProvider_NotFound: "Il fornitore %var0% non esiste. Impostando il fornitore dati predefinito." unregisterPlayer: "Togliendo la registrazione al giocatore %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-jp.yml b/resources/messages-jp.yml index e378f4c1..8b7bc766 100644 --- a/resources/messages-jp.yml +++ b/resources/messages-jp.yml @@ -162,8 +162,7 @@ logger_messages: onLoad_03: "マルチワールド対応が有効です。" registerPlayer: "プレイヤーを%var0%に登録しています..." setProvider_MySQL: "MYSQLにデーター管理方式が設定されました。" - setProvider_YAMLv1: "YAMLv1にデーター管理方式が設定されました。" - setProvider_YAMLv2: "YAMLv2にデーター管理方式が設定されました。" + setProvider_YAML: "YAMLv1にデーター管理方式が設定されました。" setProvider_NotFound: "データー管理方式%var0%は存在しません。デフォルトの方式に設定しました。" unregisterPlayer: "プレイヤーを%var0%から解除してます..." YAMLProvider_InvalidGroupsSettings: "GROUPS.YMLの設定が間違っています: groups.yml が無効、または壊れているかどうかに確認してください。" diff --git a/resources/messages-ko.yml b/resources/messages-ko.yml index 8c910068..089aedcd 100644 --- a/resources/messages-ko.yml +++ b/resources/messages-ko.yml @@ -164,8 +164,7 @@ logger_messages: onLoad_03: "다중 월드 지원 기능이 활성화되었습니다." registerPlayer: "플레이어 %var0% 등록 중..." setProvider_MySQL: "MySQL 형식으로 데이터가 저장됩니다." - setProvider_YAMLv1: "YAMLv1 방식으로 데이터가 저장됩니다." - setProvider_YAMLv2: "YAMLv2 방식으로 데이터가 저장됩니다." + setProvider_YAML: "YAMLv1 방식으로 데이터가 저장됩니다." setProvider_Invalid: "올바르지 않은 데이터 저장 방식입니다. 자동으로 YAML 방식으로 데이터가 저장됩니다." unregisterPlayer: "플레이어 %var0% 등록 해제 중..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-ru.yml b/resources/messages-ru.yml index 2b9a14d8..aa00ff37 100644 --- a/resources/messages-ru.yml +++ b/resources/messages-ru.yml @@ -163,8 +163,7 @@ logger_messages: onLoad_03: "Поддержка мульти миров включена." registerPlayer: "Регистрация игрока %var0%..." setProvider_MySQL: "Тип хранилища данных - MySQL." - setProvider_YAMLv1: "Тип хранилища данных - YAMLv1." - setProvider_YAMLv2: "Тип хранилища данных - YAMLv2." + setProvider_YAML: "Тип хранилища данных - YAML" setProvider_NotFound: "Провайдер данных %var0% не существует. Устанавливается стандартный тип хранилища данных." unregisterPlayer: "Отмена регистрации игрока %var0%..." YAMLProvider_InvalidGroupsSettings: "недействительный GROUPS.YML НАСТРОЙКИ: Пожалуйста, проверьте, если у вас есть недопустимое или поврежден groups.yml." diff --git a/resources/messages-sk.yml b/resources/messages-sk.yml index 13444ac1..01098e59 100644 --- a/resources/messages-sk.yml +++ b/resources/messages-sk.yml @@ -163,8 +163,7 @@ logger_messages: onLoad_03: "Podpora Multisveta povolena." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Nastavte poskytovatela dat na MySQL." - setProvider_YAMLv1: "Nastavte poskytovatela dat na YAMLv1." - setProvider_YAMLv2: "Nastavte poskytovatela dat na YAMLv2." + setProvider_YAML: "Nastavte poskytovatela dat na YAML." setProvider_NotFound: "Poskytovatel %var0% nastavujem sprostredkovatela dat na predvolene nastavenia." unregisterPlayer: "Unregistering player %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-sp.yml b/resources/messages-sp.yml index 5e9fe5d0..49f2e915 100644 --- a/resources/messages-sp.yml +++ b/resources/messages-sp.yml @@ -165,8 +165,7 @@ logger_messages: onLoad_03: "El soporte multi-nivel ha sido activado." registerPlayer: "Registrando el Usuario %var0%..." setProvider_MySQL: "Utilizando MySQL como proveedor." - setProvider_YAMLv1: "Utilizando YAMLv1 como proveedor." - setProvider_YAMLv2: "Utilizando YAMLv2 como proveedor." + setProvider_YAML: "Utilizando YAML como proveedor." setProvider_NotFound: "El proveedor %var0% NO existe. Utilizando el proveedor predeterminado." unregisterPlayer: "DesRegistrando al Jugador %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-tr.yml b/resources/messages-tr.yml index a0d5047c..3e2e56f9 100644 --- a/resources/messages-tr.yml +++ b/resources/messages-tr.yml @@ -163,8 +163,7 @@ logger_messages: onLoad_03: "Multiworld desteği etkin." registerPlayer: "%var0% oyuncusu kayda geçirildi..." setProvider_MySQL: "Veri sağlayıcısı MySQL ayarlandı." - setProvider_YAMLv1: "Veri sağlayıcısı YAMLv1 ayarlandı." - setProvider_YAMLv2: "Veri sağlayıcısı YAMLv2 ayarlandı." + setProvider_YAML: "Veri sağlayıcısı YAML ayarlandı." setProvider_NotFound: "%var0% sağlayıcısı mevcut değil. Varsayılan veri sağlayıcısına değiştiriliyor." unregisterPlayer: "%var0% adlı oyuncunun kaydı siliniyor..." YAMLProvider_InvalidGroupsSettings: "BİLİNMEYEN GROUPS.YML AYARI: Lütfen groups.yml dosyasındaki geçersiz veya bozuk dosyaları kontrol edin." diff --git a/resources/messages-ua.yml b/resources/messages-ua.yml index f4915151..2a6a1c14 100644 --- a/resources/messages-ua.yml +++ b/resources/messages-ua.yml @@ -163,8 +163,7 @@ logger_messages: onLoad_03: "Поддержка декількох світів увімкнена." registerPlayer: "Реєстрація гравця %var0%..." setProvider_MySQL: "Тип сховища даних - MySQL." - setProvider_YAMLv1: "Тип сховища даних - YAMLv1." - setProvider_YAMLv2: "Тип сховища даних - YAMLv2." + setProvider_YAML: "Тип сховища даних - YAML." setProvider_NotFound: "Провайдер даних %var0% не існує. Встановлено стандартний тип сховища даних." unregisterPlayer: "Відміна реєстрації гравця %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php b/src/_64FF00/PurePerms/DataProviders/YamlProvider.php similarity index 99% rename from src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php rename to src/_64FF00/PurePerms/DataProviders/YamlProvider.php index e381c3d1..9f12862b 100644 --- a/src/_64FF00/PurePerms/DataProviders/YamlV1Provider.php +++ b/src/_64FF00/PurePerms/DataProviders/YamlProvider.php @@ -10,7 +10,7 @@ use pocketmine\utils\Config; use RuntimeException; -class YamlV1Provider implements ProviderInterface +class YamlProvider implements ProviderInterface { /* PurePerms by 64FF00 (Twitter: @64FF00) diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index a36c79b2..67d16919 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -26,7 +26,7 @@ use _64FF00\PurePerms\DataProviders\DefaultProvider; use _64FF00\PurePerms\DataProviders\MySQLProvider; use _64FF00\PurePerms\DataProviders\ProviderInterface; -use _64FF00\PurePerms\DataProviders\YamlV1Provider; +use _64FF00\PurePerms\DataProviders\YamlProvider; use _64FF00\PurePerms\Task\PPExpDateCheckTask; use pocketmine\permission\PermissionManager; @@ -172,15 +172,10 @@ private function setProvider($onEnable = true) $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_MySQL")); break; - case "yamlv1": - $provider = new YamlV1Provider($this); + case "yml": + $provider = new YamlProvider($this); if($onEnable === true) - $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_YAMLv1")); - break; - case "yamlv2": - $provider = new DefaultProvider($this); - if($onEnable === true) - $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_YAMLv2")); + $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_YAML")); break; default: $provider = new DefaultProvider($this); From 93b4d9c761b6587da4ebe1675697390e6dbac831 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 08:09:50 -0800 Subject: [PATCH 10/46] Changed from YML to JSON. --- resources/config.yml | 4 ++-- resources/messages-cz.yml | 2 +- resources/messages-de.yml | 2 +- resources/messages-en.yml | 2 +- resources/messages-id.yml | 2 +- resources/messages-it.yml | 2 +- resources/messages-jp.yml | 2 +- resources/messages-ko.yml | 2 +- resources/messages-ru.yml | 2 +- resources/messages-sk.yml | 2 +- resources/messages-sp.yml | 2 +- resources/messages-tr.yml | 2 +- resources/messages-ua.yml | 2 +- .../{YamlProvider.php => JsonProvider.php} | 12 ++++++------ src/_64FF00/PurePerms/PurePerms.php | 8 ++++---- 15 files changed, 24 insertions(+), 24 deletions(-) rename src/_64FF00/PurePerms/DataProviders/{YamlProvider.php => JsonProvider.php} (95%) diff --git a/resources/config.yml b/resources/config.yml index ae5cc65e..3d368872 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -6,8 +6,8 @@ --- # Set default data provider for PurePerms # - mysql (MYSQL Database) -# - yaml (YAML Database) -data-provider: yml +# - json (JSON Database) +data-provider: json # Set the default language for PurePerms (<3) # - en, ko, jp, ru, ua, it, sp, cz, sk, de, idn, tr diff --git a/resources/messages-cz.yml b/resources/messages-cz.yml index 97dfbbcf..280e63e6 100644 --- a/resources/messages-cz.yml +++ b/resources/messages-cz.yml @@ -163,7 +163,7 @@ logger_messages: onLoad_03: "Podpora Multisveta povolena." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Nastavte poskytovatele dat do MySQL." - setProvider_YAML: "Nastavte poskytovatele dat na YAML" + setProvider_JSON: "Nastavte poskytovatele dat na JSON" setProvider_NotFound: "Poskytovatel %var0% neexistuje. Nastavuji zprostredkovatele dat na vychozi nastaveni." unregisterPlayer: "Unregistering player %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-de.yml b/resources/messages-de.yml index 6aee3828..fff8bbc7 100644 --- a/resources/messages-de.yml +++ b/resources/messages-de.yml @@ -163,7 +163,7 @@ logger_messages: onLoad_03: "Unterstützung für mehrere Welten ist aktiviert." registerPlayer: "Spieler %var0% wird angemeldet" setProvider_MySQL: "Datenprovider wird auf MySQL gesetzt." - setProvider_YAML: "Datenprovider wird auf YAML gesetzt." + setProvider_JSON: "Datenprovider wird auf JSON gesetzt." setProvider_NotFound: "Provider %var0% existiert NICHT. Datenprovider wird auf Standard zurückgesetzt." unregisterPlayer: "Spieler %var0% wird abgemeldet" YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-en.yml b/resources/messages-en.yml index a30adbb8..c4b31d70 100644 --- a/resources/messages-en.yml +++ b/resources/messages-en.yml @@ -161,7 +161,7 @@ logger_messages: onLoad_03: "Multiworld support enabled." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Set data provider to MySQL." - setProvider_YAML: "Set data provider to YAML." + setProvider_JSON: "Set data provider to JSON." setProvider_NotFound: "Provider %var0% does NOT exist. Setting the data provider to default." unregisterPlayer: "Unregistering player %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-id.yml b/resources/messages-id.yml index bab4e6af..5c9f1cd3 100644 --- a/resources/messages-id.yml +++ b/resources/messages-id.yml @@ -164,7 +164,7 @@ logger_messages: onLoad_03: "Akses Multiworld diaktifkan." registerPlayer: "Mendaftarkan Pemain %var0%..." setProvider_MySQL: "Set data provider ke MySQL." - setProvider_YAML: "Set data provider ke YAML" + setProvider_JSON: "Set data provider ke JSON" setProvider_NotFound: "Provider %var0% tidak ada. Set data provider ke default." unregisterPlayer: "Menghapus pemain %var0% dari daftar..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-it.yml b/resources/messages-it.yml index aa7cb1a2..f3c168cc 100644 --- a/resources/messages-it.yml +++ b/resources/messages-it.yml @@ -163,7 +163,7 @@ logger_messages: onLoad_03: "Il supporto multimondo è abilitato." registerPlayer: "Registrando giocatore %var0%..." setProvider_MySQL: "Il fornitore dati impostato è MySQL." - setProvider_YAML: "Il fornitore dati impostato è YAML" + setProvider_JSON: "Il fornitore dati impostato è JSON" setProvider_NotFound: "Il fornitore %var0% non esiste. Impostando il fornitore dati predefinito." unregisterPlayer: "Togliendo la registrazione al giocatore %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-jp.yml b/resources/messages-jp.yml index 8b7bc766..e855317e 100644 --- a/resources/messages-jp.yml +++ b/resources/messages-jp.yml @@ -162,7 +162,7 @@ logger_messages: onLoad_03: "マルチワールド対応が有効です。" registerPlayer: "プレイヤーを%var0%に登録しています..." setProvider_MySQL: "MYSQLにデーター管理方式が設定されました。" - setProvider_YAML: "YAMLv1にデーター管理方式が設定されました。" + setProvider_JSON: "YAMLv1にデーター管理方式が設定されました。" setProvider_NotFound: "データー管理方式%var0%は存在しません。デフォルトの方式に設定しました。" unregisterPlayer: "プレイヤーを%var0%から解除してます..." YAMLProvider_InvalidGroupsSettings: "GROUPS.YMLの設定が間違っています: groups.yml が無効、または壊れているかどうかに確認してください。" diff --git a/resources/messages-ko.yml b/resources/messages-ko.yml index 089aedcd..c530525e 100644 --- a/resources/messages-ko.yml +++ b/resources/messages-ko.yml @@ -164,7 +164,7 @@ logger_messages: onLoad_03: "다중 월드 지원 기능이 활성화되었습니다." registerPlayer: "플레이어 %var0% 등록 중..." setProvider_MySQL: "MySQL 형식으로 데이터가 저장됩니다." - setProvider_YAML: "YAMLv1 방식으로 데이터가 저장됩니다." + setProvider_JSON: "YAMLv1 방식으로 데이터가 저장됩니다." setProvider_Invalid: "올바르지 않은 데이터 저장 방식입니다. 자동으로 YAML 방식으로 데이터가 저장됩니다." unregisterPlayer: "플레이어 %var0% 등록 해제 중..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-ru.yml b/resources/messages-ru.yml index aa00ff37..86659f19 100644 --- a/resources/messages-ru.yml +++ b/resources/messages-ru.yml @@ -163,7 +163,7 @@ logger_messages: onLoad_03: "Поддержка мульти миров включена." registerPlayer: "Регистрация игрока %var0%..." setProvider_MySQL: "Тип хранилища данных - MySQL." - setProvider_YAML: "Тип хранилища данных - YAML" + setProvider_JSON: "Тип хранилища данных - JSON" setProvider_NotFound: "Провайдер данных %var0% не существует. Устанавливается стандартный тип хранилища данных." unregisterPlayer: "Отмена регистрации игрока %var0%..." YAMLProvider_InvalidGroupsSettings: "недействительный GROUPS.YML НАСТРОЙКИ: Пожалуйста, проверьте, если у вас есть недопустимое или поврежден groups.yml." diff --git a/resources/messages-sk.yml b/resources/messages-sk.yml index 01098e59..96ab9390 100644 --- a/resources/messages-sk.yml +++ b/resources/messages-sk.yml @@ -163,7 +163,7 @@ logger_messages: onLoad_03: "Podpora Multisveta povolena." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Nastavte poskytovatela dat na MySQL." - setProvider_YAML: "Nastavte poskytovatela dat na YAML." + setProvider_JSON: "Nastavte poskytovatela dat na JSON." setProvider_NotFound: "Poskytovatel %var0% nastavujem sprostredkovatela dat na predvolene nastavenia." unregisterPlayer: "Unregistering player %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-sp.yml b/resources/messages-sp.yml index 49f2e915..79d941a8 100644 --- a/resources/messages-sp.yml +++ b/resources/messages-sp.yml @@ -165,7 +165,7 @@ logger_messages: onLoad_03: "El soporte multi-nivel ha sido activado." registerPlayer: "Registrando el Usuario %var0%..." setProvider_MySQL: "Utilizando MySQL como proveedor." - setProvider_YAML: "Utilizando YAML como proveedor." + setProvider_JSON: "Utilizando JSON como proveedor." setProvider_NotFound: "El proveedor %var0% NO existe. Utilizando el proveedor predeterminado." unregisterPlayer: "DesRegistrando al Jugador %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/resources/messages-tr.yml b/resources/messages-tr.yml index 3e2e56f9..0c9b82ca 100644 --- a/resources/messages-tr.yml +++ b/resources/messages-tr.yml @@ -163,7 +163,7 @@ logger_messages: onLoad_03: "Multiworld desteği etkin." registerPlayer: "%var0% oyuncusu kayda geçirildi..." setProvider_MySQL: "Veri sağlayıcısı MySQL ayarlandı." - setProvider_YAML: "Veri sağlayıcısı YAML ayarlandı." + setProvider_JSON: "Veri sağlayıcısı JSON ayarlandı." setProvider_NotFound: "%var0% sağlayıcısı mevcut değil. Varsayılan veri sağlayıcısına değiştiriliyor." unregisterPlayer: "%var0% adlı oyuncunun kaydı siliniyor..." YAMLProvider_InvalidGroupsSettings: "BİLİNMEYEN GROUPS.YML AYARI: Lütfen groups.yml dosyasındaki geçersiz veya bozuk dosyaları kontrol edin." diff --git a/resources/messages-ua.yml b/resources/messages-ua.yml index 2a6a1c14..51813fe9 100644 --- a/resources/messages-ua.yml +++ b/resources/messages-ua.yml @@ -163,7 +163,7 @@ logger_messages: onLoad_03: "Поддержка декількох світів увімкнена." registerPlayer: "Реєстрація гравця %var0%..." setProvider_MySQL: "Тип сховища даних - MySQL." - setProvider_YAML: "Тип сховища даних - YAML." + setProvider_JSON: "Тип сховища даних - JSON." setProvider_NotFound: "Провайдер даних %var0% не існує. Встановлено стандартний тип сховища даних." unregisterPlayer: "Відміна реєстрації гравця %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/src/_64FF00/PurePerms/DataProviders/YamlProvider.php b/src/_64FF00/PurePerms/DataProviders/JsonProvider.php similarity index 95% rename from src/_64FF00/PurePerms/DataProviders/YamlProvider.php rename to src/_64FF00/PurePerms/DataProviders/JsonProvider.php index 9f12862b..bff23974 100644 --- a/src/_64FF00/PurePerms/DataProviders/YamlProvider.php +++ b/src/_64FF00/PurePerms/DataProviders/JsonProvider.php @@ -10,7 +10,7 @@ use pocketmine\utils\Config; use RuntimeException; -class YamlProvider implements ProviderInterface +class JsonProvider implements ProviderInterface { /* PurePerms by 64FF00 (Twitter: @64FF00) @@ -81,9 +81,9 @@ public function getPlayerConfig(IPlayer $player, $onUpdate = false) // TODO if($onUpdate === true) { - if(!file_exists($this->userDataFolder . strtolower($userName) . ".yml")) + if(!file_exists($this->userDataFolder . strtolower($userName) . ".json")) { - return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ + return new Config($this->userDataFolder . strtolower($userName) . ".json", Config::YAML, [ "userName" => $userName, "group" => $this->plugin->getDefaultGroup()->getName(), "permissions" => [], @@ -93,15 +93,15 @@ public function getPlayerConfig(IPlayer $player, $onUpdate = false) } else { - return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ + return new Config($this->userDataFolder . strtolower($userName) . ".json", Config::YAML, [ ]); } } else { - if(file_exists($this->userDataFolder . strtolower($userName) . ".yml")) + if(file_exists($this->userDataFolder . strtolower($userName) . ".json")) { - return new Config($this->userDataFolder . strtolower($userName) . ".yml", Config::YAML, [ + return new Config($this->userDataFolder . strtolower($userName) . ".json", Config::YAML, [ ]); } else diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 67d16919..08a59540 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -26,7 +26,7 @@ use _64FF00\PurePerms\DataProviders\DefaultProvider; use _64FF00\PurePerms\DataProviders\MySQLProvider; use _64FF00\PurePerms\DataProviders\ProviderInterface; -use _64FF00\PurePerms\DataProviders\YamlProvider; +use _64FF00\PurePerms\DataProviders\JsonProvider; use _64FF00\PurePerms\Task\PPExpDateCheckTask; use pocketmine\permission\PermissionManager; @@ -172,10 +172,10 @@ private function setProvider($onEnable = true) $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_MySQL")); break; - case "yml": - $provider = new YamlProvider($this); + case "json": + $provider = new JsonProvider($this); if($onEnable === true) - $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_YAML")); + $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_Json")); break; default: $provider = new DefaultProvider($this); From 7f643fcc97077bc4f351b5a4f6f2e7f6df70a013 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 08:10:20 -0800 Subject: [PATCH 11/46] Fixed bug when the JSON log message doesnt show. --- src/_64FF00/PurePerms/PurePerms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 08a59540..987fff31 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -175,7 +175,7 @@ private function setProvider($onEnable = true) case "json": $provider = new JsonProvider($this); if($onEnable === true) - $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_Json")); + $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_JSON")); break; default: $provider = new DefaultProvider($this); From 77214a4a808f92f84ab4937e647bb0deb8da4b14 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 08:14:05 -0800 Subject: [PATCH 12/46] Changed players.yml file to work as JSON --- resources/players.json | 7 +++++++ resources/players.yml | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 resources/players.json delete mode 100644 resources/players.yml diff --git a/resources/players.json b/resources/players.json new file mode 100644 index 00000000..215806c0 --- /dev/null +++ b/resources/players.json @@ -0,0 +1,7 @@ +{ + "64FF00": { + "group": "Guest", + "permissions": [], + "worlds": [] + } +} \ No newline at end of file diff --git a/resources/players.yml b/resources/players.yml deleted file mode 100644 index cbc2a816..00000000 --- a/resources/players.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -64FF00: - group: Guest - permissions: [] - worlds: [] -... From 017f67dd9fb1d098a3773e51db8e9176fa6417c4 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 10:58:32 -0800 Subject: [PATCH 13/46] Removed MultiWorld world support & useless messages --- resources/config.yml | 4 ---- resources/groups.yml | 6 ------ resources/messages-cz.yml | 3 --- resources/messages-de.yml | 3 --- resources/messages-en.yml | 3 --- resources/messages-id.yml | 3 --- resources/messages-it.yml | 3 --- resources/messages-jp.yml | 3 --- resources/messages-ko.yml | 3 --- resources/messages-ru.yml | 3 --- resources/messages-sk.yml | 3 --- resources/messages-sp.yml | 3 --- resources/messages-tr.yml | 3 --- resources/messages-ua.yml | 3 --- src/_64FF00/PurePerms/PurePerms.php | 9 --------- 15 files changed, 55 deletions(-) diff --git a/resources/config.yml b/resources/config.yml index 3d368872..6da3a116 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -29,10 +29,6 @@ default-language: en # - true / false disable-op: true -# Setting this option will allow you to use per-world permissions -# - true / false -enable-multiworld-perms: false - # Enables 'Noeul', a 'pointless' security management system for PurePerms # - true / false enable-noeul-sixtyfour: false diff --git a/resources/groups.yml b/resources/groups.yml index 16b55e71..186eccaf 100644 --- a/resources/groups.yml +++ b/resources/groups.yml @@ -1,6 +1,4 @@ - # PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - --- Guest: alias: 'gst' @@ -14,7 +12,6 @@ Guest: - pchat.colored.nametag - pocketmine.command.list - pperms.command.ppinfo - worlds: [] Admin: alias: 'adm' inheritance: @@ -27,7 +24,6 @@ Admin: - pocketmine.command.kick - pocketmine.command.teleport - pocketmine.command.time - worlds: [] Owner: alias: 'owr' inheritance: @@ -36,11 +32,9 @@ Owner: - essentials - pocketmine.command - pperms.command - worlds: [] OP: alias: 'op' inheritance: [] permissions: - '*' - worlds: [] ... diff --git a/resources/messages-cz.yml b/resources/messages-cz.yml index 280e63e6..e501c276 100644 --- a/resources/messages-cz.yml +++ b/resources/messages-cz.yml @@ -158,9 +158,6 @@ logger_messages: getDefaultGroup_03: "Automaticke nastavovani vychozi skupiny." getGroup_01: "Skupina %var0% nenalezena" getGroup_02: "Skupina %var0% ma neplatna nebo poskozena data" - onLoad_01: "Podpora MultiSveta je v soucasne dobe zakazana." - onLoad_02: "Nezapomente nastavit moznost enable-multiworld-perms v config.yml na true jestli chcete pouzit MultiSvet opravneni!" - onLoad_03: "Podpora Multisveta povolena." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Nastavte poskytovatele dat do MySQL." setProvider_JSON: "Nastavte poskytovatele dat na JSON" diff --git a/resources/messages-de.yml b/resources/messages-de.yml index fff8bbc7..70e93ff7 100644 --- a/resources/messages-de.yml +++ b/resources/messages-de.yml @@ -158,9 +158,6 @@ logger_messages: getDefaultGroup_03: "Standardgruppe wird automatisch gesetzt." getGroup_01: "Gruppe %var0% nicht gefunden" getGroup_02: "Gruppe %var0% enthält ungültige oder beschädigte Daten" - onLoad_01: "Unterstützung für mehrere Welten ist derzeit deaktiviert." - onLoad_02: "Vergesse nicht die Option enable-multiworld-perms in der config.yml auf true zu setzen, wenn du unterschiedliche Berechtigungen für deine Welten willst!" - onLoad_03: "Unterstützung für mehrere Welten ist aktiviert." registerPlayer: "Spieler %var0% wird angemeldet" setProvider_MySQL: "Datenprovider wird auf MySQL gesetzt." setProvider_JSON: "Datenprovider wird auf JSON gesetzt." diff --git a/resources/messages-en.yml b/resources/messages-en.yml index c4b31d70..dd086276 100644 --- a/resources/messages-en.yml +++ b/resources/messages-en.yml @@ -156,9 +156,6 @@ logger_messages: getDefaultGroup_03: "Setting the default group automatically." getGroup_01: "Group %var0% not found." getGroup_02: "Group %var0% has invalid or corrupted data." - onLoad_01: "Multiworld support is currently disabled." - onLoad_02: "Don't forget to set enable-multiworld-perms option in config.yml to true if you want to use per-world permissions!" - onLoad_03: "Multiworld support enabled." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Set data provider to MySQL." setProvider_JSON: "Set data provider to JSON." diff --git a/resources/messages-id.yml b/resources/messages-id.yml index 5c9f1cd3..340f357d 100644 --- a/resources/messages-id.yml +++ b/resources/messages-id.yml @@ -159,9 +159,6 @@ logger_messages: getDefaultGroup_03: "Menset grup normal otomatis." getGroup_01: "Grup %var0% tidak ada" getGroup_02: "Grup %var0% error atau data korup" - onLoad_01: "Akses Multiworld tidak aktif." - onLoad_02: "Jangan lupa set enable-multiworld-perms di config.yml ke true jika kamu ingin memakai per-multiworld-perms!" - onLoad_03: "Akses Multiworld diaktifkan." registerPlayer: "Mendaftarkan Pemain %var0%..." setProvider_MySQL: "Set data provider ke MySQL." setProvider_JSON: "Set data provider ke JSON" diff --git a/resources/messages-it.yml b/resources/messages-it.yml index f3c168cc..1cc0fc99 100644 --- a/resources/messages-it.yml +++ b/resources/messages-it.yml @@ -158,9 +158,6 @@ logger_messages: getDefaultGroup_03: "Impostando automaticamente il gruppo predefinito." getGroup_01: "Il gruppo %var0% non è stato trovato." getGroup_02: "Il gruppo %var0% ha dati non validi o corrotti." - onLoad_01: "Il supporto multimondo è disabilitato." - onLoad_02: "Non dimenticare di impostare nel config.yml l'opzione enable-multiworld-perms in true se vuoi usare i permessi specifici per ogni mondo!" - onLoad_03: "Il supporto multimondo è abilitato." registerPlayer: "Registrando giocatore %var0%..." setProvider_MySQL: "Il fornitore dati impostato è MySQL." setProvider_JSON: "Il fornitore dati impostato è JSON" diff --git a/resources/messages-jp.yml b/resources/messages-jp.yml index e855317e..080b8a10 100644 --- a/resources/messages-jp.yml +++ b/resources/messages-jp.yml @@ -157,9 +157,6 @@ logger_messages: getDefaultGroup_03: "基本グループを自動的に設定します。" getGroup_01: "グループ%var0%は存在しません。" getGroup_02: "グループ%var0%は不正です。" - onLoad_01: "マルチワールド対応が現在無効です。" - onLoad_02: "per-world(ワールドごとの)権限を使用するには、config.ymlのenable-multiworld-permissionをtrueに設定することを忘れないでください!" - onLoad_03: "マルチワールド対応が有効です。" registerPlayer: "プレイヤーを%var0%に登録しています..." setProvider_MySQL: "MYSQLにデーター管理方式が設定されました。" setProvider_JSON: "YAMLv1にデーター管理方式が設定されました。" diff --git a/resources/messages-ko.yml b/resources/messages-ko.yml index c530525e..aa92e91b 100644 --- a/resources/messages-ko.yml +++ b/resources/messages-ko.yml @@ -159,9 +159,6 @@ logger_messages: getDefaultGroup_03: "기본 그룹을 자동으로 설정하는 중입니다..." getGroup_01: "그룹 %var0%를 찾을 수 없습니다." getGroup_02: "그룹 %var0%가 잘못되었거나 손상된 데이터를 포함하고 있습니다." - onLoad_01: "다중 월드 지원 기능은 현재 비활성화되어 있습니다." - onLoad_02: "다중 월드 지원 기능을 사용하시려면 반드시 config.yml에서 enable-multiworld-perms 옵션을 true로 설정해주세요." - onLoad_03: "다중 월드 지원 기능이 활성화되었습니다." registerPlayer: "플레이어 %var0% 등록 중..." setProvider_MySQL: "MySQL 형식으로 데이터가 저장됩니다." setProvider_JSON: "YAMLv1 방식으로 데이터가 저장됩니다." diff --git a/resources/messages-ru.yml b/resources/messages-ru.yml index 86659f19..033358b9 100644 --- a/resources/messages-ru.yml +++ b/resources/messages-ru.yml @@ -158,9 +158,6 @@ logger_messages: getDefaultGroup_03: "Группа с параметром Default назначается автоматически." getGroup_01: "Группа %var0% не найдена." getGroup_02: "Группа %var0% имеет неправильные или поврежденные данные." - onLoad_01: "Поддержка мульти миров в настоящее время отключена." - onLoad_02: "Не забудьте установить для параметра enable-multiworld-perms в файле config.yml значение true, если хотите иметь разные разрешения в различных мирах!" - onLoad_03: "Поддержка мульти миров включена." registerPlayer: "Регистрация игрока %var0%..." setProvider_MySQL: "Тип хранилища данных - MySQL." setProvider_JSON: "Тип хранилища данных - JSON" diff --git a/resources/messages-sk.yml b/resources/messages-sk.yml index 96ab9390..29f37b42 100644 --- a/resources/messages-sk.yml +++ b/resources/messages-sk.yml @@ -158,9 +158,6 @@ logger_messages: getDefaultGroup_03: "Automaticke nastavovanie vychodiskove skupiny." getGroup_01: "Skupina %var0% nenajdena" getGroup_02: "Skupina %var0% ma neplatny alebo poskodeny data" - onLoad_01: "Podpora MultiSveta je v sucasnosti zakazana." - onLoad_02: "Nezabudnite nastavit moznost enable-multiworld-perms v config.yml na true ci chcete pouzit MultiSvet opravnenie!" - onLoad_03: "Podpora Multisveta povolena." registerPlayer: "Registering player %var0%..." setProvider_MySQL: "Nastavte poskytovatela dat na MySQL." setProvider_JSON: "Nastavte poskytovatela dat na JSON." diff --git a/resources/messages-sp.yml b/resources/messages-sp.yml index 79d941a8..e015ebf3 100644 --- a/resources/messages-sp.yml +++ b/resources/messages-sp.yml @@ -160,9 +160,6 @@ logger_messages: getDefaultGroup_03: "Estableciendo automáticamente el grupo 'predeterminado'." getGroup_01: "No se ha encontrado el grupo %var0%" getGroup_02: "El grupo %var0% contiene información inválida o corrupta" - onLoad_01: "El soporte multi-nivel se encuentra actualmente deshabilitado." - onLoad_02: "¡No olvides habilitar el soporte multi-nivel (enable-multiworld-perms: true en config.yml) si quieres establecer permisos-por-mundo!" - onLoad_03: "El soporte multi-nivel ha sido activado." registerPlayer: "Registrando el Usuario %var0%..." setProvider_MySQL: "Utilizando MySQL como proveedor." setProvider_JSON: "Utilizando JSON como proveedor." diff --git a/resources/messages-tr.yml b/resources/messages-tr.yml index 0c9b82ca..186ac7b0 100644 --- a/resources/messages-tr.yml +++ b/resources/messages-tr.yml @@ -158,9 +158,6 @@ logger_messages: getDefaultGroup_03: "Varsayılan grup otomatik ayarlandı." getGroup_01: "%var0% adlı grup bulunamadı." getGroup_02: "%var0% geçersiz veya bozuk veri içeriyor." - onLoad_01: "Multiworld desteği devre dışı." - onLoad_02: "enable-multiworld-perms seçeneğini config.yml dosyasında per-world yetkisini kullanmak için aktif etmeyi unutmayınız!" - onLoad_03: "Multiworld desteği etkin." registerPlayer: "%var0% oyuncusu kayda geçirildi..." setProvider_MySQL: "Veri sağlayıcısı MySQL ayarlandı." setProvider_JSON: "Veri sağlayıcısı JSON ayarlandı." diff --git a/resources/messages-ua.yml b/resources/messages-ua.yml index 51813fe9..9a4036c9 100644 --- a/resources/messages-ua.yml +++ b/resources/messages-ua.yml @@ -158,9 +158,6 @@ logger_messages: getDefaultGroup_03: "Група з параметром Default позначається автоматично." getGroup_01: "Група %var0% не знайдена." getGroup_02: "Група %var0% має неправильні чи пошкоджені дані." - onLoad_01: "Підтримка декількох світів зараз вимкнена." - onLoad_02: "Не забудьте встановити для параметру enable-multiworld-perms в файлі config.yml значення true, якщо хочете змінити різні дозволи в різних світах!" - onLoad_03: "Поддержка декількох світів увімкнена." registerPlayer: "Реєстрація гравця %var0%..." setProvider_MySQL: "Тип сховища даних - MySQL." setProvider_JSON: "Тип сховища даних - JSON." diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 987fff31..109c990d 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -85,15 +85,6 @@ public function onLoad(): void $this->messages = new PPMessages($this); $this->noeulAPI = new NoeulAPI($this); $this->userDataMgr = new UserDataManager($this); - if($this->getConfigValue("enable-multiworld-perms") === false) - { - $this->getLogger()->info($this->getMessage("logger_messages.onLoad_01")); - $this->getLogger()->info($this->getMessage("logger_messages.onLoad_02")); - } - else - { - $this->getLogger()->info($this->getMessage("logger_messages.onLoad_03")); - } } public function onEnable(): void From d35ba80100cde4d0d190706218327202f6656ee0 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 11:16:42 -0800 Subject: [PATCH 14/46] Ditching all languages except for english. --- resources/config.yml | 16 +--- resources/messages-cz.yml | 167 ------------------------------------- resources/messages-de.yml | 167 ------------------------------------- resources/messages-id.yml | 168 ------------------------------------- resources/messages-it.yml | 167 ------------------------------------- resources/messages-jp.yml | 166 ------------------------------------- resources/messages-ko.yml | 168 ------------------------------------- resources/messages-ru.yml | 167 ------------------------------------- resources/messages-sk.yml | 167 ------------------------------------- resources/messages-sp.yml | 169 -------------------------------------- resources/messages-tr.yml | 167 ------------------------------------- resources/messages-ua.yml | 167 ------------------------------------- 12 files changed, 3 insertions(+), 1853 deletions(-) delete mode 100644 resources/messages-cz.yml delete mode 100644 resources/messages-de.yml delete mode 100644 resources/messages-id.yml delete mode 100644 resources/messages-it.yml delete mode 100644 resources/messages-jp.yml delete mode 100644 resources/messages-ko.yml delete mode 100644 resources/messages-ru.yml delete mode 100644 resources/messages-sk.yml delete mode 100644 resources/messages-sp.yml delete mode 100644 resources/messages-tr.yml delete mode 100644 resources/messages-ua.yml diff --git a/resources/config.yml b/resources/config.yml index 6da3a116..54d5de59 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -7,22 +7,12 @@ # Set default data provider for PurePerms # - mysql (MYSQL Database) # - json (JSON Database) +# - sqlite3 (SQLITe3 Database) data-provider: json -# Set the default language for PurePerms (<3) -# - en, ko, jp, ru, ua, it, sp, cz, sk, de, idn, tr +# Set the default language for PurePerms +# - en # English message resource by @64FF00 and @Samueljh1 (GitHub) -# Korean message resource by @64FF00 (GitHub) -# Japanese message resource by @onebone and @haniokasai (GitHub) -# Russian message resource by @vvzar and @Pub4Game (GitHub) -# Ukrainian message resource by @samalero (GitHub) -# Italian message resource by @AryToNeX (GitHub) -# Spanish message resource by @iksaku and @JoahDave (Github) -# Czech message resource by @Michael2010117 (GitHub) -# Slovak message resource by @Michael2010117 (GitHub) -# German message resource by @Exxarion (GitHub) -# Indonesian message resource by @DevillordMCPE (GitHub) -# Turkish messages resource by @PainTR (GitHub) default-language: en # Disable /op permission for all players diff --git a/resources/messages-cz.yml b/resources/messages-cz.yml deleted file mode 100644 index e501c276..00000000 --- a/resources/messages-cz.yml +++ /dev/null @@ -1,167 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Czech language resource by @Michael2010117 - ---- -messages-version: "1.4.0_01" -language: "cz" -cmds: - addgroup: - desc: "Pridat novou skupinu do skupin." - usage: "Pouzij: /addgroup " - messages: - group_added_successfully: "%var0% Skupina byla uspesne nahrana." - group_already_exists: "Skupina %var0% uz existuje." - invalid_group_name: "Invalid Group Name." - addparent: - desc: "Adds a group to another group inheritance list." - usage: "Usage: /addparent " - messages: - addparent_successfully: "Added %var0% to group %var1%'s inheritance list." - target_already_inherits: "Group %var0% already inherits %var1%." - defgroup: - desc: "Umoznuje nastavit vychozi skupiny." - usage: "Pouzij: /defgroup [Svet]" - messages: - defgroup_successfully: "Vychozi skupina byla uspesne nastavena%var0%." - group_not_exist: "Skupina %var0% neexistuje." - level_not_exist: "Svet %var0% neexistuje." - fperms: - desc: "Zobrazi seznam vsech povoleni pro konkretni plugin." - usage: "Pouziti: /fperms " - messages: - no_plugin_perms: "Plugin %var0% Nema zadne opravneni." - plugin_not_exist: "Plugin %var0% neexistuje." - plugin_perms_list: "Seznam vsech povolenych pluginu %var0% (%var1% / %var2%) : " - groups: - desc: "Ukazat list vsech skupin." - messages: - all_registered_groups: "Vsechny registrovane skupiny: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Usage: /grpinfo [Svet]" - messages: - group_not_exist: "Skupina %var0% neexistuje." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "Svet %var0% neexistuje." - listgperms: - desc: "Ukazat seznam vsech prav pro skupiny." - usage: "Pouzij: /listgperms [Svet]" - messages: - group_not_exist: "Skupina %var0% neexistuje." - group_perms_list: "Seznam prav vsech skupin od %var0% (%var1% / %var2%) : " - level_not_exist: "Svet %var0% neexistuje." - no_group_perms: "Skupina %var0% nema zadne skupinove prava." - listuperms: - desc: "Zobrazi seznam vsech povoleni od uzivatele." - usage: "Pouziti: /listuperms [Svet]" - messages: - level_not_exist: "Svet %var0% neexistuje." - no_user_perms: "Hrac %var0% nema zadne uzivatelske opravneni." - user_perms_list: "Seznam vsech uzivatelskych prav od %var0% (%var1% / %var2%) : " - ppinfo: - desc: "Ziskejte aktualni PurePerms informace, vcetne autora, verze, atd." - messages: - ppinfo_console: "Prave pouzivas PurePerms v%var0% by %var1%." - ppinfo_player: "Tento server pouziva PurePerms v%var0% by %var1%." - ppreload: - desc: "Znovu nacte vsechny konfigurace PurePerms." - messages: - successfully_reloaded: "Vsechny konfigurace a pluginy byly uspesne obnoveny." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "This account is already registered." - deauth_01: "This server uses Noeul v%var0% to protect your account." - deauth_02: "You must authenticate your account first." - deauth_03: "Please register or login to your account using /ppsudo command" - invalid_sender: "This command should be only used in-game." - login_usage: "Usage: /ppsudo login " - not_registered: "This account is not registered." - password_too_short: "Your password does NOT meet minimum length (%var0%) requirements." - register_usage: "Usage: /ppsudo register " - successfully_logged_in: "You are now logged in." - successfully_registered: "Your account has been successfully registered." - unregister_usage: "Usage: /ppsudo unregister " - rmgroup: - desc: "Smaze skupinu ze seznamu skupin." - usage: "Pouziti: /rmgroup " - messages: - group_removed_successfully: "Odstraneni %var0% skupiny ze seznamu skupin probehlo uspesne." - group_not_exist: "Skupina %var0% neexistuje." - invalid_group_name: "Invalid Group Name." - rmparent: - desc: "Removes a group from another group inheritance list." - usage: "Usage: /rmparent " - messages: - rmparent_successfully: "Removed %var0% from group %var1%'s inheritance list." - setgperm: - desc: "Prida opravneni skupiny." - usage: "Pouziti: /setgperm [Svet]" - messages: - gperm_added_successfully: "Opravneni %var0% ke skupine uspesne pridano." - group_not_exist: "Skupina %var0% neexistuje." - level_not_exist: "Svet %var0% neexistuje." - setgroup: - desc: "Nastavi skupinu pro uzivatele." - usage: "Pouziti: /setgroup [Svet]" - messages: - access_denied_01: "You don't have permission to set a player's group to %var0%." - access_denied_02: "You don't have permission to change group of a player with group %var0%." - group_not_exist: "Skupina %var0% neexistuje." - level_not_exist: "Svet %var0% neexistuje." - on_player_group_change: "Tvoje skupina byla zmenena a / an %var0%!" - setgroup_successfully: "Uspesne %var0% pridan do skupiny." - setuperm: - desc: "Pridano opravneni uzivately." - usage: "Pouziti: /setuperm [Svet]" - messages: - level_not_exist: "Svet %var0% neexistuje." - uperm_added_successfully: "Opravneni %var0% do %var1% pridano uspesne." - unsetgperm: - desc: "Maze opravneni ze skupiny." - usage: "Pouziti: /unsetgperm [Svet]" - messages: - gperm_removed_successfully: "Opravneni %var0% ze skupiny bylo uspesne pridano." - group_not_exist: "Skupina %var0% neexistuje." - level_not_exist: "Svet %var0% neexistuje." - unsetuperm: - desc: "Maze opravneni z uzivatele." - usage: "Pouziti: /unsetuperm [Svet]" - messages: - level_not_exist: "Svet %var0% neexistuje." - uperm_removed_successfully: "Opravneni smazano %var0% od %var1% uspesne." - usrinfo: - desc: "Ukazuje informace o uzivately." - usage: "Pouizit: /usrinfo [Svet]" - messages: - level_not_exist: "Svet %var0% neexistuje." - status_online: "ONLINE!" - status_offline: "OFFLINE..." - usrinfo_header: "-- Informace pro uzivatele %var0% --" - usrinfo_username: "UZIVATELSKE JMENO: %var0%" - usrinfo_status: "STATUS: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "UNIKATNI ID: %var0%" - usrinfo_group: "SKUPINA: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "NEZNAMY" -logger_messages: - getConfigValue_01: "Klic %var0% nebyl nalezen v config.yml." - getDefaultGroup_01: "Vice nez jedna vychozi skupina byla deklarovana v souboru skupin." - getDefaultGroup_02: "Nebyla nalezena vychozi skupina." - getDefaultGroup_03: "Automaticke nastavovani vychozi skupiny." - getGroup_01: "Skupina %var0% nenalezena" - getGroup_02: "Skupina %var0% ma neplatna nebo poskozena data" - registerPlayer: "Registering player %var0%..." - setProvider_MySQL: "Nastavte poskytovatele dat do MySQL." - setProvider_JSON: "Nastavte poskytovatele dat na JSON" - setProvider_NotFound: "Poskytovatel %var0% neexistuje. Nastavuji zprostredkovatele dat na vychozi nastaveni." - unregisterPlayer: "Unregistering player %var0%..." - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." -... diff --git a/resources/messages-de.yml b/resources/messages-de.yml deleted file mode 100644 index 70e93ff7..00000000 --- a/resources/messages-de.yml +++ /dev/null @@ -1,167 +0,0 @@ - -# PurePerms von 64FF00 (xktiverz@gmail.com, @64ff00 für Twitter) - -# Original German language resource by @Exxarion, reworked by @thebigsmileXD - ---- -messages-version: "1.4.0_01" -language: "de" -cmds: - addgroup: - desc: "Fügt eine neue Gruppe zu der Liste hinzu." - usage: "Benutzung: /addgroup " - messages: - group_added_successfully: "Gruppe %var0% wurde erfolgreich zu der Liste hinzugefügt." - group_already_exists: "Gruppe %var0% existiert bereits." - invalid_group_name: "Invalid Group Name." - addparent: - desc: "Adds a group to another group inheritance list." - usage: "Usage: /addparent " - messages: - addparent_successfully: "Added %var0% to group %var1%'s inheritance list." - target_already_inherits: "Group %var0% already inherits %var1%." - defgroup: - desc: "Setzt die Standardgruppe." - usage: "Benutzung: /defgroup [Welt]" - messages: - defgroup_successfully: "Die Standardgruppe ist nun %var0%." - group_not_exist: "Die Gruppe %var0% existiert NICHT" - level_not_exist: "Welt %var0% existiert NICHT." - fperms: - desc: "Zeigt eine Liste aller Berechtigungen für ein Plugin." - usage: "Benutzung: /fperms " - messages: - no_plugin_perms: "Plugin %var0% hat keine Berechtigungen." - plugin_not_exist: "Plugin %var0% existiert NICHT." - plugin_perms_list: "Liste aller Pluginberechtigunen für %var0% (%var1% / %var2%) : " - groups: - desc: "Zeigt eine Liste aller Gruppen." - messages: - all_registered_groups: "Alle registrierten Gruppen: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Benutzung: /grpinfo [Welt]" - messages: - group_not_exist: "Gruppe %var0% existiert NICHT." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "Welt %var0% existiert NICHT." - listgperms: - desc: "Zeigt eine Liste aller Berechtigungen einer Gruppe." - usage: "Benutzung: /listgperms [Welt]" - messages: - group_not_exist: "Gruppe %var0% existiert NICHT." - group_perms_list: "Liste aller Gruppenberechtigungen von %var0% (%var1% / %var2%) : " - level_not_exist: "Welt %var0% existiert NICHT." - no_group_perms: "Gruppe %var0% hat keine Gruppenberechtigungen." - listuperms: - desc: "Zeigt eine Liste aller permissions eines Nutzers." - usage: "Benutzung: /listuperms [Welt]" - messages: - level_not_exist: "Welt %var0% existiert NICHT." - no_user_perms: "Spieler %var0% hat keine Nutzerberechtigungen." - user_perms_list: "Liste aller Nutzerberechtigungen von %var0% (%var1% / %var2%) : " - ppinfo: - desc: "Zeigt alle PurePerms Informationen einschließlich Autor, Version und so weiter." - messages: - ppinfo_console: "Du nutzt derzeit PurePerms v%var0% von %var1%." - ppinfo_player: "Dieser Server nutzt PurePerms v%var0% von %var1%." - ppreload: - desc: "Lädt die Einstellungen von PurePerms neu." - messages: - successfully_reloaded: "Alle Einstellungen von PurePerms wurden erfolgreich neu geladen." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "This account is already registered." - deauth_01: "This server uses Noeul v%var0% to protect your account." - deauth_02: "You must authenticate your account first." - deauth_03: "Please register or login to your account using /ppsudo command" - invalid_sender: "This command should be only used in-game." - login_usage: "Usage: /ppsudo login " - not_registered: "This account is not registered." - password_too_short: "Your password does NOT meet minimum length (%var0%) requirements." - register_usage: "Usage: /ppsudo register " - successfully_logged_in: "You are now logged in." - successfully_registered: "Your account has been successfully registered." - unregister_usage: "Usage: /ppsudo unregister " - rmgroup: - desc: "Entfernt eine Gruppe von der Gruppenliste." - usage: "Benutzung: /rmgroup " - messages: - group_removed_successfully: "%var0% wurde erfolgreich von der Gruppenliste entfernt." - group_not_exist: "Gruppe %var0% existiert NICHT." - invalid_group_name: "Invalid Group Name." - rmparent: - desc: "Removes a group from another group inheritance list." - usage: "Usage: /rmparent " - messages: - rmparent_successfully: "Removed %var0% from group %var1%'s inheritance list." - setgperm: - desc: "Fügt eine Berechtigung zu einer Gruppe hinzu." - usage: "Benutzung: /setgperm [Welt]" - messages: - gperm_added_successfully: "Berechtigung %var0% wurde erfolgreich zur Gruppe hinzugefügt." - group_not_exist: "Gruppe %var0% existiert NICHT." - level_not_exist: "Welt %var0% existiert NICHT." - setgroup: - desc: "Setzt eine Gruppe für einen Spieler." - usage: "Benutzung: /setgroup [Welt]" - messages: - access_denied_01: "You don't have permission to set a player's group to %var0%." - access_denied_02: "You don't have permission to change group of a player with group %var0%." - group_not_exist: "Gruppe %var0% existiert NICHT." - level_not_exist: "Welt %var0% existiert NICHT." - on_player_group_change: "Deine PurePerms-Gruppe wurde zu %var0% geändert!" - setgroup_successfully: "Spieler %var0% wurde erfolgreich zur Gruppe hinzugefügt." - setuperm: - desc: "Fügt eine Berechtigung zu einem Spieler hinzu." - usage: "Benutzung: /setuperm [Welt]" - messages: - level_not_exist: "Welt %var0% existiert NICHT." - uperm_added_successfully: "Berechtigung %var0% wurde erfolgreich zum Spieler %var1% hinzugefügt." - unsetgperm: - desc: "Entfernt eine Berechtigung von einer Gruppe." - usage: "Benutzung: /unsetgperm [Welt]" - messages: - gperm_removed_successfully: "Berechtigung %var0% wurde erfolgreich von der Gruppe entfernt." - group_not_exist: "Gruppe %var0% existiert NICHT." - level_not_exist: "Welt %var0% existiert NICHT." - unsetuperm: - desc: "Entfernt eine Berechtigung vom Spieler." - usage: "Benutzung: /unsetuperm [Welt]" - messages: - level_not_exist: "Welt %var0% existiert NICHT." - uperm_removed_successfully: "Berechtigung %var0% wurde erfolgreich von %var1% entfernt." - usrinfo: - desc: "Zeigt Informationen zu einem Spieler." - usage: "Benutzung: /usrinfo [Welt]" - messages: - level_not_exist: "Welt %var0% existiert NICHT." - status_online: "ONLINE!" - status_offline: "OFFLINE..." - usrinfo_header: "-- Spielerinformationen zu %var0% --" - usrinfo_username: "BENUTZERNAME: %var0%" - usrinfo_status: "STATUS: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "EINZIGARTIGE ID: %var0%" - usrinfo_group: "GRUPPE: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "UNBEKANNT" -logger_messages: - getConfigValue_01: "Schlüssel %var0% wurde nicht in der config.yml gefunden." - getDefaultGroup_01: "Es wurden mehr als eine Gruppe als Standardgruppe in der Gruppendatei festgelegt." - getDefaultGroup_02: "Keine Standardgruppe in der Gruppendatei gefunden." - getDefaultGroup_03: "Standardgruppe wird automatisch gesetzt." - getGroup_01: "Gruppe %var0% nicht gefunden" - getGroup_02: "Gruppe %var0% enthält ungültige oder beschädigte Daten" - registerPlayer: "Spieler %var0% wird angemeldet" - setProvider_MySQL: "Datenprovider wird auf MySQL gesetzt." - setProvider_JSON: "Datenprovider wird auf JSON gesetzt." - setProvider_NotFound: "Provider %var0% existiert NICHT. Datenprovider wird auf Standard zurückgesetzt." - unregisterPlayer: "Spieler %var0% wird abgemeldet" - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." -... diff --git a/resources/messages-id.yml b/resources/messages-id.yml deleted file mode 100644 index 340f357d..00000000 --- a/resources/messages-id.yml +++ /dev/null @@ -1,168 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Translator : DevilLord Red Eagle / Darius Ellert Klaus / facebook.com/darius.redeagle - ---- -messages-version: "1.4.0_01" -language: "idn" -cmds: - addgroup: - desc: "Menambahkan grup baru ke daftar grup." - usage: "Command: /addgroup " - messages: - group_added_successfully: "Berhasil Menambahkan %var0% ke daftar grup." - group_already_exists: "Grup %var0% telah ada." - invalid_group_name: "Nama grup salah." - addparent: - desc: "Adds a group to another group inheritance list." - usage: "Usage: /addparent " - messages: - addparent_successfully: "Added %var0% to group %var1%'s inheritance list." - target_already_inherits: "Group %var0% already inherits %var1%." - defgroup: - desc: "Mengizinkan anda untuk set grup normal." - usage: "Command: /defgroup [world]" - messages: - defgroup_successfully: "Grup normal telah diset menjadi %var0%." - group_not_exist: "Grup %var0% tidak ada." - level_not_exist: "World %var0% tidak ada." - fperms: - desc: "Menampilkan semua permission dari sebuah plugin." - usage: "Command: /fperms " - messages: - no_plugin_perms: "Plugin %var0% tidak mempunyai permission." - plugin_not_exist: "Plugin %var0% tidak ada." - plugin_perms_list: "Daftar permission dari plugins %var0% (%var1% / %var2%) : " - groups: - desc: "Menampilkan datar dari semua grup. #64FF00" - messages: - all_registered_groups: "Grup yang telah terdaftar: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Command: /grpinfo [world]" - messages: - group_not_exist: "Grup %var0% tidak ada." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "World %var0% tidak ada." - listgperms: - desc: "Menampilkan semua permission dari grup. #64FF00" - usage: "Command: /listgperms [world]" - messages: - group_not_exist: "Grup %var0% tidak ada." - group_perms_list: "Daftar permission dari grup %var0% (%var1% / %var2%) : " - level_not_exist: "World %var0% tidak ada." - no_group_perms: "Grup %var0% tidak mempunyai permission." - listuperms: - desc: "Menampilkan permission dari pemain. #64FF00" - usage: "Command: /listuperms [world]" - messages: - level_not_exist: "World %var0% tidak ada." - no_user_perms: "Permain %var0% tidak mempunyai permission." - user_perms_list: "Daftar semua permission pemain dari %var0% (%var1% / %var2%) : " - ppinfo: - desc: "Mendapatkan info PurePerm termasuk penulis, versi, dll." - messages: - ppinfo_console: "Kamu memakai PurePerms v%var0% oleh %var1%." - ppinfo_player: "Server ini memakai PurePerms v%var0% oleh %var1%." - ppreload: - desc: "Reload semua konfigurasi PurePerms." - messages: - successfully_reloaded: "Semua konfigurasi telah di reload." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "This account is already registered." - deauth_01: "This server uses Noeul v%var0% to protect your account." - deauth_02: "You must authenticate your account first." - deauth_03: "Please register or login to your account using /ppsudo command" - invalid_sender: "This command should be only used in-game." - login_usage: "Usage: /ppsudo login " - not_registered: "This account is not registered." - password_too_short: "Your password does NOT meet minimum length (%var0%) requirements." - register_usage: "Usage: /ppsudo register " - successfully_logged_in: "You are now logged in." - successfully_registered: "Your account has been successfully registered." - unregister_usage: "Usage: /ppsudo unregister " - rmgroup: - desc: "Menghapus sebuah grup dari daftar grup." - usage: "Command: /rmgroup " - messages: - group_removed_successfully: "Berhasil menghapus %var0% dari daftar grup." - group_not_exist: "Grup %var0% tidak ada." - invalid_group_name: "Nama grup salah." - rmparent: - desc: "Removes a group from another group inheritance list." - usage: "Usage: /rmparent " - messages: - rmparent_successfully: "Removed %var0% from group %var1%'s inheritance list." - setgperm: - desc: "Menambahkan permission ke grup." - usage: "command: /setgperm [world]" - messages: - gperm_added_successfully: "Berhasil menambahkan permission %var0% ke dalam grup.." - group_not_exist: "Grup %var0% tidak ada." - level_not_exist: "World %var0% tidak ada." - setgroup: - desc: "Set grup untuk permain." - usage: "Command: /setgroup [world]" - messages: - access_denied_01: "Kamu tidak mempunyai permission untuk set pemain ke group %var0%." - access_denied_02: "You don't have permission to change group of a player with group %var0%." - access_denied_02: "Kamu tidak mempunyai permission untuk mengubah grup pemain dari grup %var0%." - group_not_exist: "Grup %var0% tidak ada." - level_not_exist: "World %var0% tidak ada." - on_player_group_change: "Grup kamu telah berhasil diubah menjadi %var0%!" - setgroup_successfully: "Berhasil menambahkan %var0% kedalam grup." - setuperm: - desc: "Menambahkan permission ke pemain." - usage: "Command: /setuperm [world]" - messages: - level_not_exist: "World %var0% tidak ada." - uperm_added_successfully: "Berhasil menambahkan permission %var0% ke %var1%." - unsetgperm: - desc: "Menghapus permission dari grup." - usage: "Command: /unsetgperm [world]" - messages: - gperm_removed_successfully: "berhasil menghapus permission %var0% dari grup." - group_not_exist: "Grup %var0% tidak ada." - level_not_exist: "World %var0% tidak ada." - unsetuperm: - desc: "Menghapus permission dari pemain." - usage: "Command: /unsetuperm [world]" - messages: - level_not_exist: "World %var0% tidak ada." - uperm_removed_successfully: "Berhasil menghapus permisson %var0% dari %var1%." - usrinfo: - desc: "Menampilkan info dari pemain." - usage: "Command: /usrinfo [world]" - messages: - level_not_exist: "World %var0% tidak ada." - status_online: "ONLINE!" - status_offline: "OFFLINE..." - usrinfo_header: "-- Info pemain untuk %var0% --" - usrinfo_username: "USERNAME: %var0%" - usrinfo_status: "STATUS: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "ID UNIK: %var0%" - usrinfo_group: "GRUP: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "UNKNOWN" -logger_messages: - getConfigValue_01: "Kunci %var0% tidak ditemukan di config.yml." - getDefaultGroup_01: "Lebih dari 1 grup normal telah di set di file config." - getDefaultGroup_02: "Tidak ada grup normal ditemukan." - getDefaultGroup_03: "Menset grup normal otomatis." - getGroup_01: "Grup %var0% tidak ada" - getGroup_02: "Grup %var0% error atau data korup" - registerPlayer: "Mendaftarkan Pemain %var0%..." - setProvider_MySQL: "Set data provider ke MySQL." - setProvider_JSON: "Set data provider ke JSON" - setProvider_NotFound: "Provider %var0% tidak ada. Set data provider ke default." - unregisterPlayer: "Menghapus pemain %var0% dari daftar..." - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." -... diff --git a/resources/messages-it.yml b/resources/messages-it.yml deleted file mode 100644 index 1cc0fc99..00000000 --- a/resources/messages-it.yml +++ /dev/null @@ -1,167 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Translated in Italian by AnThOnEx (Twitter: @AryToNeX) - ---- -messages-version: "1.4.0_01" -language: "it" -cmds: - addgroup: - desc: "Aggiunge un nuovo gruppo alla lista." - usage: "Sintassi: /addgroup " - messages: - group_added_successfully: "Il gruppo %var0% è stato aggiunto con successo." - group_already_exists: "Il gruppo %var0% esiste già." - invalid_group_name: "Nome del gruppo non valido." - addparent: - desc: "Adds a group to another group inheritance list." - usage: "Usage: /addparent " - messages: - addparent_successfully: "Added %var0% to group %var1%'s inheritance list." - target_already_inherits: "Group %var0% already inherits %var1%." - defgroup: - desc: "Permette di impostare un gruppo predefinito." - usage: "Sintassi: /defgroup [mondo]" - messages: - defgroup_successfully: "Gruppo predefinito impostato in %var0% con successo." - group_not_exist: "Il gruppo %var0% non esiste." - level_not_exist: "Il mondo %var0% non esiste." - fperms: - desc: "Mostra una lista dei permessi di un plugin." - usage: "Sintassi: /fperms " - messages: - no_plugin_perms: "Il plugin %var0% non ha permessi." - plugin_not_exist: "Il plugin %var0% non esiste." - plugin_perms_list: "Lista dei permessi del plugin %var0% (%var1% / %var2%) : " - groups: - desc: "Mostra una lista dei gruppi." - messages: - all_registered_groups: "Tutti i gruppi registrati: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Sintassi: /grpinfo [mondo]" - messages: - group_not_exist: "Il gruppo %var0% non esiste." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "Il mondo %var0% non esiste." - listgperms: - desc: "Mostra una lista di tutti i permessi di un gruppo." - usage: "Sintassi: /listgperms [mondo]" - messages: - group_not_exist: "Il gruppo %var0% non esiste." - group_perms_list: "Lista dei permessi del gruppo %var0% (%var1% / %var2%) : " - level_not_exist: "Il mondo %var0% non esiste." - no_group_perms: "Il gruppo %var0% non ha permessi." - listuperms: - desc: "Mostra una lista dei permessi di un utente." - usage: "Sintassi: /listuperms [mondo]" - messages: - level_not_exist: "Il mondo %var0% non esiste." - no_user_perms: "Il giocatore %var0% non ha permessi." - user_perms_list: "Lista dei permessi del giocatore %var0% (%var1% / %var2%) : " - ppinfo: - desc: "Mostra informazioni riguardo PurePerms, il suo autore, ecc." - messages: - ppinfo_console: "Stai usando PurePerms v%var0% sviluppato da %var1%." - ppinfo_player: "Questo server usa PurePerms v%var0% sviluppato da %var1%." - ppreload: - desc: "Ricarica le configurazioni di PurePerms." - messages: - successfully_reloaded: "Configurazioni ricaricate con successo." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "This account is already registered." - deauth_01: "This server uses Noeul v%var0% to protect your account." - deauth_02: "You must authenticate your account first." - deauth_03: "Please register or login to your account using /ppsudo command" - invalid_sender: "This command should be only used in-game." - login_usage: "Usage: /ppsudo login " - not_registered: "This account is not registered." - password_too_short: "Your password does NOT meet minimum length (%var0%) requirements." - register_usage: "Usage: /ppsudo register " - successfully_logged_in: "You are now logged in." - successfully_registered: "Your account has been successfully registered." - unregister_usage: "Usage: /ppsudo unregister " - rmgroup: - desc: "Rimuove un gruppo." - usage: "Sintassi: /rmgroup " - messages: - group_removed_successfully: "Il gruppo %var0% è stato rimosso con successo." - group_not_exist: "Il gruppo %var0% non esiste." - invalid_group_name: "Nome del gruppo non valido." - rmparent: - desc: "Removes a group from another group inheritance list." - usage: "Usage: /rmparent " - messages: - rmparent_successfully: "Removed %var0% from group %var1%'s inheritance list." - setgperm: - desc: "Aggiunge un permesso a un gruppo." - usage: "Sintassi: /setgperm [mondo]" - messages: - gperm_added_successfully: "Il permesso %var0% è stato aggiunto al gruppo con successo." - group_not_exist: "Il gruppo %var0% non esiste." - level_not_exist: "Il mondo %var0% non esiste." - setgroup: - desc: "Imposta un gruppo per un utente." - usage: "Sintassi: /setgroup [mondo]" - messages: - access_denied_01: "You don't have permission to set a player's group to %var0%." - access_denied_02: "You don't have permission to change group of a player with group %var0%." - group_not_exist: "Il gruppo %var0% non esiste." - level_not_exist: "Il mondo %var0% non esiste." - on_player_group_change: "Il tuo gruppo è stato cambiato in %var0%!" - setgroup_successfully: "%var0% aggiunto al gruppo con successo." - setuperm: - desc: "Aggiunge un permesso ad un utente." - usage: "Sintassi: /setuperm [mondo]" - messages: - level_not_exist: "Il mondo %var0% non esiste." - uperm_added_successfully: "Permesso %var0% aggiunto a %var1% con successo." - unsetgperm: - desc: "Rimuove un permesso a un gruppo." - usage: "Sintassi: /unsetgperm [mondo]" - messages: - gperm_removed_successfully: "Permesso %var0% rimosso al gruppo con successo." - group_not_exist: "Il gruppo %var0% non esiste." - level_not_exist: "Il mondo %var0% non esiste." - unsetuperm: - desc: "Rimuove un permesso a un utente." - usage: "Sintassi: /unsetuperm [mondo]" - messages: - level_not_exist: "Il mondo %var0% non esiste." - uperm_removed_successfully: "Permesso %var0% rimosso a %var1% con successo." - usrinfo: - desc: "Mostra informazioni riguardo un utente." - usage: "Sintassi: /usrinfo [mondo]" - messages: - level_not_exist: "Il mondo %var0% non esiste." - status_online: "ONLINE!" - status_offline: "OFFLINE..." - usrinfo_header: "-- Informazioni utente di %var0% --" - usrinfo_username: "NOME UTENTE: %var0%" - usrinfo_status: "STATO: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "ID UNIVOCO: %var0%" - usrinfo_group: "GRUPPO: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "SCONOSCIUTO" -logger_messages: - getConfigValue_01: "Chiave %var0% non trovata in config.yml." - getDefaultGroup_01: "Nel file dei gruppi sono stati dichiarati più gruppi predefiniti." - getDefaultGroup_02: "Nel file dei gruppi non c'è alcun gruppo predefinito." - getDefaultGroup_03: "Impostando automaticamente il gruppo predefinito." - getGroup_01: "Il gruppo %var0% non è stato trovato." - getGroup_02: "Il gruppo %var0% ha dati non validi o corrotti." - registerPlayer: "Registrando giocatore %var0%..." - setProvider_MySQL: "Il fornitore dati impostato è MySQL." - setProvider_JSON: "Il fornitore dati impostato è JSON" - setProvider_NotFound: "Il fornitore %var0% non esiste. Impostando il fornitore dati predefinito." - unregisterPlayer: "Togliendo la registrazione al giocatore %var0%..." - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." -... diff --git a/resources/messages-jp.yml b/resources/messages-jp.yml deleted file mode 100644 index 080b8a10..00000000 --- a/resources/messages-jp.yml +++ /dev/null @@ -1,166 +0,0 @@ -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Original Japanese Translation by onebone (jyc00410@gmail.com) -# Translated into fluent Japanese by haniokasai (11/04/2015) (htek@haniokasai.com, @haniokasai for Twitter) ---- -messages-version: "1.4.0_01" -language: "jp" -cmds: - addgroup: - desc: "新しいグループをリストに追加します。" - usage: "使用法: /addgroup <グループ>" - messages: - group_added_successfully: "%var0%をグループリストに追加しました。" - group_already_exists: "グループ%var0%はすでに存在しています。" - invalid_group_name: "存在しないグループ名です。" - addparent: - desc: "グループを別のグループの継承リストに追加します。." - usage: "使用法: /addparent <操作対象のグループ> <親グループ>" - messages: - addparent_successfully: "%var0%をグループ %var1%の継承リストに追加しました." - target_already_inherits: "グループ %var0% は 継承リストに既に追加されています %var1%." - defgroup: - desc: "デフォルトのグループを決めることを許可します。" - usage: "使い方: /defgroup <グループ> [ワールド]" - messages: - defgroup_successfully: "デフォルトのグループは %var0%に設定されました." - group_not_exist: "グループ%var0%は存在しません。" - level_not_exist: "ワールド%var0%は存在しません。" - fperms: - desc: "特定のプラグインの権限リストを表示します。" - usage: "使用法: /fperms <プラグイン>" - messages: - no_plugin_perms: "プラグイン%var0%は何の権限も持っていません。" - plugin_not_exist: "プラグイン%var0%は存在しません。" - plugin_perms_list: "プラグイン%var0%の権限 (%var1% / %var2%) : " - groups: - desc: "グループリストを表示します。" - messages: - all_registered_groups: "グループリスト:%var0%" - grpinfo: - desc: "グループについての情報を表示します。" - usage: "使用法: /grpinfo <グループ> [ワールド]" - messages: - group_not_exist: "グループ%var0%は存在しません。" - grpinfo_header: "-- %var0% のグループ情報 --" - grpinfo_alias: "エイリアス: %var0%" - grpinfo_default: "デフォルト: %var0%" - grpinfo_parents: "親: %var0%" - level_not_exist: "ワールド%var0%は存在しません。" - listgperms: - desc: "グループの権限のリストを表示します。" - usage: "使用法: /listgperms <グループ> <ページ> [ワールド]" - messages: - group_not_exist: "グループ%var0%は存在しません。" - group_perms_list: "%var0%のグループの権限一覧を表示します (%var1% / %var2%) : " - level_not_exist: "ワールド%var0%は存在しません。" - no_group_perms: "グループ%var0%は何の権限も持っていません。" - listuperms: - desc: "プレーヤーの権限を表示します。" - usage: "使用法: /listuperms <プレーヤー> <ページ> [ワールド]" - messages: - level_not_exist: "ワールド%var0%は存在しません。" - no_user_perms: "プレーヤー%var0%は何の権限も持っていません。" - user_perms_list: "%var0%の権限を表示します (%var1% / %var2%) : " - ppinfo: - desc: "PurePermsの情報、例えば作成者、バージョン、など" - messages: - ppinfo_console: "いまあなたはPurePerms v%var0% by %var1%を使っています。" - ppinfo_player: "このサーバーはPurePerms v%var0% by %var1%を使っています。" - ppreload: - desc: "全てのPurePerms設定をリロードします。" - messages: - successfully_reloaded: "全てのプラグインの設定がリロードされました。" - ppsudo: - desc: "登録またはノウル アカウントにログインします。" - usage: "Usage: /ppsudo " - messages: - already_registered: "このアカウントは既に登録されています" - deauth_01: "ノウル v %var0% は、あなたのアカウントを保護するために使用されます。" - deauth_02: "まずあなたのアカウントを認証する必要があります。" - deauth_03: "ログインまたは登録をして、/ppsudo コマンドを使ってください" - invalid_sender: "このコマンドはゲーム内のみで使用できます" - login_usage: "使用法: /ppsudo login <パスワード>" - not_registered: "このアカウントは登録されていません" - password_too_short: "パスワードは(%var0%)文字以上必要です" - register_usage: "Usage: /ppsudo register <パスワード>" - successfully_logged_in: "ログインしました" - successfully_registered: "あなたのアカウントは登録されました" - unregister_usage: "Usage: /ppsudo unregister <パスワード>" - rmgroup: - desc: "グループを削除します。" - usage: "使用法: /rmgroup <グループ>" - messages: - group_removed_successfully: "グループ%var0%を削除しました。" - group_not_exist: "グループ%var0%は存在しません。" - invalid_group_name: "存在しないグループ名です。" - rmparent: - desc: "別のグループの継承リストからグループを削除します。" - usage: "使い方: /rmparent <操作対象のグループ> <親グループ>" - messages: - rmparent_successfully: "%var0%を、グループ%var1%'の継承リストから削除しました" - setgperm: - desc: "グループに権限を追加します。" - usage: "使用法: /setgperm <グループ> <権限> [ワールド]" - messages: - gperm_added_successfully: "権限%var0%をグループに追加しました。" - group_not_exist: "グループ%var0%は存在しません。" - level_not_exist: "ワールド%var0%は存在しません。" - setgroup: - desc: "プレーヤーのグループを設定します。" - usage: "使用法: /setgroup <プレーヤー> <グループ> [ワールド]" - messages: - access_denied_01: "あなたはプレイヤーのグループを%var0%にする権限がありません。" - access_denied_02: "あなたはグループを持つ%var0%プレイヤーのグループを変える権限がありません。" - group_not_exist: "グループ%var0%は存在しません。" - level_not_exist: "ワールド%var0%は存在しません。" - on_player_group_change: "あなたのグループは%var0%に変わりました!" - setgroup_successfully: "%var0%をグループに追加しました。" - setuperm: - desc: "権限をプレーヤーに追加します。" - usage: "使用法: /setuperm <プレーヤー> <権限> [ワールド]" - messages: - level_not_exist: "ワールド%var0%は存在しません。" - uperm_added_successfully: "権限%var0%を%var1%に追加しました。" - unsetgperm: - desc: "グループから権限を削除します。" - usage: "使用法: /unsetgperm <グループ> <権限> [ワールド]" - messages: - gperm_removed_successfully: "権限%var0%をグループから削除しました。" - group_not_exist: "グループ%var0%は存在しません。" - level_not_exist: "ワールド%var0%は存在しません。" - unsetuperm: - desc: "プレーヤーから権限を削除します。" - usage: "使用法: /unsetuperm <プレーヤー> <権限> [ワールド]" - messages: - level_not_exist: "ワールド%var0%は存在しません。" - uperm_removed_successfully: "権限%var0%をグループ%var1%から削除しました。" - usrinfo: - desc: "プレーヤーの情報を表示します。" - usage: "使用法: /usrinfo <プレーヤー> [ワールド]" - messages: - level_not_exist: "ワールド%var0%は存在しません。" - status_online: "オンライン!" - status_offline: "オフライン..." - usrinfo_header: "-- %var0%の情報 --" - usrinfo_username: "名前: %var0%" - usrinfo_status: "状態: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "ユニークID: %var0%" - usrinfo_group: "グループ: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "不明" -logger_messages: - getConfigValue_01: "キー%var0%はconfig.ymlにありませんでした。" - getDefaultGroup_01: "基本グループが2つ以上に設定されています。" - getDefaultGroup_02: "基本グループが設定されていません。" - getDefaultGroup_03: "基本グループを自動的に設定します。" - getGroup_01: "グループ%var0%は存在しません。" - getGroup_02: "グループ%var0%は不正です。" - registerPlayer: "プレイヤーを%var0%に登録しています..." - setProvider_MySQL: "MYSQLにデーター管理方式が設定されました。" - setProvider_JSON: "YAMLv1にデーター管理方式が設定されました。" - setProvider_NotFound: "データー管理方式%var0%は存在しません。デフォルトの方式に設定しました。" - unregisterPlayer: "プレイヤーを%var0%から解除してます..." - YAMLProvider_InvalidGroupsSettings: "GROUPS.YMLの設定が間違っています: groups.yml が無効、または壊れているかどうかに確認してください。" -‌... diff --git a/resources/messages-ko.yml b/resources/messages-ko.yml deleted file mode 100644 index aa92e91b..00000000 --- a/resources/messages-ko.yml +++ /dev/null @@ -1,168 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Korean message resource by @64FF00 (GitHub) - -# 제 블로그 이외에 허락없이 마음대로 플러그인 배포하실 시에는 바로 한국어 파일 삭제 조치하고 공유 중단합니다 - ---- -messages-version: "1.4.0_01" -language: "ko" -cmds: - addgroup: - desc: "새로운 그룹을 추가합니다." - usage: "사용법: /addgroup <추가할 그룹 이름>" - messages: - group_added_successfully: "그룹 %var0%이 추가되었습니다." - group_already_exists: "%var0%이라는 이름을 가진 그룹이 이미 존재합니다." - invalid_group_name: "올바르지 않은 그룹 이름입니다." - addparent: - desc: "선택한 그룹에 새로운 부모 그룹을 추가합니다." - usage: "사용법: /addparent <부모 그룹을 추가할 그룹 이름> <부모 그룹>" - messages: - addparent_successfully: "이제 그룹 %var1%은 그룹 %var0%의 모든 퍼미션을 상속받습니다." - target_already_inherits: "그룹 %var1%는 이미 %var0%의 부모 그룹입니다." - defgroup: - desc: "처음 들어온 플레이어가 속하게 될 기본 그룹을 설정합니다." - usage: "사용법: /defgroup <그룹 이름> [월드 이름]" - messages: - defgroup_successfully: "기본 그룹이 %var0%로 설정되었습니다." - group_not_exist: "%var0%이라는 이름을 가진 그룹이 존재하지 않습니다." - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다." - fperms: - desc: "특정 플러그인이 가진 모든 퍼미션 목록을 보여줍니다." - usage: "사용법: /fperms <플러그인 이름>" - messages: - no_plugin_perms: "플러그인 %var0%은 어떠한 퍼미션도 가지고 있지 않습니다." - plugin_not_exist: "%var0%이라는 이름을 가진 플러그인이 존재하지 않습니다." - plugin_perms_list: "플러그인 %var0%의 모든 퍼미션 (현재 페이지 %var1% / 전체 페이지 %var2%) : " - groups: - desc: "모든 그룹 목록을 보여줍니다." - messages: - all_registered_groups: "모든 그룹: %var0%" - grpinfo: - desc: "그룹 정보를 보여줍니다. (별칭, 부모 그룹 등)" - usage: "사용법: /grpinfo <정보를 볼 그룹> [월드 이름]" - messages: - group_not_exist: "%var0%이라는 이름을 가진 그룹이 존재하지 않습니다." - grpinfo_header: "-- %var0%의 그룹 정보 --" - grpinfo_alias: "별칭: %var0%" - grpinfo_default: "디폴트 그룹인가요: %var0%" - grpinfo_parents: "부모 그룹: %var0%" - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다." - listgperms: - desc: "그룹의 모든 퍼미션들을 보여줍니다." - usage: "사용법: /listgperms <퍼미션을 볼 그룹> <페이지> [월드 이름]" - messages: - group_not_exist: "%var0%이라는 이름을 가진 그룹이 존재하지 않습니다." - group_perms_list: "그룹 %var0%의 모든 퍼미션 (현재 페이지 %var1% / 전체 페이지 %var2%) : " - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다." - no_group_perms: "그룹 %var0%은 어떠한 퍼미션도 가지고 있지 않습니다." - listuperms: - desc: "플레이어의 모든 고유 퍼미션들을 보여줍니다." - usage: "사용법: /listuperms <퍼미션을 볼 플레이어> <페이지> [월드 이름]" - messages: - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다." - no_user_perms: "플레이어 %var0%는 어떠한 퍼미션도 가지고 있지 않습니다." - user_perms_list: "플레이어 %var0%의 모든 퍼미션 (현재 페이지 %var1% / 모든 페이지 %var2%) : " - ppinfo: - desc: "PurePerms 플러그인 정보를 보여줍니다." - messages: - ppinfo_console: "현재 PurePerms v%var0% 버전을 사용하고 계십니다! (제작자: %var1%)" - ppinfo_player: "이 서버는 PurePerms v%var0% 버전을 사용하고 있습니다. (제작자: %var1%)" - ppreload: - desc: "모든 PurePerms 설정 파일들을 다시 로드합니다." - messages: - successfully_reloaded: "모든 설정 파일들이 다시 로드되었습니다." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "This account is already registered." - deauth_01: "This server uses Noeul v%var0% to protect your account." - deauth_02: "You must authenticate your account first." - deauth_03: "Please register or login to your account using /ppsudo command" - invalid_sender: "This command should be only used in-game." - login_usage: "Usage: /ppsudo login " - not_registered: "This account is not registered." - password_too_short: "Your password does NOT meet minimum length (%var0%) requirements." - register_usage: "Usage: /ppsudo register " - successfully_logged_in: "You are now logged in." - successfully_registered: "Your account has been successfully registered." - unregister_usage: "Usage: /ppsudo unregister " - rmgroup: - desc: "그룹을 제거합니다." - usage: "사용법: /rmgroup <제거할 그룹 이름>" - messages: - group_removed_successfully: "그룹 %var0%이 제거되었습니다." - group_not_exist: "%var0%이라는 이름을 가진 그룹이 존재하지 않습니다." - invalid_group_name: "올바르지 않은 그룹 이름입니다." - rmparent: - desc: "선택한 그룹에서 부모 그룹을 제거합니다." - usage: "사용법: /rmparent <부모 그룹을 제거할 그룹 이름> <부모 그룹>" - messages: - rmparent_successfully: "이제 그룹 %var1%은 더 이상 그룹 %var1%의 퍼미션을 상속받지 않습니다." - setgperm: - desc: "그룹에 퍼미션을 추가합니다." - usage: "사용법: /setgperm <퍼미션을 추가할 그룹> <퍼미션> [월드 이름]" - messages: - gperm_added_successfully: "퍼미션 %var0%을 그룹에 추가하였습니다." - group_not_exist: "%var0%이라는 이름을 가진 그룹이 존재하지 않습니다." - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다." - setgroup: - desc: "플레이어의 그룹을 설정합니다." - usage: "사용법: /setgroup <그룹을 설정할 플레이어> <그룹 이름> <만료 시간> [월드 이름]" - messages: - access_denied_01: "플레이어 그룹을 %var0%으로 설정할 수 있는 권한이 없습니다." - access_denied_02: "그룹 %var0%에 속한 플레이어의 그룹을 변경할 수 있는 권한이 없습니다." - group_not_exist: "%var0%이라는 이름을 가진 그룹이 존재하지 않습니다." - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다." - on_player_group_change: "축하드립니다! 그룹이 %var0%으로 변경되었습니다!" - setgroup_successfully: "플레이어 %var0%을 그룹에 추가했습니다." - setuperm: - desc: "플레이어에 고유 퍼미션을 추가합니다." - usage: "사용법: /setuperm <퍼미션을 추가할 플레이어> <퍼미션> [월드 이름]" - messages: - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다." - uperm_added_successfully: "퍼미션 %var0%을 그룹 %var1%에 추가하였습니다." - unsetgperm: - desc: "그룹의 퍼미션을 제거합니다." - usage: "사용법: /unsetgperm <퍼미션을 제거할 그룹 이름> <퍼미션> [월드 이름]" - messages: - gperm_removed_successfully: "퍼미션 %var0%이 그룹에서 제거되었습니다." - group_not_exist: "%var0%이라는 이름을 가진 그룹이 존재하지 않습니다." - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다." - unsetuperm: - desc: "플레이어의 고유 퍼미션을 제거합니다." - usage: "사용법: /unsetuperm <퍼미션을 제거할 플레이어> <퍼미션> [월드 이름]" - messages: - level_not_exist: "%var0%이라는 이름을 가진 월드가 존재하지 않습니다. " - uperm_removed_successfully: "플레이어 %var1%의 퍼미션 %var0%가 제거되었습니다." - usrinfo: - desc: "플레이어의 정보를 보여줍니다. (접속 상태, 그룹 등)" - usage: "사용법: /usrinfo <정보를 볼 플레이어> [월드 이름]" - messages: - status_online: "온라인입니다! :D" - status_offline: "오프라인이네요 :'(" - usrinfo_header: "-- %var0%의 플레이어 정보 --" - usrinfo_username: "플레이어 이름: %var0%" - usrinfo_status: "접속 상태: %var0%" - usrinfo_ip: "아이피: %var0%" - usrinfo_uuid: "유니크 ID: %var0%" - usrinfo_group: "그룹: %var0%" - usrinfo_exp: "만료 시간: %var0%" - unknown: "알 수 없음" -logger_messages: - getConfigValue_01: "config.yml에서 %var0%의 값을 찾을 수 없습니다." - getDefaultGroup_01: "하나 이상의 기본 그룹이 설정되어있습니다." - getDefaultGroup_02: "기본 그룹을 groups.yml에서 찾을 수 없습니다." - getDefaultGroup_03: "기본 그룹을 자동으로 설정하는 중입니다..." - getGroup_01: "그룹 %var0%를 찾을 수 없습니다." - getGroup_02: "그룹 %var0%가 잘못되었거나 손상된 데이터를 포함하고 있습니다." - registerPlayer: "플레이어 %var0% 등록 중..." - setProvider_MySQL: "MySQL 형식으로 데이터가 저장됩니다." - setProvider_JSON: "YAMLv1 방식으로 데이터가 저장됩니다." - setProvider_Invalid: "올바르지 않은 데이터 저장 방식입니다. 자동으로 YAML 방식으로 데이터가 저장됩니다." - unregisterPlayer: "플레이어 %var0% 등록 해제 중..." - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." -... \ No newline at end of file diff --git a/resources/messages-ru.yml b/resources/messages-ru.yml deleted file mode 100644 index 033358b9..00000000 --- a/resources/messages-ru.yml +++ /dev/null @@ -1,167 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Russian language resource by @0-Eclipse-0, @vvzar, @Pub4Game and @seetch - ---- -messages-version: "1.4.0_01" -language: "ru" -cmds: - addgroup: - desc: "Добавляет новую группу в списке групп." - usage: "Использование: /addgroup <группа>" - messages: - group_added_successfully: "Добавлено %var0% к списку групп успешно." - group_already_exists: "Группа %var0% уже существует." - invalid_group_name: "Неверный Название группы." - addparent: - desc: "Добавляет группы в другую списке наследования." - usage: "Применение: /addparent " - messages: - addparent_successfully: "Добавлено %var0% до группового %var1%'s список наследования." - target_already_inherits: "Группа %var0% уже наследует %var1%." - defgroup: - desc: "Изменяет группу по умолчанию." - usage: "Применение: /defgroup <группа> [мир]" - messages: - defgroup_successfully: "По умолчанию группа успешно установлен на %var0%." - group_not_exist: "Группа %var0% не существует." - level_not_exist: "Всемирный %var0% не существует." - fperms: - desc: "Показывает список всех разрешений для указанного плагина." - usage: "Применение: /fperms <плагин>" - messages: - no_plugin_perms: "Плагин %var0% не имеют никаких разрешений." - plugin_not_exist: "Плагин %var0% не существует." - plugin_perms_list: "Список всех разрешений плагин из %var0% (%var1% / %var2%) : " - groups: - desc: "Показывает список всех групп." - messages: - all_registered_groups: "Все зарегистрированные группы: %var0%" - grpinfo: - desc: "Показывает информацию о группе." - usage: "Применение: /grpinfo <группа> [мир]" - messages: - group_not_exist: "Группа %var0% не существует." - grpinfo_header: "-- Информация о группе %var0% --" - grpinfo_alias: "псевдоним: %var0%" - grpinfo_default: "По умолчанию: %var0%" - grpinfo_parents: "Родители: %var0%" - level_not_exist: "Всемирный %var0% не существует." - listgperms: - desc: "Показывает список всех разрешений для группы." - usage: "Применение: /listgperms <группа> <страница> [мир]" - messages: - group_not_exist: "Группа %var0% не существует." - group_perms_list: "Список всех разрешений для группы %var0% (%var1% / %var2%):" - level_not_exist: "Мир %var0% не существует." - no_group_perms: "У группы %var0% нет никаких разрешений." - listuperms: - desc: "Показывает список всех разрешений для указанного игрока." - usage: "Применение: /listuperms <игрок> <страница> [мир]" - messages: - level_not_exist: "Мир %var0% не существует." - no_user_perms: "У игрока %var0% нет никаких пользовательских разрешений." - user_perms_list: "Список всех разрешений для игрока %var0% (%var1% / %var2%):" - ppinfo: - desc: "Показывает всю информацию о плагине PurePerms, включая версию, автора и т.д." - messages: - ppinfo_console: "Вы используете PurePerms версии v%var0% от %var1%." - ppinfo_player: "На этом сервере используется PurePerms версии %var0% от %var1%." - ppreload: - desc: "Перезагружает все настройки PurePerms." - messages: - successfully_reloaded: "Все настройки плагина были успешно перезагружены." - ppsudo: - desc: "Регистры или журналы в вашем Noeul внимание." - usage: "Применение: /ppsudo <авторизоваться / регистр>" - messages: - already_registered: "Этот аккаунт уже зарегистрирован." - deauth_01: "Этот сервер использует Noeul v%var0% для защиты вашей учетной записи." - deauth_02: "Вы должны авторизоваться в вашей учетной записи." - deauth_03: "Пожалуйста зарегистрируйтесь или войдите в вашу учетную запись, используя /ppsudo command" - invalid_sender: "Команда должна выполнятся в игре!" - login_usage: "Используйте: /ppsudo login <пароль>" - not_registered: "Аккаунт не зарегистрирован." - password_too_short: "Ваш пароль не соответствует минимальной длине (%var0%)." - register_usage: "Используйте: /ppsudo register <пароль>" - successfully_logged_in: "Вы вошли." - successfully_registered: "Ваша учетная запись была успешно зарегистрирован." - unregister_usage: "Используйте: /ppsudo unregister <пароль>" - rmgroup: - desc: "Удаляет указанную группу." - usage: "Применение: /rmgroup <группа>" - messages: - group_removed_successfully: "Группа %var0% успешно удалена." - group_not_exist: "Группа %var0% не существует." - invalid_group_name: "Недопустимое название для группы." - rmparent: - desc: "Удаляет группу из другой группы списке наследования." - usage: "Применение: /rmparent " - messages: - rmparent_successfully: "Удалены %var0%от группы %var1%'s наследование список." - setgperm: - desc: "Добавляет разрешение группе." - usage: "Применение: /setgperm <группа> <разрешение> [мир]" - messages: - gperm_added_successfully: "Разрешение %var0% успешно добавлено в группу." - group_not_exist: "Группа %var0% не существует." - level_not_exist: "Мир %var0% не существует." - setgroup: - desc: "Добавляет игрока в группу." - usage: "Применение: /setgroup <игрок> <группа> [мир]" - messages: - access_denied_01: "Вы не вправе устанавливать группу игрока чтобы %var0%." - access_denied_02: "Вы не имеет права изменить группу игрока с группой %var0%." - group_not_exist: "Группа %var0% не существует." - level_not_exist: "Мир %var0% не существует." - on_player_group_change: "Ваша группа изменена на %var0%!" - setgroup_successfully: "Игрок %var0% успешно добавлен в группу." - setuperm: - desc: "Добавляет разрешение пользователю." - usage: "Применение: /setuperm <игрок> <разрешение> [мир]" - messages: - level_not_exist: "Мир %var0% не существует." - uperm_added_successfully: "Разрешение %var0% успешно добавлено игроку %var1%." - unsetgperm: - desc: "Отбирает разрешение у группы." - usage: "Применение: /unsetgperm <группа> <разрешение> [мир]" - messages: - gperm_removed_successfully: "Разрешение %var0% успешно отобрано у группы." - group_not_exist: "Группа %var0% не существует." - level_not_exist: "Мир %var0% не существует." - unsetuperm: - desc: "Отбирает разрешение у игрока." - usage: "Применение: /unsetuperm <игрок> <разрешение> [мир]" - messages: - level_not_exist: "Мир %var0% не существует." - uperm_removed_successfully: "Разрешение %var0% успешно отобрано у игрока %var1%." - usrinfo: - desc: "Показывает информацию об игроке." - usage: "Пример: /usrinfo <игрок> [мир]" - messages: - level_not_exist: "Мир %var0% не существует." - status_online: "ОНЛАЙН!" - status_offline: "НЕ В ИГРЕ." - usrinfo_header: "<--- Информация об игроке %var0% --->" - usrinfo_username: "ИГРОК: %var0%" - usrinfo_status: "СТАТУС: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "УНИКАЛЬНЫЙ ID: %var0%" - usrinfo_group: "ГРУППА: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "Неизвестно" -logger_messages: - getConfigValue_01: "Ключ %var0% не найден в файле config.yml." - getDefaultGroup_01: "Было указано более одной группы, назначаемой по-умолчанию в файле groups.yml." - getDefaultGroup_02: "Не обнаружено ни одной группы, назначаемой по-умолчанию в файле groups.yml." - getDefaultGroup_03: "Группа с параметром Default назначается автоматически." - getGroup_01: "Группа %var0% не найдена." - getGroup_02: "Группа %var0% имеет неправильные или поврежденные данные." - registerPlayer: "Регистрация игрока %var0%..." - setProvider_MySQL: "Тип хранилища данных - MySQL." - setProvider_JSON: "Тип хранилища данных - JSON" - setProvider_NotFound: "Провайдер данных %var0% не существует. Устанавливается стандартный тип хранилища данных." - unregisterPlayer: "Отмена регистрации игрока %var0%..." - YAMLProvider_InvalidGroupsSettings: "недействительный GROUPS.YML НАСТРОЙКИ: Пожалуйста, проверьте, если у вас есть недопустимое или поврежден groups.yml." -... \ No newline at end of file diff --git a/resources/messages-sk.yml b/resources/messages-sk.yml deleted file mode 100644 index 29f37b42..00000000 --- a/resources/messages-sk.yml +++ /dev/null @@ -1,167 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Slovak message resource by @Michael2010117 (GitHub) - ---- -messages-version: "1.4.0_01" -language: "sk" -cmds: - addgroup: - desc: "Pridat novu skupinu do skupin." - usage: "Pouzitie: /addgroup " - messages: - group_added_successfully: "%var0% Skupina bola uspesne nahrana." - group_already_exists: "Skupina %var0% uz existuje." - invalid_group_name: "Invalid Group Name." - addparent: - desc: "Adds a group to another group inheritance list." - usage: "Usage: /addparent " - messages: - addparent_successfully: "Added %var0% to group %var1%'s inheritance list." - target_already_inherits: "Group %var0% already inherits %var1%." - defgroup: - desc: "Umoznuje nastavit vychodiskove skupiny." - usage: "Pouzitie: /defgroup [Svet]" - messages: - defgroup_successfully: "Vychozi skupina bola uspesne nastavena%var0%." - group_not_exist: "Skupina %var0% neexistuje." - level_not_exist: "Svet %var0% neexistuje." - fperms: - desc: "Zobrazi zoznam vsetkych povoleni pre konkretne pluginy." - usage: "Pouzitie: /fperms " - messages: - no_plugin_perms: "Plugin %var0% nema ziadne opravnenie." - plugin_not_exist: "Plugin %var0% neexistuje." - plugin_perms_list: "Zoznam vsetkych povolenych pluginov %var0% (%var1% / %var2%) : " - groups: - desc: "Ukazat list vsetkych skupin." - messages: - all_registered_groups: "Vsetky registrovane skupiny: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Pouzitie: /grpinfo [Svet]" - messages: - group_not_exist: "Skupina %var0% neexistuje." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "Svet %var0% neexistuje." - listgperms: - desc: "Ukazat zoznam vsetkych prav pre skupiny." - usage: "Pouzitie: /listgperms [Svet]" - messages: - group_not_exist: "Skupina %var0% neexistuje." - group_perms_list: "Zoznam prav vsetkych skupin od %var0% (%var1% / %var2%) : " - level_not_exist: "Svet %var0% neexistuje." - no_group_perms: "Skupina %var0% nema ziadne skupinove prava." - listuperms: - desc: "Zobrazi zoznam vsetkych povoleni od uzivatele." - usage: "Pouzitie: /listuperms [Svet]" - messages: - level_not_exist: "Svet %var0% neexistuje." - no_user_perms: "Hrac %var0% nema ziadne uzivatelske opravnenie." - user_perms_list: "Zoznam vsetkych uzivatelskych prav od %var0% (%var1% / %var2%) : " - ppinfo: - desc: "Prijimajte aktualny PurePerms informacie, vratane autora, verzia, atd." - messages: - ppinfo_console: "Prave pouzivas PurePerms v%var0% od %var1%." - ppinfo_player: "Tento server pouziva PurePerms v%var0% by %var1%." - ppreload: - desc: "Znovu nacita vsetky konfiguracie PurePerms." - messages: - successfully_reloaded: "Vsetky konfiguracie a pluginy boli uspesne obnovene." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "This account is already registered." - deauth_01: "This server uses Noeul v%var0% to protect your account." - deauth_02: "You must authenticate your account first." - deauth_03: "Please register or login to your account using /ppsudo command" - invalid_sender: "This command should be only used in-game." - login_usage: "Usage: /ppsudo login " - not_registered: "This account is not registered." - password_too_short: "Your password does NOT meet minimum length (%var0%) requirements." - register_usage: "Usage: /ppsudo register " - successfully_logged_in: "You are now logged in." - successfully_registered: "Your account has been successfully registered." - unregister_usage: "Usage: /ppsudo unregister " - rmgroup: - desc: "Vymaze skupinu zo zoznamu skupin." - usage: "Pouzitie: /rmgroup " - messages: - group_removed_successfully: "Odstraneni %var0% skupiny zo zoznamu skupin prebehlo uspesne." - group_not_exist: "Skupina %var0% neexistuje." - invalid_group_name: "Invalid Group Name." - rmparent: - desc: "Removes a group from another group inheritance list." - usage: "Usage: /rmparent " - messages: - rmparent_successfully: "Removed %var0% from group %var1%'s inheritance list." - setgperm: - desc: "Prida opravneni skupiny." - usage: "Pouzitie: /setgperm [Svet]" - messages: - gperm_added_successfully: "Opravnenie %var0% ku skupine bolo uspesne pridane." - group_not_exist: "Skupina %var0% neexistuje." - level_not_exist: "Svet %var0% neexistuje." - setgroup: - desc: "Nastavi skupinu pre uzivatele." - usage: "Pouzitie: /setgroup [Svet]" - messages: - access_denied_01: "You don't have permission to set a player's group to %var0%." - access_denied_02: "You don't have permission to change group of a player with group %var0%." - group_not_exist: "Skupina %var0% neexistuje." - level_not_exist: "Svet %var0% neexistuje." - on_player_group_change: "Tvoja skupina bola zmenena na %var0%!" - setgroup_successfully: "Uspesne %var0% pridane do skupiny." - setuperm: - desc: "Pridane opravneni uzivatelia." - usage: "Pouzitie: /setuperm [Svet]" - messages: - level_not_exist: "Svet %var0% neexistuje." - uperm_added_successfully: "Opravneny %var0% do %var1% pridane uspesne." - unsetgperm: - desc: "Maze opravnenie zo skupiny." - usage: "Pouzitie: /unsetgperm [Svet]" - messages: - gperm_removed_successfully: "Opravnenie %var0% zo skupiny bolo uspesne pridane." - group_not_exist: "Skupina %var0% neexistuje." - level_not_exist: "Svet %var0% neexistuje." - unsetuperm: - desc: "Maze opravnenia z uzivatela." - usage: "Pouzitie: /unsetuperm [Svet]" - messages: - level_not_exist: "Svet %var0% neexistuje." - uperm_removed_successfully: "Opravneni smazano %var0% od %var1% uspesne." - usrinfo: - desc: "Ukazuje informacie o uzivateloch." - usage: "Pouizit: /usrinfo [Svet]" - messages: - level_not_exist: "Svet %var0% neexistuje." - status_online: "ONLINE!" - status_offline: "OFFLINE..." - usrinfo_header: "-- Informacie pre uzivatelov %var0% --" - usrinfo_username: "UZIVATELSKE JMENO: %var0%" - usrinfo_status: "STATUS: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "UNYKATNE ID: %var0%" - usrinfo_group: "SKUPINA: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "NEZNAMY" -logger_messages: - getConfigValue_01: "Klic %var0% nebol najdeny v config.yml." - getDefaultGroup_01: "Viac nez jedna vychodiskova skupina bola deklarovana v subore skupin." - getDefaultGroup_02: "Nebola najdena vychodiskova skupina." - getDefaultGroup_03: "Automaticke nastavovanie vychodiskove skupiny." - getGroup_01: "Skupina %var0% nenajdena" - getGroup_02: "Skupina %var0% ma neplatny alebo poskodeny data" - registerPlayer: "Registering player %var0%..." - setProvider_MySQL: "Nastavte poskytovatela dat na MySQL." - setProvider_JSON: "Nastavte poskytovatela dat na JSON." - setProvider_NotFound: "Poskytovatel %var0% nastavujem sprostredkovatela dat na predvolene nastavenia." - unregisterPlayer: "Unregistering player %var0%..." - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." -... \ No newline at end of file diff --git a/resources/messages-sp.yml b/resources/messages-sp.yml deleted file mode 100644 index e015ebf3..00000000 --- a/resources/messages-sp.yml +++ /dev/null @@ -1,169 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Original Spanish message resource by @JoahDave (GitHub) -# Fixed "ALMOST EVERYTHING" by @iksaku (GitHub) (Follow me on Twitter: @iksaku2) [Hype! ( ^ω^ )] -# Fixed Some Errors and Translated some stuff By @TheKillerTacos - ---- -messages-version: "1.4.0_01" -language: "sp" -cmds: - addgroup: - desc: "Añade un nuevo grupo a la lista." - usage: "Uso: /addgroup " - messages: - group_added_successfully: "%var0% ha sido añadido a la lista de grupos." - group_already_exists: "El grupo %var0% ya existe." - invalid_group_name: "Nombre de grupo Invalido." - addparent: - desc: "Añade un grupo a otro grupo a la lista de Herencia." - usage: "Usage: /addparent " - messages: - addparent_successfully: "Añadido %var0% al grupo %var1% a la lista de Herencia." - target_already_inherits: "Grupo %var0% ya esta en la lista de Herencia %var1%." - defgroup: - desc: "Permite Poner el grupo Predeterminado." - usage: "Usage: /defgroup [mundo]" - messages: - defgroup_successfully: "Grupo Predeterminado a sido cambiado a %var0%." - group_not_exist: "El grupo %var0% NO existe." - level_not_exist: "El mundo %var0% NO existe." - fperms: - desc: "Muestra una lista con todos los permisos de un plugin." - usage: "Uso: /fperms " - messages: - no_plugin_perms: "El plugin %var0% no contiene ningún permiso." - plugin_not_exist: "El plugin %var0% NO existe." - plugin_perms_list: "Lista de permisos del plugin %var0% (%var1% / %var2%) : " - groups: - desc: "Muestra la lista de todos los grupos disponibles." - messages: - all_registered_groups: "Grupos registrados: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Uso: /grpinfo [mundo]" - messages: - group_not_exist: "El grupo %var0% NO existe." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "El mundo %var0% NO existe." - listgperms: - desc: "Muestra una lista con todos los permisos de un grupo." - usage: "Uso: /listgperms [mundo]" - messages: - group_not_exist: "El grupo %var0% NO existe." - group_perms_list: "Lista de permisos del grupo provenientes de %var0% (%var1% / %var2%) : " - level_not_exist: "El mundo %var0% NO existe." - no_group_perms: "El grupo %var0% no contiene ningun permiso." - listuperms: - desc: "Muestra todos los permisos de un usuario." - usage: "Uso: /listuperms [mundo]" - messages: - level_not_exist: "El mundo %var0% NO existe." - no_user_perms: "El usuario %var0% no tiene ningun permiso." - user_perms_list: "Lista de todos los permisos de usuario de %var0% (%var1% / %var2%) : " - ppinfo: - desc: "Obtén información de PurePerms, incluyendo autor, versión, etc... #iksaku" - messages: - ppinfo_console: "Actualmente estas utilizando PurePerms v%var0% por %var1%." - ppinfo_player: "Este servidor esta utlizando PurePerms v%var0% por %var1%." - ppreload: - desc: "Recarga las configuraciones de PurePerms." - messages: - successfully_reloaded: "Todas las configuraciones del plugin han sido recargadas." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "Esta cuenta ya esta registrada." - deauth_01: "El server usa Noeul v%var0% Para proteger tu cuenta." - deauth_02: "Debes auntenticar tu cuenta primero" - deauth_03: "Porfavor Registrate o logeate a tu acuenta usando /ppsudo command" - invalid_sender: "Este Comando solo se puede usar En-Juego." - login_usage: "Uso: /ppsudo login " - not_registered: "Esta cuenta no esta registrada." - password_too_short: "Tu Contraseña no tiene caracteres suficentes de (%var0%) Caracteres." - register_usage: "Uso: /ppsudo register " - successfully_logged_in: "Ya esta logeado!." - successfully_registered: "Tu Cuenta a sido Registrada!." - unregister_usage: "Uso: /ppsudo unregister " - rmgroup: - desc: "Elimina un grupo de la lista." - usage: "Uso: /rmgroup " - messages: - group_removed_successfully: "%var0% ha sido eliminado de la lista de grupos." - group_not_exist: "El grupo %var0% NO existe." - invalid_group_name: "Invalid Group Name." - rmparent: - desc: "Removes a group from another group inheritance list." - usage: "Usage: /rmparent " - messages: - rmparent_successfully: "Removed %var0% from group %var1%'s inheritance list." - setgperm: - desc: "Concede un permiso al grupo." - usage: "Uso: /setgperm [mundo]" - messages: - gperm_added_successfully: "Se ha añadido el permiso %var0% al grupo." - group_not_exist: "El grupo %var0% NO existe." - level_not_exist: "El mundo %var0% NO existe." - setgroup: - desc: "Coloca al usuario en un grupo." - usage: "Uso: /setgroup [mundo]" - messages: - access_denied_01: "No tienes permisos para Poner el jugador en el grupo %var0%." - access_denied_02: "No tienes permisos para Cambiar el grupo de un jugaro con el grupo %var0%." - group_not_exist: "El grupo %var0% NO existe." - level_not_exist: "El mundo %var0% NO existe." - on_player_group_change: "Tu Grupo a cambiado a %var0%!" - setgroup_successfully: "%var0% ha sido añadido al grupo." - setuperm: - desc: "Concede un permiso al usuario." - usage: "Uso: /setuperm [mundo]" - messages: - level_not_exist: "El mundo %var0% NO existe." - uperm_added_successfully: "Se le ha consedido el permiso %var0% a %var1%." - unsetgperm: - desc: "Revoca un permiso del grupo." - usage: "Uso: /unsetgperm [mundo]" - messages: - gperm_removed_successfully: "Se ha removido el permiso %var0% del grupo." - group_not_exist: "El grupo %var0% NO existe." - level_not_exist: "El mundo %var0% NO existe." - unsetuperm: - desc: "Revoca un permiso del usuario." - usage: "Uso: /unsetuperm [mundo]" - messages: - level_not_exist: "El mundo %var0% NO existe." - uperm_removed_successfully: "Se ha revocado el permiso %var0% de %var1%." - usrinfo: - desc: "Muestra información sobre el usuario." - usage: "Uso: /usrinfo [mundo]" - messages: - level_not_exist: "El mundo %var0% NO existe." - status_online: "¡En línea!" - status_offline: "Desconectado..." - usrinfo_header: "-- Información del usuario %var0% --" - usrinfo_username: "NOMBRE DE USUARIO: %var0%" - usrinfo_status: "ESTADO: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "ID ÚNICA: %var0%" - usrinfo_group: "GRUPO: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "DESCONOCIDO" -logger_messages: - getConfigValue_01: "La llave %var0% no ha sido encontrada en config.yml." - getDefaultGroup_01: "Se ha declarado más de un grupo como 'predeterminado' en el archivo de grupos." - getDefaultGroup_02: "No se ha encontrado ningún grupo 'predeterminado' en el archivo de grupos." - getDefaultGroup_03: "Estableciendo automáticamente el grupo 'predeterminado'." - getGroup_01: "No se ha encontrado el grupo %var0%" - getGroup_02: "El grupo %var0% contiene información inválida o corrupta" - registerPlayer: "Registrando el Usuario %var0%..." - setProvider_MySQL: "Utilizando MySQL como proveedor." - setProvider_JSON: "Utilizando JSON como proveedor." - setProvider_NotFound: "El proveedor %var0% NO existe. Utilizando el proveedor predeterminado." - unregisterPlayer: "DesRegistrando al Jugador %var0%..." - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." -... \ No newline at end of file diff --git a/resources/messages-tr.yml b/resources/messages-tr.yml deleted file mode 100644 index 186ac7b0..00000000 --- a/resources/messages-tr.yml +++ /dev/null @@ -1,167 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Turkish messages resource by @PainTR (GitHub) - ---- -messages-version: "1.4.0_01" -language: "tr" -cmds: - addgroup: - desc: "Grup listesine yeni grup eklersiniz." - usage: "Kullanış: /addgroup " - messages: - group_added_successfully: "%var0% grubu başarı ile gruplara eklendi." - group_already_exists: "%var0% grubu zaten bulunmakta." - invalid_group_name: "Geçersiz Grup İsmi." - addparent: - desc: "Başka bir grup için miras grubu listesi oluştur." - usage: "Kullanış: /addparent " - messages: - addparent_successfully: "%var0% adı grup %var1% adlı grubun miras listesine eklendi." - target_already_inherits: "%var0% grubu zaten %var1% adlı grubun miras listesinde." - defgroup: - desc: "Varsayılan grubu ayarlar." - usage: "Kullanış: /defgroup [dünya]" - messages: - defgroup_successfully: "Varsayılan grup %var0% grubuna değiştirildi." - group_not_exist: "%var0% adında bir grup yok." - level_not_exist: "%var0% adında bir dünya bulunmamakta." - fperms: - desc: "Belirlenen eklentinin yetkilerini listeler." - usage: "Kullanış: /fperms " - messages: - no_plugin_perms: "%var0% eklentisinin hiç bir yetkisi bulunmamakta." - plugin_not_exist: "%var0% eklentisi bulunamadı." - plugin_perms_list: "Belirlenen eklentinin bütün yetkileri %var0% (%var1% / %var2%) : " - groups: - desc: "Var olan grupları listeler." - messages: - all_registered_groups: "Var olan gruplar: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Usage: /grpinfo [dünya]" - messages: - group_not_exist: "%var0% adında bir grup yok." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "%var0% adında bir dünya bulunmamakta." - listgperms: - desc: "Bir grubun bütün yetkilerini listeler." - usage: "Kullanış: /listgperms [dünya]" - messages: - group_not_exist: "%var0% adında bir grup yok." - group_perms_list: "Belirlenen grubun bütün yetkileri %var0% (%var1% / %var2%) : " - level_not_exist: "%var0% adında bir dünya bulunmamakta." - no_group_perms: "%var0% adındaki grubun hiç bir yetkisi bulunmamakta." - listuperms: - desc: "Bir kullanıcının bütün yetkilerini listeler." - usage: "Kullanış: /listuperms [dünya]" - messages: - level_not_exist: "%var0% adında bir dünya yok." - no_user_perms: "%var0% adındaki kullanıcının hiç bir yetkisi bulunmamakta." - user_perms_list: "Belirlenen kullanıcının bütün yetkileri %var0% (%var1% / %var2%) : " - ppinfo: - desc: "Mevcut PupePerms kurucusunu, sürümünü vb. gösterir." - messages: - ppinfo_console: "Şuan PurePerms v%var0% sürümünü kullanıyorsunuz. By: %var1%" - ppinfo_player: "Bu sunucu PurePerms v%var0% sürümünü kullanıyor. By: %var1%" - ppreload: - desc: "Bütün PurePerms ayarlarını yeniden yükler." - messages: - successfully_reloaded: "Bütün eklenti ayarları başarı ile yeniden yüklendi." - ppsudo: - desc: "Noeul hesabınıza kayıt olursunuz veya giriş yaparsınız." - usage: "Kullanış: /ppsudo " - messages: - already_registered: "Bu hesap zaten kayıt oldu." - deauth_01: "Bu sunucu Noeul v%var0% sürümünü hesabınızı korumak için kullanıyor." - deauth_02: "Öncelikle hesabınıza giriş yapmanız gerekmektedir." - deauth_03: "Lütfen hesabınıza kayıt olun veya giriş yapınız: /ppsudo command" - invalid_sender: "Bu komut oyun içinde kullanılabilir." - login_usage: "Kullanış: /ppsudo login <şifre>" - not_registered: "Bu hesap kayıt olmadı." - password_too_short: "Şifreniz minimum karakter sayısının altında olmamalı (%var0%)" - register_usage: "Kullanış: /ppsudo register <şifre>" - successfully_logged_in: "Hesabınıza giriş yaptınız." - successfully_registered: "Hesabınız başarı ile kayıt oldu." - unregister_usage: "Kullanış: /ppsudo unregister <şifre>" - rmgroup: - desc: "Grup listesinden grup siler." - usage: "Kullanış: /rmgroup " - messages: - group_removed_successfully: "%var0% grubu grup listesinden başarı ile kaldırıldı." - group_not_exist: "%var0% adında bir grup bulunmamakta." - invalid_group_name: "Geçersiz Grup Adı." - rmparent: - desc: "Belirlenen grubun ana gruptan mirasını kaldırır." - usage: "Kullanış: /rmparent " - messages: - rmparent_successfully: "%var0% adlı grubun mirası %var1% adlı gruptan kaldırıldı." - setgperm: - desc: "Belirlenen gruba yetki ekler." - usage: "Kullanış: /setgperm [dünya]" - messages: - gperm_added_successfully: "%var0% yetkisi gruba başarı ile eklendi." - group_not_exist: "%var0% adında bir grup bulunmamakta." - level_not_exist: "%var0% adında bir dünya bulunmamakta." - setgroup: - desc: "Belirlenen kullanıcının grubunu belirler." - usage: "Usage: /setgroup [dünya]" - messages: - access_denied_01: "Belirlenen oyuncunun grubunu %var0% grubuna değiştirmeye yetkiniz yok." - access_denied_02: "Belirlenen oyuncunun grubunu %var0% grubuna değiştirmeye yetkiniz yok." - group_not_exist: "%var0% adında bir grup bulunmamakta." - level_not_exist: "%var0% adında bir dünya bulunmamakta." - on_player_group_change: "Grubunuz %var0% adlı gruba değiştirildi!" - setgroup_successfully: "%var0% adlı oyuncunun grubu başarı ile değiştirildi." - setuperm: - desc: "Belirlenen kullanıcıya yetki verir." - usage: "Kullanış: /setuperm [dünya]" - messages: - level_not_exist: "%var0% adında bir dünya bulunmamakta." - uperm_added_successfully: "%var0% yetkisi %var1% adlı oyuncuya başarı ile verildi." - unsetgperm: - desc: "Bir grubun yetkisini kaldırır." - usage: "Kullanış: /unsetgperm [dünya]" - messages: - gperm_removed_successfully: "%var0% yetkisi gruptan başarılı ile kaldırıldı." - group_not_exist: "%var0% adında bir grup bulunmamakta." - level_not_exist: "%var0% adında bir dünya bulunmamakta." - unsetuperm: - desc: "Bir kullanıcının yetkisini kaldırır." - usage: "Kullanış: /unsetuperm [dünya]" - messages: - level_not_exist: "%var0% adında bir dünya bulunmamakta." - uperm_removed_successfully: "%var0% yetkisi %var1% adlı oyuncudan başarı ile kaldırıldı." - usrinfo: - desc: "Bir kullanıcının bilgilerini listeler." - usage: "Kullanış: /usrinfo [dünya]" - messages: - level_not_exist: "%var0% adında bir dünya yok." - status_online: "ÇEVRİMİÇİ!" - status_offline: "ÇEVRİMDIŞI..." - usrinfo_header: "-- %var0% adlı kullanıcının bilgileri --" - usrinfo_username: "KULLANICI ADI: %var0%" - usrinfo_status: "DURUM: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "ÖZGÜN ID: %var0%" - usrinfo_group: "GRUP: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "BİLİNMİYOR" -logger_messages: - getConfigValue_01: "%var0% kilidi config.yml dosyasında bulunamadı." - getDefaultGroup_01: "Birden fazla varsayılan grup tespit edildi." - getDefaultGroup_02: "Groups dosyasında varsayılan grup ayarı bulunamadı." - getDefaultGroup_03: "Varsayılan grup otomatik ayarlandı." - getGroup_01: "%var0% adlı grup bulunamadı." - getGroup_02: "%var0% geçersiz veya bozuk veri içeriyor." - registerPlayer: "%var0% oyuncusu kayda geçirildi..." - setProvider_MySQL: "Veri sağlayıcısı MySQL ayarlandı." - setProvider_JSON: "Veri sağlayıcısı JSON ayarlandı." - setProvider_NotFound: "%var0% sağlayıcısı mevcut değil. Varsayılan veri sağlayıcısına değiştiriliyor." - unregisterPlayer: "%var0% adlı oyuncunun kaydı siliniyor..." - YAMLProvider_InvalidGroupsSettings: "BİLİNMEYEN GROUPS.YML AYARI: Lütfen groups.yml dosyasındaki geçersiz veya bozuk dosyaları kontrol edin." -... diff --git a/resources/messages-ua.yml b/resources/messages-ua.yml deleted file mode 100644 index 9a4036c9..00000000 --- a/resources/messages-ua.yml +++ /dev/null @@ -1,167 +0,0 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# Ukrainian messages resource by @samalero (GitHub) - ---- -messages-version: "1.4.0_01" -language: "ua" -cmds: - addgroup: - desc: "Додає нову групу в список груп" - usage: "Приклад: /addgroup <група>" - messages: - group_added_successfully: "Група %var0% успішно створена." - group_already_exists: "Помилка! Група %var0% вже існує." - invalid_group_name: "Неприпустима назва для групи." - addparent: - desc: "Adds a group to another group inheritance list." - usage: "Usage: /addparent " - messages: - addparent_successfully: "Added %var0% to group %var1%'s inheritance list." - target_already_inherits: "Group %var0% already inherits %var1%." - defgroup: - desc: "Змінює групу за замовчуванням." - usage: "Пример: /defgroup <група> [світ]" - messages: - defgroup_successfully: "Група за замовчуванням вдало змінена на %var0%." - group_not_exist: "Група %var0% не існує." - level_not_exist: "Світ %var0% не існує." - fperms: - desc: "Показує список всіх дозволів для вказаного плагіну." - usage: "Пример: /fperms <плагін>" - messages: - no_plugin_perms: "У плагіна %var0% немає ніяких дозволів." - plugin_not_exist: "Плагін %var0% не знайдено." - plugin_perms_list: "Список всіх дозволів для плагіну %var0% (%var1% / %var2%):" - groups: - desc: "Показує список всіх груп." - messages: - all_registered_groups: "Всі зарєстровані групи: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Приклад: /grpinfo <група> [світ]" - messages: - group_not_exist: "Група %var0% не існує." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "Світ %var0% не існує." - listgperms: - desc: "Показує список всіх дозволів для групи." - usage: "Приклад: /listgperms <група> <сторінка> [світ]" - messages: - group_not_exist: "Група %var0% не існує." - group_perms_list: "Список всіх дозволів для групи %var0% (%var1% / %var2%):" - level_not_exist: "Світ %var0% не існує." - no_group_perms: "У групи %var0% немає ніяких дозволів." - listuperms: - desc: "Показує список всіх дозволів для вказаного гравця." - usage: "Приклад: /listuperms <гравець> <сторінка> [світ]" - messages: - level_not_exist: "Світ %var0% не існує." - no_user_perms: "У гравця %var0% немає ніяких користувацьких дозволів." - user_perms_list: "Список всіх дозволів для гравця %var0% (%var1% / %var2%):" - ppinfo: - desc: "Показує всю інформацію про плагін PurePerms, включаючи версію, автора і т.д." - messages: - ppinfo_console: "Ви використовуєте PurePerms версії v%var0% від %var1%." - ppinfo_player: "На цьому сервері використовується PurePerms версії v%var0% від %var1%." - ppreload: - desc: "Перезавантажує всі налаштування PurePerms." - messages: - successfully_reloaded: "Всі налаштування плагіну були успішно перезавантажені." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "This account is already registered." - deauth_01: "This server uses Noeul v%var0% to protect your account." - deauth_02: "You must authenticate your account first." - deauth_03: "Please register or login to your account using /ppsudo command" - invalid_sender: "This command should be only used in-game." - login_usage: "Usage: /ppsudo login " - not_registered: "This account is not registered." - password_too_short: "Your password does NOT meet minimum length (%var0%) requirements." - register_usage: "Usage: /ppsudo register " - successfully_logged_in: "You are now logged in." - successfully_registered: "Your account has been successfully registered." - unregister_usage: "Usage: /ppsudo unregister " - rmgroup: - desc: "Видаляє указану групу." - usage: "Приклад: /rmgroup <група>" - messages: - group_removed_successfully: "Група %var0% успішно видалена." - group_not_exist: "Група %var0% не існує." - invalid_group_name: "Неприпустима назва для групи." - rmparent: - desc: "Removes a group from another group inheritance list." - usage: "Usage: /rmparent " - messages: - rmparent_successfully: "Removed %var0% from group %var1%'s inheritance list." - setgperm: - desc: "Додає дозвіл групі." - usage: "Приклад: /setgperm <група> <дозвіл> [світ]" - messages: - gperm_added_successfully: "Дозвіл %var0% успішно додано в групу." - group_not_exist: "Група %var0% не існує." - level_not_exist: "Світ %var0% не існує." - setgroup: - desc: "Додає гравця в групу." - usage: "Пример: /setgroup <гравець> <група> [світ]" - messages: - access_denied_01: "You don't have permission to set a player's group to %var0%." - access_denied_02: "You don't have permission to change group of a player with group %var0%." - group_not_exist: "Група %var0% не існує." - level_not_exist: "Світ %var0% не існує." - on_player_group_change: "Ваша група змінена на %var0%!" - setgroup_successfully: "Гравець %var0% успішно доданий в групу." - setuperm: - desc: "Додає дозвіл користувачу." - usage: "Приклад: /setuperm <гравець> <дозвіл> [світ]" - messages: - level_not_exist: "Світ %var0% не існує." - uperm_added_successfully: "Дозвіл %var0% успішно додано гравцю %var1%." - unsetgperm: - desc: "Забирає дозвіл у групи." - usage: "Приклад: /unsetgperm <група> <дозвіл> [світ]" - messages: - gperm_removed_successfully: "Дозвіл %var0% успішно забрано у групи." - group_not_exist: "Група %var0% не існує." - level_not_exist: "Світ %var0% не існує." - unsetuperm: - desc: "Забирає дозвіл у гравця." - usage: "Приклад: /unsetuperm <гравець> <дозвіл> [світ]" - messages: - level_not_exist: "Світ %var0% не існує." - uperm_removed_successfully: "Дозвіл %var0% успішно забрано у гравця %var1%." - usrinfo: - desc: "Показує інформацію про гравця." - usage: "Приклад: /usrinfo <гравець> [світ]" - messages: - level_not_exist: "Світ %var0% не існує." - status_online: "ОНЛАЙН!" - status_offline: "ОФФЛАЙН." - usrinfo_header: "<--- Інформація про гравця %var0% --->" - usrinfo_username: "ГРАВЕЦЬ: %var0%" - usrinfo_status: "СТАТУС: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "UNIQUE ID: %var0%" - usrinfo_group: "ГРУПА: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "Невідомо" -logger_messages: - getConfigValue_01: "Ключ %var0% не знайдено в файлі config.yml." - getDefaultGroup_01: "Було вказано більше однієї групи, встановленої за замовчуванням в файлі groups.yml." - getDefaultGroup_02: "Не знайдено ні однієї групи, позначеної за замовчуванням в файлі groups.yml." - getDefaultGroup_03: "Група з параметром Default позначається автоматично." - getGroup_01: "Група %var0% не знайдена." - getGroup_02: "Група %var0% має неправильні чи пошкоджені дані." - registerPlayer: "Реєстрація гравця %var0%..." - setProvider_MySQL: "Тип сховища даних - MySQL." - setProvider_JSON: "Тип сховища даних - JSON." - setProvider_NotFound: "Провайдер даних %var0% не існує. Встановлено стандартний тип сховища даних." - unregisterPlayer: "Відміна реєстрації гравця %var0%..." - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." -... From e885a43e75c26b249630b0dda2defdb73967ed5c Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 11:48:14 -0800 Subject: [PATCH 15/46] Added SQLITe. (Unstable and warnings labled) --- resources/config.yml | 6 +++--- resources/messages-en.yml | 5 +++-- src/_64FF00/PurePerms/PurePerms.php | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/resources/config.yml b/resources/config.yml index 54d5de59..fae49192 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -5,9 +5,9 @@ --- # Set default data provider for PurePerms -# - mysql (MYSQL Database) -# - json (JSON Database) -# - sqlite3 (SQLITe3 Database) +# - json (JSON Database) (Stable & tested) +# - mysql (MYSQL Database) (UNTESTED) +# - sqlite3 (SQLITe3 Database) (NOT STABLE) data-provider: json # Set the default language for PurePerms diff --git a/resources/messages-en.yml b/resources/messages-en.yml index dd086276..7e0b0293 100644 --- a/resources/messages-en.yml +++ b/resources/messages-en.yml @@ -157,8 +157,9 @@ logger_messages: getGroup_01: "Group %var0% not found." getGroup_02: "Group %var0% has invalid or corrupted data." registerPlayer: "Registering player %var0%..." - setProvider_MySQL: "Set data provider to MySQL." - setProvider_JSON: "Set data provider to JSON." + setProvider_MySQL: "Data provider is set to MySQL." + setProvider_JSON: "Data provider is set to JSON." + setProvider_SQLITE3: "Data provider is set to SQLITe3." setProvider_NotFound: "Provider %var0% does NOT exist. Setting the data provider to default." unregisterPlayer: "Unregistering player %var0%..." YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 109c990d..ff43bc82 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -22,6 +22,7 @@ use _64FF00\PurePerms\Commands\UnsetUPerm; use _64FF00\PurePerms\Commands\UsrInfo; use _64FF00\PurePerms\DataManager\UserDataManager; +use _64FF00\PurePerms\DataProviders\SQLite3Provider; use _64FF00\PurePerms\Noeul\NoeulAPI; use _64FF00\PurePerms\DataProviders\DefaultProvider; use _64FF00\PurePerms\DataProviders\MySQLProvider; @@ -163,6 +164,11 @@ private function setProvider($onEnable = true) $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_MySQL")); break; + case "sqlite3": + $provider = new SQLite3Provider($this); + if($onEnable === true) + $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_SQLITE3")); + break; case "json": $provider = new JsonProvider($this); if($onEnable === true) From fa9a52229a4e56179d6c08e9ce1209a6fcd5b386 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 11:50:03 -0800 Subject: [PATCH 16/46] Implemented per-world permissions again. (theres hope?) --- resources/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/config.yml b/resources/config.yml index fae49192..5cf5c6aa 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -19,6 +19,10 @@ default-language: en # - true / false disable-op: true +# Setting this option will allow you to use per-world permissions (Unstable) +# - true / false +enable-multiworld-perms: false + # Enables 'Noeul', a 'pointless' security management system for PurePerms # - true / false enable-noeul-sixtyfour: false From 3e521a7e3e93e8fc689a628550ecd69950867d9e Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 11:55:37 -0800 Subject: [PATCH 17/46] Forgot to add worlds value in groups.yml --- resources/groups.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/groups.yml b/resources/groups.yml index 186eccaf..505fbcda 100644 --- a/resources/groups.yml +++ b/resources/groups.yml @@ -12,6 +12,7 @@ Guest: - pchat.colored.nametag - pocketmine.command.list - pperms.command.ppinfo + - worlds: [] Admin: alias: 'adm' inheritance: @@ -24,6 +25,7 @@ Admin: - pocketmine.command.kick - pocketmine.command.teleport - pocketmine.command.time + - worlds: [] Owner: alias: 'owr' inheritance: @@ -32,9 +34,11 @@ Owner: - essentials - pocketmine.command - pperms.command + - worlds: [] OP: alias: 'op' inheritance: [] permissions: - '*' + - worlds: [] ... From df93976a8a174db3b3c76b39f125ebb88f780128 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 14:52:28 -0800 Subject: [PATCH 18/46] Removed reload command --- plugin.yml | 3 - src/_64FF00/PurePerms/Commands/PPReload.php | 63 --------------------- src/_64FF00/PurePerms/PurePerms.php | 14 ----- 3 files changed, 80 deletions(-) delete mode 100644 src/_64FF00/PurePerms/Commands/PPReload.php diff --git a/plugin.yml b/plugin.yml index 42d07557..376c1814 100644 --- a/plugin.yml +++ b/plugin.yml @@ -41,9 +41,6 @@ permissions: pperms.command.grpinfo: default: op description: "Nothing" - pperms.command.ppreload: - default: op - description: "Allows you to reload all PurePerms configurations." pperms.command.rmgroup: default: op description: "Allows you to remove a group from the groups list." diff --git a/src/_64FF00/PurePerms/Commands/PPReload.php b/src/_64FF00/PurePerms/Commands/PPReload.php deleted file mode 100644 index bf47aa9a..00000000 --- a/src/_64FF00/PurePerms/Commands/PPReload.php +++ /dev/null @@ -1,63 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.ppreload"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - $this->plugin->reload(); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppreload.messages.successfully_reloaded")); - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index ff43bc82..cc78127b 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -11,7 +11,6 @@ use _64FF00\PurePerms\Commands\ListGPerms; use _64FF00\PurePerms\Commands\ListUPerms; use _64FF00\PurePerms\Commands\PPInfo; -use _64FF00\PurePerms\Commands\PPReload; use _64FF00\PurePerms\Commands\PPSudo; use _64FF00\PurePerms\Commands\RmGroup; use _64FF00\PurePerms\Commands\RmParent; @@ -137,7 +136,6 @@ private function registerCommands() $commandMap->register("pureperms", new ListGPerms($this, "listgperms", $this->getMessage("cmds.listgperms.desc") . ' #64FF00')); $commandMap->register("pureperms", new ListUPerms($this, "listuperms", $this->getMessage("cmds.listuperms.desc") . ' #64FF00')); $commandMap->register("pureperms", new PPInfo($this, "ppinfo", $this->getMessage("cmds.ppinfo.desc") . ' #64FF00')); - $commandMap->register("pureperms", new PPReload($this, "ppreload", $this->getMessage("cmds.ppreload.desc") . ' #64FF00')); $commandMap->register("pureperms", new RmGroup($this, "rmgroup", $this->getMessage("cmds.rmgroup.desc") . ' #64FF00')); $commandMap->register("pureperms", new RmParent($this, "rmparent", $this->getMessage("cmds.rmparent.desc") . ' #64FF00')); $commandMap->register("pureperms", new SetGPerm($this, "setgperm", $this->getMessage("cmds.setgperm.desc") . ' #64FF00')); @@ -506,18 +504,6 @@ public function registerPlayers() } } - public function reload() - { - $this->reloadConfig(); - $this->saveDefaultConfig(); - $this->messages->reloadMessages(); - $this->setProvider(false); - foreach($this->getServer()->getOnlinePlayers() as $player) - { - $this->updatePermissions($player); - } - } - /** * @param $groupName * @return bool From ef2eba506bb2d6bb153af010c6037dd6a71afbef Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 14:53:37 -0800 Subject: [PATCH 19/46] Addition to commit df93976a8a174db3b3c76b39f125ebb88f780128 --- resources/messages-en.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resources/messages-en.yml b/resources/messages-en.yml index 7e0b0293..ad341448 100644 --- a/resources/messages-en.yml +++ b/resources/messages-en.yml @@ -66,10 +66,6 @@ cmds: messages: ppinfo_console: "You are currently using PurePerms v%var0% by %var1%." ppinfo_player: "This server is using PurePerms v%var0% by %var1%." - ppreload: - desc: "Reloads all PurePerms configurations." - messages: - successfully_reloaded: "All plugin configurations have been successfully reloaded." ppsudo: desc: "Registers or logs into your Noeul account." usage: "Usage: /ppsudo " From a045f30d7ef1a745faf30e29467c793baf211966 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 21 Nov 2021 15:24:43 -0800 Subject: [PATCH 20/46] Fixed Array to string conversion error. --- resources/groups.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/groups.yml b/resources/groups.yml index 505fbcda..3c0263fd 100644 --- a/resources/groups.yml +++ b/resources/groups.yml @@ -12,7 +12,7 @@ Guest: - pchat.colored.nametag - pocketmine.command.list - pperms.command.ppinfo - - worlds: [] + worlds: [] Admin: alias: 'adm' inheritance: @@ -25,7 +25,7 @@ Admin: - pocketmine.command.kick - pocketmine.command.teleport - pocketmine.command.time - - worlds: [] + worlds: [] Owner: alias: 'owr' inheritance: @@ -34,11 +34,11 @@ Owner: - essentials - pocketmine.command - pperms.command - - worlds: [] + worlds: [] OP: alias: 'op' inheritance: [] permissions: - '*' - - worlds: [] + worlds: [] ... From c79788f952ec672af46154b6d09975e6a031b315 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 14:32:30 -0800 Subject: [PATCH 21/46] Fixed syntax error on groups.yml --- resources/groups.yml | 46 +++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/resources/groups.yml b/resources/groups.yml index 3c0263fd..968c2733 100644 --- a/resources/groups.yml +++ b/resources/groups.yml @@ -1,44 +1,46 @@ + # PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) + --- Guest: alias: 'gst' isDefault: true inheritance: [] permissions: - - -essentials.kit - - -essentials.kit.other - - -pocketmine.command.me - - pchat.colored.format - - pchat.colored.nametag - - pocketmine.command.list - - pperms.command.ppinfo + - -essentials.kit + - -essentials.kit.other + - -pocketmine.command.me + - pchat.colored.format + - pchat.colored.nametag + - pocketmine.command.list + - pperms.command.ppinfo worlds: [] Admin: alias: 'adm' inheritance: - - Guest - permissions: - - essentials.gamemode - - pocketmine.broadcast - - pocketmine.command.gamemode - - pocketmine.command.give - - pocketmine.command.kick - - pocketmine.command.teleport - - pocketmine.command.time + - Guest + permissions: + - essentials.gamemode + - pocketmine.broadcast + - pocketmine.command.gamemode + - pocketmine.command.give + - pocketmine.command.kick + - pocketmine.command.teleport + - pocketmine.command.time worlds: [] Owner: alias: 'owr' inheritance: - - Admin + - Admin permissions: - - essentials - - pocketmine.command - - pperms.command + - essentials + - pocketmine.command + - pperms.command worlds: [] OP: alias: 'op' inheritance: [] permissions: - - '*' - worlds: [] + - '*' + worlds: [] ... From 1972093a5b562f9211b18b830a3d27dbc46902a0 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 14:35:32 -0800 Subject: [PATCH 22/46] Updated permissions for groups.yml --- resources/groups.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/resources/groups.yml b/resources/groups.yml index 968c2733..8f39bac8 100644 --- a/resources/groups.yml +++ b/resources/groups.yml @@ -7,13 +7,7 @@ Guest: isDefault: true inheritance: [] permissions: - - -essentials.kit - - -essentials.kit.other - - -pocketmine.command.me - - pchat.colored.format - - pchat.colored.nametag - pocketmine.command.list - - pperms.command.ppinfo worlds: [] Admin: alias: 'adm' @@ -35,12 +29,6 @@ Owner: permissions: - essentials - pocketmine.command - - pperms.command - worlds: [] -OP: - alias: 'op' - inheritance: [] - permissions: - - '*' + - pocketmine.command.ban worlds: [] ... From 00ef7c5a3f64c25c1b788376097b0543687fe327 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 14:35:57 -0800 Subject: [PATCH 23/46] Updated permissions for groups.yml --- resources/groups.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/groups.yml b/resources/groups.yml index 8f39bac8..da4eda2c 100644 --- a/resources/groups.yml +++ b/resources/groups.yml @@ -14,7 +14,6 @@ Admin: inheritance: - Guest permissions: - - essentials.gamemode - pocketmine.broadcast - pocketmine.command.gamemode - pocketmine.command.give From aef253e556d0fa3303b4c160a6e0f75e10dff42f Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 15:21:03 -0800 Subject: [PATCH 24/46] Removed Noeul, PPSudo and Disable OP config option. --- resources/config.yml | 8 - src/_64FF00/PurePerms/Commands/PPSudo.php | 118 -------------- src/_64FF00/PurePerms/Noeul/NoeulAPI.php | 180 ---------------------- src/_64FF00/PurePerms/PPListener.php | 38 ----- src/_64FF00/PurePerms/PurePerms.php | 20 +-- 5 files changed, 1 insertion(+), 363 deletions(-) delete mode 100644 src/_64FF00/PurePerms/Commands/PPSudo.php delete mode 100644 src/_64FF00/PurePerms/Noeul/NoeulAPI.php diff --git a/resources/config.yml b/resources/config.yml index 5cf5c6aa..e2cddff1 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -15,18 +15,10 @@ data-provider: json # English message resource by @64FF00 and @Samueljh1 (GitHub) default-language: en -# Disable /op permission for all players -# - true / false -disable-op: true - # Setting this option will allow you to use per-world permissions (Unstable) # - true / false enable-multiworld-perms: false -# Enables 'Noeul', a 'pointless' security management system for PurePerms -# - true / false -enable-noeul-sixtyfour: false - # MySQL Settings (Only configure this if you are going to use MySQL data provider) mysql-settings: host: "PurePerms-FTW.loveyou.all" diff --git a/src/_64FF00/PurePerms/Commands/PPSudo.php b/src/_64FF00/PurePerms/Commands/PPSudo.php deleted file mode 100644 index 8b71a8a8..00000000 --- a/src/_64FF00/PurePerms/Commands/PPSudo.php +++ /dev/null @@ -1,118 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.noeul.ppsudo"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - if(!($sender instanceof Player)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.invalid_sender")); - return true; - } - if(!isset($args[0]) || count($args) > 2) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.usage")); - - return true; - } - $noeulAPI = $this->plugin->getNoeulAPI(); - switch(strtolower($args[0])) - { - case "login": - - if(!$noeulAPI->isRegistered($sender)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.not_registered")); - return true; - } - if(!isset($args[1])) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.login_usage")); - - return true; - } - $hash = $this->plugin->getUserDataMgr()->getNode($sender, 'noeulPW'); - - if($noeulAPI->hashEquals($args[1], $hash)) - $noeulAPI->auth($sender); - break; - - case "register": - if($noeulAPI->isRegistered($sender)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' '. $this->plugin->getMessage("cmds.ppsudo.messages.already_registered")); - return true; - } - if(!isset($args[1])) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.register_usage")); - return true; - } - $mpl = $this->plugin->getConfigValue("noeul-minimum-pw-length"); - - if(mb_strlen($args[1]) < $mpl) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.password_too_short", $mpl)); - return true; - } - if($noeulAPI->register($sender, $args[1])) - $noeulAPI->auth($sender); - break; - } - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Noeul/NoeulAPI.php b/src/_64FF00/PurePerms/Noeul/NoeulAPI.php deleted file mode 100644 index 67b73e16..00000000 --- a/src/_64FF00/PurePerms/Noeul/NoeulAPI.php +++ /dev/null @@ -1,180 +0,0 @@ -plugin = $plugin; - } - - /** - * @param Player $player - * @return bool - */ - public function auth(Player $player) - { - // TODO - if($this->isAuthed($player)) - return true; - - if(isset($this->needAuth[spl_object_hash($player)])) - { - $attachment = $this->needAuth[spl_object_hash($player)]; - $player->removeAttachment($attachment); - unset($this->needAuth[spl_object_hash($player)]); - } - $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.successfully_logged_in")); - - return true; - } - - /** - * @param Player $player - * @return bool - */ - public function deAuth(Player $player) - { - $attachment = $player->addAttachment($this->plugin); - $this->removePermissions($attachment); - $this->needAuth[spl_object_hash($player)] = $attachment; - $this->sendAuthMsg($player); - return true; - } - - /** - * @param $password - * @return bool|string - */ - public function hash($password) - { - return password_hash($password, PASSWORD_BCRYPT); - } - - /** - * @param $password - * @param $hash - * @return bool - */ - public function hashEquals($password, $hash) - { - return password_verify($password, $hash); - } - - /** - * @param Player $player - * @return bool - */ - public function isAuthed(Player $player) - { - return !isset($this->needAuth[spl_object_hash($player)]); - } - - /** - * @return bool - */ - public function isNoeulEnabled() - { - return $this->plugin->getConfigValue("enable-noeul-sixtyfour"); - } - - /** - * @return bool - */ - public function isRegistered($player) - { - return !($this->plugin->getUserDataMgr()->getNode($player, 'noeulPW') === null); - } - - /** - * @param IPlayer $player - * @param $password - * @return bool - */ - public function register(IPlayer $player, $password) - { - if(!$this->isRegistered($player)) - { - $hash = $this->hash($password); - $this->plugin->getUserDataMgr()->setNode($player, 'noeulPW', $hash); - return true; - } - - return false; - } - - /** - * @param PermissionAttachment $attachment - */ - private function removePermissions(PermissionAttachment $attachment) - { - $permissions = []; - foreach(PermissionManager::getInstance()->getPermissions() as $permission) - { - $permissions[$permission->getName()] = false; - } - $permissions["pocketmine.command.help"] = true; - $permissions["pperms.noeul.ppsudo"] = true; - ksort($permissions); - $attachment->setPermissions($permissions); - } - - /** - * @param Player $player - */ - public function sendAuthMsg(Player $player) - { - $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_01", self::NOEUL_VERSION)); - $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_02")); - $player->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ppsudo.messages.deauth_03")); - } - - /** - * @param IPlayer $player - * @return bool - */ - public function unregister(IPlayer $player) - { - if($this->isRegistered($player)) - { - $this->plugin->getUserDataMgr()->removeNode($player, 'noeulPW'); - return true; - } - return false; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/PPListener.php b/src/_64FF00/PurePerms/PPListener.php index 088e92ac..08447580 100644 --- a/src/_64FF00/PurePerms/PPListener.php +++ b/src/_64FF00/PurePerms/PPListener.php @@ -61,40 +61,6 @@ public function onLevelChange(EntityTeleportEvent $event) } } - public function onPlayerCommand(PlayerCommandPreprocessEvent $event) - { - $message = $event->getMessage(); - $player = $event->getPlayer(); - - if(substr($message, 0, 1) === "/") - { - $command = substr($message, 1); - $args = explode(" ", $command); - - if(!$this->plugin->getNoeulAPI()->isAuthed($event->getPlayer())) - { - $event->cancel(); - if($args[0] === "ppsudo" or $args[0] === "help") - { - $this->plugin->getServer()->dispatchCommand($player, $command); - } - else - { - $this->plugin->getNoeulAPI()->sendAuthMsg($player); - } - } - else - { - $disableOp = $this->plugin->getConfigValue("disable-op"); - if($disableOp and $args[0] === "op") - { - $event->cancel(); - $player->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission")); - } - } - } - } - /** * @param PlayerLoginEvent $event * @priority LOWEST @@ -103,10 +69,6 @@ public function onPlayerLogin(PlayerLoginEvent $event) { $player = $event->getPlayer(); $this->plugin->registerPlayer($player); - if($this->plugin->getNoeulAPI()->isNoeulEnabled()) - $this->plugin->getNoeulAPI()->deAuth($player); - if(!$this->plugin->getNoeulAPI()->isAuthed($player)) - $this->plugin->getNoeulAPI()->sendAuthMsg($player); } /** diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index cc78127b..0ebe7ab5 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -11,7 +11,6 @@ use _64FF00\PurePerms\Commands\ListGPerms; use _64FF00\PurePerms\Commands\ListUPerms; use _64FF00\PurePerms\Commands\PPInfo; -use _64FF00\PurePerms\Commands\PPSudo; use _64FF00\PurePerms\Commands\RmGroup; use _64FF00\PurePerms\Commands\RmParent; use _64FF00\PurePerms\Commands\SetGPerm; @@ -22,7 +21,7 @@ use _64FF00\PurePerms\Commands\UsrInfo; use _64FF00\PurePerms\DataManager\UserDataManager; use _64FF00\PurePerms\DataProviders\SQLite3Provider; -use _64FF00\PurePerms\Noeul\NoeulAPI; +use _64FF00\PurePerms\Authentication\Auth; use _64FF00\PurePerms\DataProviders\DefaultProvider; use _64FF00\PurePerms\DataProviders\MySQLProvider; use _64FF00\PurePerms\DataProviders\ProviderInterface; @@ -67,9 +66,6 @@ class PurePerms extends PluginBase /** @var PPMessages $messages */ private $messages; - /** @var NoeulAPI $noeulAPI */ - private $noeulAPI; - /** @var ProviderInterface $provider */ private $provider; @@ -83,7 +79,6 @@ public function onLoad(): void $this->saveDefaultConfig(); $this->fixConfig(); $this->messages = new PPMessages($this); - $this->noeulAPI = new NoeulAPI($this); $this->userDataMgr = new UserDataManager($this); } @@ -112,10 +107,6 @@ private function fixConfig() $config->set("disable-op", true); if(!$config->exists("enable-multiworld-perms")) $config->set("enable-multiworld-perms", false); - if(!$config->exists("enable-noeul-sixtyfour")) - $config->set("enable-noeul-sixtyfour", false); - if(!$config->exists("noeul-minimum-pw-length")) - $config->set("noeul-minimum-pw-length", 6); if(!$config->exists("superadmin-ranks")) $config->set("superadmin-ranks", ["OP"]); $this->saveConfig(); @@ -125,8 +116,6 @@ private function fixConfig() private function registerCommands() { $commandMap = $this->getServer()->getCommandMap(); - if($this->getNoeulAPI()->isNoeulEnabled()) - $commandMap->register("pureperms", new PPSudo($this, "ppsudo", $this->getMessage("cmds.ppsudo.desc") . ' #64FF00')); $commandMap->register("pureperms", new AddGroup($this, "addgroup", $this->getMessage("cmds.addgroup.desc") . ' #64FF00')); $commandMap->register("pureperms", new AddParent($this, "addparent", $this->getMessage("cmds.addparent.desc") . ' #64FF00')); $commandMap->register("pureperms", new DefGroup($this, "defgroup", $this->getMessage("cmds.defgroup.desc") . ' #64FF00')); @@ -350,13 +339,6 @@ public function getMessage($node, ...$vars) return $this->messages->getMessage($node, ...$vars); } - /** - * @return NoeulAPI - */ - public function getNoeulAPI() - { - return $this->noeulAPI; - } /** * @param PPGroup $group From 25a9644dc17dac569350cc68f2c676c4bc739fbb Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 15:22:03 -0800 Subject: [PATCH 25/46] Addition to aef253e556d0fa3303b4c160a6e0f75e10dff42f --- src/_64FF00/PurePerms/PurePerms.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 0ebe7ab5..289ab895 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -21,7 +21,6 @@ use _64FF00\PurePerms\Commands\UsrInfo; use _64FF00\PurePerms\DataManager\UserDataManager; use _64FF00\PurePerms\DataProviders\SQLite3Provider; -use _64FF00\PurePerms\Authentication\Auth; use _64FF00\PurePerms\DataProviders\DefaultProvider; use _64FF00\PurePerms\DataProviders\MySQLProvider; use _64FF00\PurePerms\DataProviders\ProviderInterface; From f1b0566be4b5efa9195132f262ce75e1b1377e94 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 15:24:34 -0800 Subject: [PATCH 26/46] Once again, an addition to aef253e556d0fa3303b4c160a6e0f75e10dff42f --- resources/config.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resources/config.yml b/resources/config.yml index e2cddff1..3d0e9d0b 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -27,10 +27,6 @@ mysql-settings: password: "YourPasswordGoesHere" db: "YourDBNameGoesHere" -# Sets a minimum length for a Noeul password when registering a new account -# - int -noeul-minimum-pw-length: 6 - # Special thanks to @jazzwhistle for helping me with this cool feature! #JAZZWHISTLE-FTW # Ranks that can only be set on console # Also, users with a superadmin-rank can only have their rank changed on console From c4825d584fd1c8c01b5b14685a7069812941e9aa Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 18:10:57 -0800 Subject: [PATCH 27/46] Removed some plugin commands. --- src/_64FF00/PurePerms/Commands/AddParent.php | 79 ------------ src/_64FF00/PurePerms/Commands/GrpInfo.php | 101 --------------- src/_64FF00/PurePerms/Commands/ListGPerms.php | 115 ------------------ src/_64FF00/PurePerms/Commands/ListUPerms.php | 110 ----------------- src/_64FF00/PurePerms/Commands/RmParent.php | 72 ----------- src/_64FF00/PurePerms/Commands/SetGPerm.php | 93 -------------- src/_64FF00/PurePerms/Commands/UnsetGPerm.php | 94 -------------- src/_64FF00/PurePerms/Commands/UsrInfo.php | 97 --------------- src/_64FF00/PurePerms/PurePerms.php | 16 --- 9 files changed, 777 deletions(-) delete mode 100644 src/_64FF00/PurePerms/Commands/AddParent.php delete mode 100644 src/_64FF00/PurePerms/Commands/GrpInfo.php delete mode 100644 src/_64FF00/PurePerms/Commands/ListGPerms.php delete mode 100644 src/_64FF00/PurePerms/Commands/ListUPerms.php delete mode 100644 src/_64FF00/PurePerms/Commands/RmParent.php delete mode 100644 src/_64FF00/PurePerms/Commands/SetGPerm.php delete mode 100644 src/_64FF00/PurePerms/Commands/UnsetGPerm.php delete mode 100644 src/_64FF00/PurePerms/Commands/UsrInfo.php diff --git a/src/_64FF00/PurePerms/Commands/AddParent.php b/src/_64FF00/PurePerms/Commands/AddParent.php deleted file mode 100644 index a5e6f171..00000000 --- a/src/_64FF00/PurePerms/Commands/AddParent.php +++ /dev/null @@ -1,79 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.addparent"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.usage")); - - return true; - } - - $target_group = $this->plugin->getGroup($args[0]); - $parent_group = $this->plugin->getGroup($args[1]); - if($target_group->addParent($parent_group)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.messages.addparent_successfully", $parent_group->getName(), $target_group->getName())); - } - else - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addparent.messages.target_already_inherits", $parent_group->getName(), $target_group->getName())); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Commands/GrpInfo.php b/src/_64FF00/PurePerms/Commands/GrpInfo.php deleted file mode 100644 index 822d8bae..00000000 --- a/src/_64FF00/PurePerms/Commands/GrpInfo.php +++ /dev/null @@ -1,101 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.grpinfo"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - if(count($args) < 1 || count($args) > 2) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.usage")); - return true; - } - - $group = $this->plugin->getGroup($args[0]); - if($group === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.group_not_exist", $args[0])); - return true; - } - $WorldName = null; - - if(isset($args[1])) - { - $World = $this->plugin->getServer()->getLevelByName($args[1]); - if($World === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.level_not_exist", $args[1])); - return true; - } - $WorldName = $World->getName(); - } - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_header", $group->getName())); - $alias = TextFormat::DARK_GREEN . $group->getAlias(); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_alias", $alias)); - $isDefault = $group->isDefault($WorldName) ? TextFormat::DARK_GREEN . "YES" : TextFormat::RED . "NO"; - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_default", $isDefault)); - $result = TextFormat::DARK_GREEN . "..."; - - /** @var PPGroup $tempGroup */ - foreach($group->getParentGroups() as $tempGroup) - { - $parents[] = $tempGroup->getName(); - } - if(!empty($group->getParentGroups())) - $result = TextFormat::DARK_GREEN . implode(",", $parents); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.grpinfo.messages.grpinfo_parents", $result)); - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Commands/ListGPerms.php b/src/_64FF00/PurePerms/Commands/ListGPerms.php deleted file mode 100644 index f41e1492..00000000 --- a/src/_64FF00/PurePerms/Commands/ListGPerms.php +++ /dev/null @@ -1,115 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.listgperms"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - if(count($args) < 1 || count($args) > 3) - { - $sender->sendMessage(TextFormat::BLUE . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.usage")); - return true; - } - - $group = $this->plugin->getGroup($args[0]); - if($group == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_not_exist", $args[0])); - return true; - } - - $WorldName = null; - if(isset($args[2])) - { - $World = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($World == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - return true; - } - $WorldName = $World->getDisplayName(); - } - - $permissions = $group->getGroupPermissions($WorldName); - - if(empty($permissions)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.no_group_perms", $group->getName())); - return true; - } - $pageHeight = $sender instanceof ConsoleCommandSender ? 24 : 6; - $chunkedPermissions = array_chunk($permissions, $pageHeight); - $maxPageNumber = count($chunkedPermissions); - if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) - { - $pageNumber = 1; - } - else if($args[1] > $maxPageNumber) - { - $pageNumber = $maxPageNumber; - } - else - { - $pageNumber = $args[1]; - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listgperms.messages.group_perms_list", $group->getName(), $pageNumber, $maxPageNumber)); - foreach($chunkedPermissions[$pageNumber - 1] as $permission) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission); - } - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Commands/ListUPerms.php b/src/_64FF00/PurePerms/Commands/ListUPerms.php deleted file mode 100644 index 5ac32d26..00000000 --- a/src/_64FF00/PurePerms/Commands/ListUPerms.php +++ /dev/null @@ -1,110 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.listuperms"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - if(count($args) < 1 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.usage")); - return true; - } - - $player = $this->plugin->getPlayer($args[0]); - $WorldName = null; - if(isset($args[2])) - { - $World = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($World == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - return true; - } - - $WorldName = $World->getDisplayName(); - } - - $permissions = $this->plugin->getUserDataMgr()->getUserPermissions($player, $WorldName); - if(empty($permissions)) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.no_user_perms", $player->getName())); - return true; - } - $pageHeight = $sender instanceof ConsoleCommandSender ? 24 : 6; - $chunkedPermissions = array_chunk($permissions, $pageHeight); - $maxPageNumber = count($chunkedPermissions); - if(!isset($args[1]) || !is_numeric($args[1]) || $args[1] <= 0) - { - $pageNumber = 1; - } - else if($args[1] > $maxPageNumber) - { - $pageNumber = $maxPageNumber; - } - else - { - $pageNumber = $args[1]; - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.listuperms.messages.user_perms_list", $player->getName(), $pageNumber, $maxPageNumber)); - foreach($chunkedPermissions[$pageNumber - 1] as $permission) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission); - } - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Commands/RmParent.php b/src/_64FF00/PurePerms/Commands/RmParent.php deleted file mode 100644 index 15357e96..00000000 --- a/src/_64FF00/PurePerms/Commands/RmParent.php +++ /dev/null @@ -1,72 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.rmparent"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmparent.usage")); - return true; - } - - $target_group = $this->plugin->getGroup($args[0]); - $parent_group = $this->plugin->getGroup($args[1]); - $target_group->removeParent($parent_group); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmparent.messages.rmparent_successfully", $parent_group->getName(), $target_group->getName())); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Commands/SetGPerm.php b/src/_64FF00/PurePerms/Commands/SetGPerm.php deleted file mode 100644 index 5dac4341..00000000 --- a/src/_64FF00/PurePerms/Commands/SetGPerm.php +++ /dev/null @@ -1,93 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.setgperm"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - { - return false; - } - - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.usage")); - return true; - } - - $group = $this->plugin->getGroup($args[0]); - if($group == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.group_not_exist", $args[0])); - return true; - } - - $permission = $args[1]; - $WorldName = null; - if(isset($args[2])) - { - $World = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($World === null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.level_not_exist", $args[2])); - return true; - } - - $WorldName = $World->getDisplayName(); - } - - $group->setGroupPermission($permission, $WorldName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgperm.messages.gperm_added_successfully", $permission)); - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Commands/UnsetGPerm.php b/src/_64FF00/PurePerms/Commands/UnsetGPerm.php deleted file mode 100644 index 70f69aa0..00000000 --- a/src/_64FF00/PurePerms/Commands/UnsetGPerm.php +++ /dev/null @@ -1,94 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.unsetgperm"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - { - return false; - } - - if(count($args) < 2 || count($args) > 3) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.usage")); - return true; - } - - $group = $this->plugin->getGroup($args[0]); - if($group == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' '. $this->plugin->getMessage("cmds.unsetgperm.messages.group_not_exist", $args[0])); - return true; - } - - $permission = $args[1]; - $WorldName = null; - if(isset($args[2])) - { - $world = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[2]); - if($world == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.level_not_exist", $args[2])); - return true; - } - - $WorldName = $world->getDisplayName(); - } - - $group->unsetGroupPermission($permission, $WorldName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.unsetgperm.messages.gperm_removed_successfully", $permission)); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/Commands/UsrInfo.php b/src/_64FF00/PurePerms/Commands/UsrInfo.php deleted file mode 100644 index 34eeebb4..00000000 --- a/src/_64FF00/PurePerms/Commands/UsrInfo.php +++ /dev/null @@ -1,97 +0,0 @@ -plugin = $plugin; - parent::__construct($name, $description); - $this->setPermission("pperms.command.usrinfo"); - } - - /** - * @param CommandSender $sender - * @param $label - * @param array $args - * @return bool - */ - public function execute(CommandSender $sender, string $label, array $args) : bool - { - if(!$this->testPermission($sender)) - return false; - if(count($args) < 1 || count($args) > 2) - { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.usage")); - return true; - } - $player = $this->plugin->getPlayer($args[0]); - $WorldName = null; - if(isset($args[1])) - { - $world = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); - - if($world == null) - { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.level_not_exist", $args[1])); - - return true; - } - $WorldName = $world->getDisplayName(); - } - - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_header", $player->getName())); - $status = $player instanceof Player ? TextFormat::DARK_GREEN . $this->plugin->getMessage("cmds.usrinfo.messages.status_online") : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.status_offline"); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_status", $status)); - $ip = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getNetworkSession()->getIp() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_ip", $ip)); - $uuid = $player instanceof Player ? TextFormat::DARK_GREEN . $player->getUniqueId()->toString() : TextFormat::RED . $this->plugin->getMessage("cmds.usrinfo.messages.unknown"); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_uuid", $uuid)); - $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $WorldName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_group", TextFormat::DARK_GREEN . $userGroup->getName())); - $expDate = $this->plugin->getUserDataMgr()->getExpDate($player, $WorldName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.usrinfo.messages.usrinfo_exp", TextFormat::DARK_GREEN . $expDate)); - - return true; - } - - public function getPlugin() : Plugin - { - return $this->plugin; - } -} \ No newline at end of file diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 289ab895..2af312df 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -3,22 +3,14 @@ namespace _64FF00\PurePerms; use _64FF00\PurePerms\Commands\AddGroup; -use _64FF00\PurePerms\Commands\AddParent; use _64FF00\PurePerms\Commands\DefGroup; use _64FF00\PurePerms\Commands\FPerms; use _64FF00\PurePerms\Commands\Groups; -use _64FF00\PurePerms\Commands\GrpInfo; -use _64FF00\PurePerms\Commands\ListGPerms; -use _64FF00\PurePerms\Commands\ListUPerms; use _64FF00\PurePerms\Commands\PPInfo; use _64FF00\PurePerms\Commands\RmGroup; -use _64FF00\PurePerms\Commands\RmParent; -use _64FF00\PurePerms\Commands\SetGPerm; use _64FF00\PurePerms\Commands\SetGroup; use _64FF00\PurePerms\Commands\SetUPerm; -use _64FF00\PurePerms\Commands\UnsetGPerm; use _64FF00\PurePerms\Commands\UnsetUPerm; -use _64FF00\PurePerms\Commands\UsrInfo; use _64FF00\PurePerms\DataManager\UserDataManager; use _64FF00\PurePerms\DataProviders\SQLite3Provider; use _64FF00\PurePerms\DataProviders\DefaultProvider; @@ -116,22 +108,14 @@ private function registerCommands() { $commandMap = $this->getServer()->getCommandMap(); $commandMap->register("pureperms", new AddGroup($this, "addgroup", $this->getMessage("cmds.addgroup.desc") . ' #64FF00')); - $commandMap->register("pureperms", new AddParent($this, "addparent", $this->getMessage("cmds.addparent.desc") . ' #64FF00')); $commandMap->register("pureperms", new DefGroup($this, "defgroup", $this->getMessage("cmds.defgroup.desc") . ' #64FF00')); $commandMap->register("pureperms", new FPerms($this, "fperms", $this->getMessage("cmds.fperms.desc") . ' #64FF00')); $commandMap->register("pureperms", new Groups($this, "groups", $this->getMessage("cmds.groups.desc") . ' #64FF00')); - $commandMap->register("pureperms", new GrpInfo($this, "grpinfo", $this->getMessage("cmds.grpinfo.desc") . ' #64FF00')); - $commandMap->register("pureperms", new ListGPerms($this, "listgperms", $this->getMessage("cmds.listgperms.desc") . ' #64FF00')); - $commandMap->register("pureperms", new ListUPerms($this, "listuperms", $this->getMessage("cmds.listuperms.desc") . ' #64FF00')); $commandMap->register("pureperms", new PPInfo($this, "ppinfo", $this->getMessage("cmds.ppinfo.desc") . ' #64FF00')); $commandMap->register("pureperms", new RmGroup($this, "rmgroup", $this->getMessage("cmds.rmgroup.desc") . ' #64FF00')); - $commandMap->register("pureperms", new RmParent($this, "rmparent", $this->getMessage("cmds.rmparent.desc") . ' #64FF00')); - $commandMap->register("pureperms", new SetGPerm($this, "setgperm", $this->getMessage("cmds.setgperm.desc") . ' #64FF00')); $commandMap->register("pureperms", new SetGroup($this, "setgroup", $this->getMessage("cmds.setgroup.desc") . ' #64FF00')); $commandMap->register("pureperms", new SetUPerm($this, "setuperm", $this->getMessage("cmds.setuperm.desc") . ' #64FF00')); - $commandMap->register("pureperms", new UnsetGPerm($this, "unsetgperm", $this->getMessage("cmds.unsetgperm.desc") . ' #64FF00')); $commandMap->register("pureperms", new UnsetUPerm($this, "unsetuperm", $this->getMessage("cmds.unsetuperm.desc") . ' #64FF00')); - $commandMap->register("pureperms", new UsrInfo($this, "usrinfo", $this->getMessage("cmds.usrinfo.desc") . ' #64FF00')); } From 4dead1d4793c6ca06feeb9683b99e77817f92dbe Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 18:36:48 -0800 Subject: [PATCH 28/46] Renamed commands and other changes. --- plugin.yml | 48 ++---- resources/messages-en.yml | 149 ++++-------------- .../Commands/{AddGroup.php => AddRank.php} | 12 +- .../Commands/{DefGroup.php => DefRank.php} | 12 +- .../Commands/{Groups.php => ListRanks.php} | 6 +- .../Commands/{FPerms.php => PLPerms.php} | 10 +- .../Commands/{RmGroup.php => RmRank.php} | 12 +- .../Commands/{SetGroup.php => SetRank.php} | 18 +-- .../{SetUPerm.php => SetUserPerm.php} | 2 +- .../{UnsetUPerm.php => UnSetUserPerm.php} | 2 +- src/_64FF00/PurePerms/PurePerms.php | 32 ++-- 11 files changed, 99 insertions(+), 204 deletions(-) rename src/_64FF00/PurePerms/Commands/{AddGroup.php => AddRank.php} (82%) rename src/_64FF00/PurePerms/Commands/{DefGroup.php => DefRank.php} (84%) rename src/_64FF00/PurePerms/Commands/{Groups.php => ListRanks.php} (89%) rename src/_64FF00/PurePerms/Commands/{FPerms.php => PLPerms.php} (87%) rename src/_64FF00/PurePerms/Commands/{RmGroup.php => RmRank.php} (82%) rename src/_64FF00/PurePerms/Commands/{SetGroup.php => SetRank.php} (82%) rename src/_64FF00/PurePerms/Commands/{SetUPerm.php => SetUserPerm.php} (98%) rename src/_64FF00/PurePerms/Commands/{UnsetUPerm.php => UnSetUserPerm.php} (98%) diff --git a/plugin.yml b/plugin.yml index 376c1814..aeaf119f 100644 --- a/plugin.yml +++ b/plugin.yml @@ -11,48 +11,33 @@ permissions: pperms: default: op description: "PurePerms by 64FF00! (Twitter: @64FF00)" - pperms.command: + plperms.command: default: op description: "Allows you to use all PurePerms commands." - pperms.command.addgroup: + pperms.command.addrank: default: op - description: "Allows you to add a new group to the groups list." - pperms.command.addparent: + description: "Allows you to add a new rank" + pperms.command.defrank: default: op - description: "Allows you to add a group to another group inheritance list." - pperms.command.defgroup: - default: op - description: "Allows you to set the default group manually." - pperms.command.fperms: + description: "Allows you to set the default rank manually." + pperms.command.plperms: default: op description: "Allows you to find permissions for a specific plugin." - pperms.command.groups: - default: op - description: "Allows you to see a list of all groups." - pperms.command.listgperms: + pperms.command.rank: default: op - description: "Allows you to see a list of all permissions from a group." + description: "Allows you to see a list of all rank." pperms.command.listuperms: default: op description: "Allows you to see a list of all permissions from a user." pperms.command.ppinfo: default: true description: "Allows you to get current PurePerms information." - pperms.command.grpinfo: - default: op - description: "Nothing" - pperms.command.rmgroup: - default: op - description: "Allows you to remove a group from the groups list." - pperms.command.rmparent: + pperms.command.rmrank: default: op - description: "Allows you to remove a group from another group inheritance list." - pperms.command.setgperm: + description: "Allows you to remove a rank from the ranks list." + pperms.command.setrank: default: op - description: "Allows you to add a permission to the group." - pperms.command.setgroup: - default: op - description: "Allows you to set group for a user." + description: "Allows you to set rank for a user." pperms.command.setuperm: default: op description: "Allows you to add a permission to a user." @@ -62,12 +47,3 @@ permissions: pperms.command.unsetuperm: default: op description: "Allows you to remove a permission from the user." - pperms.command.usrinfo: - default: op - description: "Allows you to see info about a user." - pperms.noeul: - default: op - description: "Allows you to access all 'Noeul' related features." - pperms.noeul.ppsudo: - default: op - description: "Allows you to use the Noeul 'ppsudo' command." diff --git a/resources/messages-en.yml b/resources/messages-en.yml index ad341448..8b884e5f 100644 --- a/resources/messages-en.yml +++ b/resources/messages-en.yml @@ -5,146 +5,65 @@ messages-version: "1.4.0_01" language: "en" cmds: - addgroup: - desc: "Adds a new group to the groups list." - usage: "Usage: /addgroup " - messages: - group_added_successfully: "Added %var0% to the group list successfully." - group_already_exists: "Group %var0% already exists." - invalid_group_name: "Invalid Group Name." - addparent: - desc: "Adds a group to another group inheritance list." - usage: "Usage: /addparent " - messages: - addparent_successfully: "Added %var0% to group %var1%'s inheritance list." - target_already_inherits: "Group %var0% already inherits %var1%." - defgroup: - desc: "Allows you to set default group." - usage: "Usage: /defgroup [world]" - messages: - defgroup_successfully: "Default group has been successfully set to %var0%." - group_not_exist: "Group %var0% does NOT exist." + addrank: + desc: "Adds a new rank" + usage: "Usage: /addrank " + messages: + rank_added_successfully: "Added %var0% to the rank list successfully." + rank_already_exists: "Rank %var0% already exists." + invalid_rank_name: "Invalid Rank Name." + defrank: + desc: "Allows you to set default rank." + usage: "Usage: /defrank [world]" + messages: + defgroup_successfully: "Default rank has been successfully set to %var0%." + rank_not_exist: "rank %var0% does NOT exist." level_not_exist: "World %var0% does NOT exist." - fperms: + plperms: desc: "Shows a list of all permissions for a specific plugin." - usage: "Usage: /fperms " + usage: "Usage: /plperms " messages: no_plugin_perms: "Plugin %var0% doesn't have any permissions." plugin_not_exist: "Plugin %var0% does NOT exist." plugin_perms_list: "List of all plugin permissions from %var0% (%var1% / %var2%) : " - groups: - desc: "Shows a list of all groups." - messages: - all_registered_groups: "All registered groups: %var0%" - grpinfo: - desc: "Shows info about a group." - usage: "Usage: /grpinfo [world]" - messages: - group_not_exist: "Group %var0% does NOT exist." - grpinfo_header: "-- Group Information for %var0% --" - grpinfo_alias: "ALIAS: %var0%" - grpinfo_default: "DEFAULT: %var0%" - grpinfo_parents: "PARENTS: %var0%" - level_not_exist: "World %var0% does NOT exist." - listgperms: - desc: "Shows a list of all permissions from a group." - usage: "Usage: /listgperms [world]" - messages: - group_not_exist: "Group %var0% does NOT exist." - group_perms_list: "List of all group permissions from %var0% (%var1% / %var2%) : " - level_not_exist: "World %var0% does NOT exist." - no_group_perms: "Group %var0% doesn't have any group permissions." - listuperms: - desc: "Shows a list of all permissions from a user." - usage: "Usage: /listuperms [world]" + ranks: + desc: "Shows a list of all ranks." messages: - level_not_exist: "World %var0% does NOT exist." - no_user_perms: "Player %var0% doesn't have any user permissions." - user_perms_list: "List of all user permissions from %var0% (%var1% / %var2%) : " + all_registered_ranks: "All registered ranks: %var0%" ppinfo: desc: "Shows current PurePerms information including author, version, and etc." messages: ppinfo_console: "You are currently using PurePerms v%var0% by %var1%." ppinfo_player: "This server is using PurePerms v%var0% by %var1%." - ppsudo: - desc: "Registers or logs into your Noeul account." - usage: "Usage: /ppsudo " - messages: - already_registered: "This account is already registered." - deauth_01: "This server uses Noeul v%var0% to protect your account." - deauth_02: "You must authenticate your account first." - deauth_03: "Please register or login to your account using /ppsudo command" - invalid_sender: "This command should be only used in-game." - login_usage: "Usage: /ppsudo login " - not_registered: "This account is not registered." - password_too_short: "Your password does NOT meet minimum length (%var0%) requirements." - register_usage: "Usage: /ppsudo register " - successfully_logged_in: "You are now logged in." - successfully_registered: "Your account has been successfully registered." - unregister_usage: "Usage: /ppsudo unregister " - rmgroup: - desc: "Removes a group from the groups list." - usage: "Usage: /rmgroup " - messages: - group_removed_successfully: "Removed %var0% from the group list successfully." - group_not_exist: "Group %var0% does NOT exist." - invalid_group_name: "Invalid Group Name." - rmparent: - desc: "Removes a group from another group inheritance list." - usage: "Usage: /rmparent " - messages: - rmparent_successfully: "Removed %var0% from group %var1%'s inheritance list." - setgperm: - desc: "Adds a permission to the group." - usage: "Usage: /setgperm [world]" - messages: - gperm_added_successfully: "Added permission %var0% to the group successfully." - group_not_exist: "Group %var0% does NOT exist." - level_not_exist: "World %var0% does NOT exist." - setgroup: - desc: "Sets group for the user." - usage: "Usage: /setgroup [world]" - messages: - access_denied_01: "You don't have permission to set a player's group to %var0%." - access_denied_02: "You don't have permission to change group of a player with group %var0%." - group_not_exist: "Group %var0% does NOT exist." + rmrank: + desc: "Removes a rank from the groups list." + usage: "Usage: /rmrank " + messages: + group_removed_successfully: "Removed %var0% from the rank list successfully." + group_not_exist: "rank %var0% does NOT exist." + invalid_group_name: "Invalid rank Name." + setrank: + desc: "Sets a rank for the user." + usage: "Usage: /setrank [world]" + messages: + access_denied_01: "You don't have permission to set a player's rank to %var0%." + access_denied_02: "You don't have permission to change rank of a player with group %var0%." + group_not_exist: "Rank %var0% does NOT exist." level_not_exist: "World %var0% does NOT exist." - on_player_group_change: "Your group has been changed to a / an %var0%!" - setgroup_successfully: "Added %var0% to the group successfully." + on_player_group_change: "Your rank has been changed to a / an %var0%!" + setgroup_successfully: "Added %var0% to the rank successfully." setuperm: desc: "Adds a permission to the user." usage: "Usage: /setuperm [world]" messages: level_not_exist: "World %var0% does NOT exist." uperm_added_successfully: "Added permission %var0% to %var1% successfully." - unsetgperm: - desc: "Removes a permission from the group." - usage: "Usage: /unsetgperm [world]" - messages: - gperm_removed_successfully: "Removed permission %var0% from the group successfully." - group_not_exist: "Group %var0% does NOT exist." - level_not_exist: "World %var0% does NOT exist." unsetuperm: desc: "Removes a permission from the user." usage: "Usage: /unsetuperm [world]" messages: level_not_exist: "World %var0% does NOT exist." uperm_removed_successfully: "Removed permission %var0% from %var1% successfully." - usrinfo: - desc: "Shows info about a user." - usage: "Usage: /usrinfo [world]" - messages: - level_not_exist: "World %var0% does NOT exist." - status_online: "ONLINE!" - status_offline: "OFFLINE..." - usrinfo_header: "-- User Information for %var0% --" - usrinfo_username: "USERNAME: %var0%" - usrinfo_status: "STATUS: %var0%" - usrinfo_ip: "IP: %var0%" - usrinfo_uuid: "UNIQUE ID: %var0%" - usrinfo_group: "GROUP: %var0%" - usrinfo_exp: "ExpTime: %var0%" - unknown: "UNKNOWN" logger_messages: getConfigValue_01: "Key %var0% not found in config.yml." getDefaultGroup_01: "More than one default group was declared in the groups file." diff --git a/src/_64FF00/PurePerms/Commands/AddGroup.php b/src/_64FF00/PurePerms/Commands/AddRank.php similarity index 82% rename from src/_64FF00/PurePerms/Commands/AddGroup.php rename to src/_64FF00/PurePerms/Commands/AddRank.php index 3ed1a8b1..3f5c2051 100644 --- a/src/_64FF00/PurePerms/Commands/AddGroup.php +++ b/src/_64FF00/PurePerms/Commands/AddRank.php @@ -11,7 +11,7 @@ use pocketmine\plugin\PluginOwnedTrait; use pocketmine\utils\TextFormat; -class AddGroup extends Command implements PluginOwned +class AddRank extends Command implements PluginOwned { use PluginOwnedTrait; /* @@ -38,7 +38,7 @@ public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; parent::__construct($name, $description); - $this->setPermission("pperms.command.addgroup"); + $this->setPermission("pperms.command.addrank"); } /** @@ -53,22 +53,22 @@ public function execute(CommandSender $sender, string $label, array $args) : boo return false; if(!isset($args[0]) || count($args) > 1) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.usage")); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addrank.usage")); return true; } $result = $this->plugin->addGroup($args[0]); if($result === PurePerms::SUCCESS) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.group_added_successfully", $args[0])); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addrank.messages.rank_added_successfully", $args[0])); } elseif($result === PurePerms::ALREADY_EXISTS) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.group_already_exists", $args[0])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rank.messages.rank_already_exists", $args[0])); } else { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addgroup.messages.invalid_group_name", $args[0])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.addrank.messages.invalid_rank_name", $args[0])); } return true; diff --git a/src/_64FF00/PurePerms/Commands/DefGroup.php b/src/_64FF00/PurePerms/Commands/DefRank.php similarity index 84% rename from src/_64FF00/PurePerms/Commands/DefGroup.php rename to src/_64FF00/PurePerms/Commands/DefRank.php index 291de22d..bcaf168e 100644 --- a/src/_64FF00/PurePerms/Commands/DefGroup.php +++ b/src/_64FF00/PurePerms/Commands/DefRank.php @@ -11,7 +11,7 @@ use pocketmine\plugin\PluginOwnedTrait; use pocketmine\utils\TextFormat; -class DefGroup extends Command implements PluginOwned +class DefRank extends Command implements PluginOwned { use PluginOwnedTrait; /* @@ -38,7 +38,7 @@ public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; parent::__construct($name, $description); - $this->setPermission("pperms.command.defgroup"); + $this->setPermission("pperms.command.defrank"); } /** @@ -54,14 +54,14 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(!isset($args[0]) || count($args) > 2) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.usage")); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defrank.usage")); return true; } $group = $this->plugin->getGroup($args[0]); if($group === null) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.group_not_exist", $args[0])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defrank.messages.rank_not_exist", $args[0])); return true; } $WorldName = null; @@ -70,14 +70,14 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $World = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[1]); if($World === null) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.level_not_exist", $args[1])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defrank.messages.level_not_exist", $args[1])); return true; } $WorldName = $World->getDisplayName(); } $this->plugin->setDefaultGroup($group, $WorldName); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defgroup.messages.defgroup_successfully", $args[0])); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.defrank.messages.defrank_successfully", $args[0])); return true; } diff --git a/src/_64FF00/PurePerms/Commands/Groups.php b/src/_64FF00/PurePerms/Commands/ListRanks.php similarity index 89% rename from src/_64FF00/PurePerms/Commands/Groups.php rename to src/_64FF00/PurePerms/Commands/ListRanks.php index 638c9749..0765d3f5 100644 --- a/src/_64FF00/PurePerms/Commands/Groups.php +++ b/src/_64FF00/PurePerms/Commands/ListRanks.php @@ -11,7 +11,7 @@ use pocketmine\plugin\PluginOwnedTrait; use pocketmine\utils\TextFormat; -class Groups extends Command implements PluginOwned +class ListRanks extends Command implements PluginOwned { use PluginOwnedTrait; /* @@ -38,7 +38,7 @@ public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; parent::__construct($name, $description); - $this->setPermission("pperms.command.groups"); + $this->setPermission("pperms.command.ranks"); } /** @@ -57,7 +57,7 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { $result[] = $group->getName(); } - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.groups.messages.all_registered_groups", implode(", ", $result))); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.ranks.messages.all_registered_ranks", implode(", ", $result))); return true; } diff --git a/src/_64FF00/PurePerms/Commands/FPerms.php b/src/_64FF00/PurePerms/Commands/PLPerms.php similarity index 87% rename from src/_64FF00/PurePerms/Commands/FPerms.php rename to src/_64FF00/PurePerms/Commands/PLPerms.php index 4f06ed04..74f2c373 100644 --- a/src/_64FF00/PurePerms/Commands/FPerms.php +++ b/src/_64FF00/PurePerms/Commands/PLPerms.php @@ -13,7 +13,7 @@ use pocketmine\plugin\PluginOwnedTrait; use pocketmine\utils\TextFormat; -class FPerms extends Command implements PluginOwned +class PLPerms extends Command implements PluginOwned { use PluginOwnedTrait; /* @@ -40,7 +40,7 @@ public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; parent::__construct($name, $description); - $this->setPermission("pperms.command.fperms"); + $this->setPermission("pperms.command.plperms"); } /** @@ -62,14 +62,14 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $plugin = (strtolower($args[0]) === 'pocketmine' || strtolower($args[0]) === 'pmmp') ? 'pocketmine' : $this->plugin->getServer()->getPluginManager()->getPlugin($args[0]); if($plugin === null) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.plugin_not_exist", $args[0])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.plperms.messages.plugin_not_exist", $args[0])); return true; } $permissions = ($plugin instanceof PluginBase) ? $plugin->getDescription()->getPermissions() : $this->plugin->getPocketMinePerms(); if(empty($permissions)) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.no_plugin_perms", $plugin->getName())); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.plperms.messages.no_plugin_perms", $plugin->getName())); return true; } @@ -89,7 +89,7 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $pageNumber = $args[1]; } - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.messages.plugin_perms_list", ($plugin instanceof PluginBase) ? $plugin->getName(): 'PocketMine-MP', $pageNumber, $maxPageNumber)); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.plperms.messages.plugin_perms_list", ($plugin instanceof PluginBase) ? $plugin->getName(): 'PocketMine-MP', $pageNumber, $maxPageNumber)); foreach($chunkedPermissions[$pageNumber - 1] as $permission) { $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' - ' . $permission->getName()); diff --git a/src/_64FF00/PurePerms/Commands/RmGroup.php b/src/_64FF00/PurePerms/Commands/RmRank.php similarity index 82% rename from src/_64FF00/PurePerms/Commands/RmGroup.php rename to src/_64FF00/PurePerms/Commands/RmRank.php index 0d348cc1..facb6967 100644 --- a/src/_64FF00/PurePerms/Commands/RmGroup.php +++ b/src/_64FF00/PurePerms/Commands/RmRank.php @@ -11,7 +11,7 @@ use pocketmine\plugin\PluginOwnedTrait; use pocketmine\utils\TextFormat; -class RmGroup extends Command implements PluginOwned +class RmRank extends Command implements PluginOwned { use PluginOwnedTrait; /* @@ -38,7 +38,7 @@ public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; parent::__construct($name, $description); - $this->setPermission("pperms.command.rmgroup"); + $this->setPermission("pperms.command.rmrank"); } /** @@ -53,22 +53,22 @@ public function execute(CommandSender $sender, string $label, array $args) : boo return false; if(!isset($args[0]) || count($args) > 1) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.usage")); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.usage")); return true; } $result = $this->plugin->removeGroup($args[0]); if($result === PurePerms::SUCCESS) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.group_removed_successfully", $args[0])); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.group_removed_successfully", $args[0])); } elseif($result === PurePerms::INVALID_NAME) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.invalid_group_name", $args[0])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.invalid_group_name", $args[0])); } else { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmgroup.messages.group_not_exist", $args[0])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.group_not_exist", $args[0])); } return true; diff --git a/src/_64FF00/PurePerms/Commands/SetGroup.php b/src/_64FF00/PurePerms/Commands/SetRank.php similarity index 82% rename from src/_64FF00/PurePerms/Commands/SetGroup.php rename to src/_64FF00/PurePerms/Commands/SetRank.php index 7b4b55ed..acd796f4 100644 --- a/src/_64FF00/PurePerms/Commands/SetGroup.php +++ b/src/_64FF00/PurePerms/Commands/SetRank.php @@ -14,7 +14,7 @@ use pocketmine\plugin\PluginOwnedTrait; use pocketmine\utils\TextFormat; -class SetGroup extends Command implements PluginOwned +class SetRank extends Command implements PluginOwned { use PluginOwnedTrait; /* @@ -41,7 +41,7 @@ public function __construct(PurePerms $plugin, $name, $description) { $this->plugin = $plugin; parent::__construct($name, $description); - $this->setPermission("pperms.command.setgroup"); + $this->setPermission("pperms.command.setrank"); } /** @@ -59,14 +59,14 @@ public function execute(CommandSender $sender, string $label, array $args) : boo if(count($args) < 2 || count($args) > 4) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.usage")); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setrank.usage")); return true; } $player = $this->plugin->getPlayer($args[0]); $group = $this->plugin->getGroup($args[1]); if($group === null) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.group_not_exist", $args[1])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setrank.messages.rank_not_exist", $args[1])); return true; } @@ -79,7 +79,7 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $world = $this->plugin->getServer()->getWorldManager()->getWorldByName($args[3]); if($world === null) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.level_not_exist", $args[3])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setrank.messages.level_not_exist", $args[3])); return true; } @@ -96,26 +96,26 @@ public function execute(CommandSender $sender, string $label, array $args) : boo { if(isset($tmpSuperAdminRanks[$group->getName()])) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_01", $group->getName())); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setrank.messages.access_denied_01", $group->getName())); return true; } $userGroup = $this->plugin->getUserDataMgr()->getGroup($player, $WorldName); if(isset($tmpSuperAdminRanks[$userGroup->getName()])) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.access_denied_02", $userGroup->getName())); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setrank.messages.access_denied_02", $userGroup->getName())); return true; } } $this->plugin->getUserDataMgr()->setGroup($player, $group, $WorldName, $expTime); - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.setgroup_successfully", $player->getName())); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setrank.messages.setrank_successfully", $player->getName())); if($player instanceof Player) { if(!$this->plugin->getConfigValue("enable-multiworld-perms") || ($this->plugin->getConfigValue("enable-multiworld-perms") and $WorldName === $player->getWorld()->getDisplayName())) - $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setgroup.messages.on_player_group_change", strtolower($group->getName()))); + $player->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.setrank.messages.on_player_rank_change", strtolower($group->getName()))); } return true; diff --git a/src/_64FF00/PurePerms/Commands/SetUPerm.php b/src/_64FF00/PurePerms/Commands/SetUserPerm.php similarity index 98% rename from src/_64FF00/PurePerms/Commands/SetUPerm.php rename to src/_64FF00/PurePerms/Commands/SetUserPerm.php index 6648f391..d039b16c 100644 --- a/src/_64FF00/PurePerms/Commands/SetUPerm.php +++ b/src/_64FF00/PurePerms/Commands/SetUserPerm.php @@ -11,7 +11,7 @@ use pocketmine\plugin\PluginOwnedTrait; use pocketmine\utils\TextFormat; -class SetUPerm extends Command implements PluginOwned +class SetUserPerm extends Command implements PluginOwned { use PluginOwnedTrait; /* diff --git a/src/_64FF00/PurePerms/Commands/UnsetUPerm.php b/src/_64FF00/PurePerms/Commands/UnSetUserPerm.php similarity index 98% rename from src/_64FF00/PurePerms/Commands/UnsetUPerm.php rename to src/_64FF00/PurePerms/Commands/UnSetUserPerm.php index 4fb5014a..94d1be73 100644 --- a/src/_64FF00/PurePerms/Commands/UnsetUPerm.php +++ b/src/_64FF00/PurePerms/Commands/UnSetUserPerm.php @@ -11,7 +11,7 @@ use pocketmine\plugin\PluginOwnedTrait; use pocketmine\utils\TextFormat; -class UnsetUPerm extends Command implements PluginOwned +class UnSetUserPerm extends Command implements PluginOwned { use PluginOwnedTrait; /* diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 2af312df..4b4aa043 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -2,15 +2,15 @@ namespace _64FF00\PurePerms; -use _64FF00\PurePerms\Commands\AddGroup; -use _64FF00\PurePerms\Commands\DefGroup; -use _64FF00\PurePerms\Commands\FPerms; -use _64FF00\PurePerms\Commands\Groups; +use _64FF00\PurePerms\Commands\AddRank; +use _64FF00\PurePerms\Commands\DefRank; +use _64FF00\PurePerms\Commands\PLPerms; +use _64FF00\PurePerms\Commands\ListRanks; use _64FF00\PurePerms\Commands\PPInfo; -use _64FF00\PurePerms\Commands\RmGroup; -use _64FF00\PurePerms\Commands\SetGroup; -use _64FF00\PurePerms\Commands\SetUPerm; -use _64FF00\PurePerms\Commands\UnsetUPerm; +use _64FF00\PurePerms\Commands\RmRank; +use _64FF00\PurePerms\Commands\UnSetUserPerm; +use _64FF00\PurePerms\Commands\SetUserPerm; +use _64FF00\PurePerms\Commands\SetRank; use _64FF00\PurePerms\DataManager\UserDataManager; use _64FF00\PurePerms\DataProviders\SQLite3Provider; use _64FF00\PurePerms\DataProviders\DefaultProvider; @@ -107,15 +107,15 @@ private function fixConfig() private function registerCommands() { $commandMap = $this->getServer()->getCommandMap(); - $commandMap->register("pureperms", new AddGroup($this, "addgroup", $this->getMessage("cmds.addgroup.desc") . ' #64FF00')); - $commandMap->register("pureperms", new DefGroup($this, "defgroup", $this->getMessage("cmds.defgroup.desc") . ' #64FF00')); - $commandMap->register("pureperms", new FPerms($this, "fperms", $this->getMessage("cmds.fperms.desc") . ' #64FF00')); - $commandMap->register("pureperms", new Groups($this, "groups", $this->getMessage("cmds.groups.desc") . ' #64FF00')); + $commandMap->register("pureperms", new AddRank($this, "addrank", $this->getMessage("cmds.addgroup.desc") . ' #64FF00')); + $commandMap->register("pureperms", new DefRank($this, "defrank", $this->getMessage("cmds.defgroup.desc") . ' #64FF00')); + $commandMap->register("pureperms", new PLPerms($this, "plperms", $this->getMessage("cmds.fperms.desc") . ' #64FF00')); + $commandMap->register("pureperms", new ListRanks($this, "listranks", $this->getMessage("cmds.groups.desc") . ' #64FF00')); $commandMap->register("pureperms", new PPInfo($this, "ppinfo", $this->getMessage("cmds.ppinfo.desc") . ' #64FF00')); - $commandMap->register("pureperms", new RmGroup($this, "rmgroup", $this->getMessage("cmds.rmgroup.desc") . ' #64FF00')); - $commandMap->register("pureperms", new SetGroup($this, "setgroup", $this->getMessage("cmds.setgroup.desc") . ' #64FF00')); - $commandMap->register("pureperms", new SetUPerm($this, "setuperm", $this->getMessage("cmds.setuperm.desc") . ' #64FF00')); - $commandMap->register("pureperms", new UnsetUPerm($this, "unsetuperm", $this->getMessage("cmds.unsetuperm.desc") . ' #64FF00')); + $commandMap->register("pureperms", new RmRank($this, "rmrank", $this->getMessage("cmds.rmgroup.desc") . ' #64FF00')); + $commandMap->register("pureperms", new SetRank($this, "setrank", $this->getMessage("cmds.setgroup.desc") . ' #64FF00')); + $commandMap->register("pureperms", new SetUserPerm($this, "setuperm", $this->getMessage("cmds.setuperm.desc") . ' #64FF00')); + $commandMap->register("pureperms", new UnSetUserPerm($this, "unsetuperm", $this->getMessage("cmds.unsetuperm.desc") . ' #64FF00')); } From 446a722b11881458dbae1378c117cd2e77e3c256 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 18:38:31 -0800 Subject: [PATCH 29/46] Fixed permission error. --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index aeaf119f..7adc666a 100644 --- a/plugin.yml +++ b/plugin.yml @@ -23,7 +23,7 @@ permissions: pperms.command.plperms: default: op description: "Allows you to find permissions for a specific plugin." - pperms.command.rank: + pperms.command.ranks: default: op description: "Allows you to see a list of all rank." pperms.command.listuperms: From 6ad8115e131313634702205c072a927314717a91 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 18:40:36 -0800 Subject: [PATCH 30/46] Renamed groups.yml to ranks.yml --- resources/{groups.yml => ranks.yml} | 66 +++++++++---------- .../DataProviders/DefaultProvider.php | 4 +- .../PurePerms/DataProviders/JsonProvider.php | 4 +- 3 files changed, 37 insertions(+), 37 deletions(-) rename resources/{groups.yml => ranks.yml} (94%) diff --git a/resources/groups.yml b/resources/ranks.yml similarity index 94% rename from resources/groups.yml rename to resources/ranks.yml index da4eda2c..b4a952b6 100644 --- a/resources/groups.yml +++ b/resources/ranks.yml @@ -1,33 +1,33 @@ - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - ---- -Guest: - alias: 'gst' - isDefault: true - inheritance: [] - permissions: - - pocketmine.command.list - worlds: [] -Admin: - alias: 'adm' - inheritance: - - Guest - permissions: - - pocketmine.broadcast - - pocketmine.command.gamemode - - pocketmine.command.give - - pocketmine.command.kick - - pocketmine.command.teleport - - pocketmine.command.time - worlds: [] -Owner: - alias: 'owr' - inheritance: - - Admin - permissions: - - essentials - - pocketmine.command - - pocketmine.command.ban - worlds: [] -... + +# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) + +--- +Guest: + alias: 'gst' + isDefault: true + inheritance: [] + permissions: + - pocketmine.command.list + worlds: [] +Admin: + alias: 'adm' + inheritance: + - Guest + permissions: + - pocketmine.broadcast + - pocketmine.command.gamemode + - pocketmine.command.give + - pocketmine.command.kick + - pocketmine.command.teleport + - pocketmine.command.time + worlds: [] +Owner: + alias: 'owr' + inheritance: + - Admin + permissions: + - essentials + - pocketmine.command + - pocketmine.command.ban + worlds: [] +... diff --git a/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php b/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php index 0aca4269..d5afae1f 100644 --- a/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php +++ b/src/_64FF00/PurePerms/DataProviders/DefaultProvider.php @@ -33,8 +33,8 @@ class DefaultProvider implements ProviderInterface public function __construct(PurePerms $plugin) { $this->plugin = $plugin; - $this->plugin->saveResource("groups.yml"); - $this->groups = new Config($this->plugin->getDataFolder() . "groups.yml", Config::YAML); + $this->plugin->saveResource("ranks.yml"); + $this->groups = new Config($this->plugin->getDataFolder() . "ranks.yml", Config::YAML); if(empty($this->groups->getAll())){ throw new RuntimeException($this->plugin->getMessage("logger_messages.YAMLProvider_InvalidGroupsSettings")); } diff --git a/src/_64FF00/PurePerms/DataProviders/JsonProvider.php b/src/_64FF00/PurePerms/DataProviders/JsonProvider.php index bff23974..940b1c3e 100644 --- a/src/_64FF00/PurePerms/DataProviders/JsonProvider.php +++ b/src/_64FF00/PurePerms/DataProviders/JsonProvider.php @@ -35,8 +35,8 @@ class JsonProvider implements ProviderInterface public function __construct(PurePerms $plugin) { $this->plugin = $plugin; - $this->plugin->saveResource("groups.yml"); - $this->groups = new Config($this->plugin->getDataFolder() . "groups.yml", Config::YAML, []); + $this->plugin->saveResource("ranks.yml"); + $this->groups = new Config($this->plugin->getDataFolder() . "ranks.yml", Config::YAML, []); $this->userDataFolder = $this->plugin->getDataFolder() . "players/"; if(!file_exists($this->userDataFolder)) @mkdir($this->userDataFolder, 0777, true); From d3d060ef5f4ff3bfa479829a60ca6f94f4bea352 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 18:42:07 -0800 Subject: [PATCH 31/46] Little changes in language file. --- resources/messages-en.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/resources/messages-en.yml b/resources/messages-en.yml index 8b884e5f..2a3f0115 100644 --- a/resources/messages-en.yml +++ b/resources/messages-en.yml @@ -16,7 +16,7 @@ cmds: desc: "Allows you to set default rank." usage: "Usage: /defrank [world]" messages: - defgroup_successfully: "Default rank has been successfully set to %var0%." + defranks_successfully: "Default rank has been successfully set to %var0%." rank_not_exist: "rank %var0% does NOT exist." level_not_exist: "World %var0% does NOT exist." plperms: @@ -36,22 +36,22 @@ cmds: ppinfo_console: "You are currently using PurePerms v%var0% by %var1%." ppinfo_player: "This server is using PurePerms v%var0% by %var1%." rmrank: - desc: "Removes a rank from the groups list." + desc: "Removes a rank from the ranks list." usage: "Usage: /rmrank " messages: - group_removed_successfully: "Removed %var0% from the rank list successfully." - group_not_exist: "rank %var0% does NOT exist." - invalid_group_name: "Invalid rank Name." + ranks_removed_successfully: "Removed %var0% from the rank list successfully." + ranks_not_exist: "rank %var0% does NOT exist." + invalid_ranks_name: "Invalid rank Name." setrank: desc: "Sets a rank for the user." usage: "Usage: /setrank [world]" messages: access_denied_01: "You don't have permission to set a player's rank to %var0%." - access_denied_02: "You don't have permission to change rank of a player with group %var0%." - group_not_exist: "Rank %var0% does NOT exist." + access_denied_02: "You don't have permission to change rank of a player with ranks %var0%." + ranks_not_exist: "Rank %var0% does NOT exist." level_not_exist: "World %var0% does NOT exist." - on_player_group_change: "Your rank has been changed to a / an %var0%!" - setgroup_successfully: "Added %var0% to the rank successfully." + on_player_ranks_change: "Your rank has been changed to a / an %var0%!" + setranks_successfully: "Added %var0% to the rank successfully." setuperm: desc: "Adds a permission to the user." usage: "Usage: /setuperm [world]" @@ -66,9 +66,9 @@ cmds: uperm_removed_successfully: "Removed permission %var0% from %var1% successfully." logger_messages: getConfigValue_01: "Key %var0% not found in config.yml." - getDefaultGroup_01: "More than one default group was declared in the groups file." - getDefaultGroup_02: "No default group was found in the groups file." - getDefaultGroup_03: "Setting the default group automatically." + getDefaultGroup_01: "More than one default ranks was declared in the ranks file." + getDefaultGroup_02: "No default ranks was found in the rankss file." + getDefaultGroup_03: "Setting the default ranks automatically." getGroup_01: "Group %var0% not found." getGroup_02: "Group %var0% has invalid or corrupted data." registerPlayer: "Registering player %var0%..." @@ -77,5 +77,5 @@ logger_messages: setProvider_SQLITE3: "Data provider is set to SQLITe3." setProvider_NotFound: "Provider %var0% does NOT exist. Setting the data provider to default." unregisterPlayer: "Unregistering player %var0%..." - YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted groups.yml." + YAMLProvider_InvalidGroupsSettings: "INVALID GROUPS.YML SETTINGS: Please check if you have an invalid or corrupted ranks.yml." ... \ No newline at end of file From 4feacdf1ee3d21b27aa0354ca5f4ecd5fe5374c3 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Mon, 22 Nov 2021 19:03:49 -0800 Subject: [PATCH 32/46] No longer unstable and functions as expected. --- resources/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/config.yml b/resources/config.yml index 3d0e9d0b..b3d59494 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -15,7 +15,7 @@ data-provider: json # English message resource by @64FF00 and @Samueljh1 (GitHub) default-language: en -# Setting this option will allow you to use per-world permissions (Unstable) +# Setting this option will allow you to use per-world permissions # - true / false enable-multiworld-perms: false From c96045b5dca60b9457450c6fbb5b8741d03516cb Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Mon, 22 Nov 2021 19:17:12 -0800 Subject: [PATCH 33/46] Perfectly done. --- README.md | 127 +++++++++--------------------------------------------- 1 file changed, 21 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index 556abe4b..0db67275 100644 --- a/README.md +++ b/README.md @@ -1,116 +1,31 @@ -# General +

+
+ Manage your permissions like you did on Bukkit. The best permissions manager for PocketMine-MP. +

-PurePerms by 64FF00 is a permissions manager for PocketMine-MP. - -It can be used in conjunction with PureChat to display players groups in chat. +

+ GitHubrelease + Stars + Discord +

# Commands Command | Description | Permission --- | --- | --- -`/addgroup ` | Adds a new group to the groups list. | pperms.command.addgroup -`/addparent ` | Adds a group to another group inheritance list. | pperms.command.addparent -`/defgroup [world]` | Allows you to set default group. | pperms.command.defgroup -`/fperms` | Allows you to find permissions for a specific plugin. | pperms.command.fperms -`/groups` | Shows a list of all groups. | pperms.command.groups -`/grpinfo [world]` | Shows info about a group. | pperms.command.grpinfo -`/listgperms [world]` | Shows a list of all permissions from a group. | pperms.command.listgperms -`/listuperms [world]` | Shows a list of all permissions from a user. | pperms.command.listuperms +`/addrank` | Adds a new rank | pperms.command.addrank +`/defrank [world]` | Allows you to set default rank. | pperms.command.defrank +`/plperms` | Allows you to find permissions for a specific plugin. | pperms.command.plperms +`/listranks` | Shows a list of all ranks. | pperms.command.ranks `/ppinfo` | Shows info about PurePerms. | pperms.command.ppinfo -`/ppsudo ` | Registers or logs into your Noeul account. | pperms.command.ppsudo -`/ppreload` | Reloads all PurePerms configurations. | pperms.command.ppreload -`/rmgroup ` | Removes a group from the groups list. | pperms.command.rmgroup -`/rmparent ` | Removes a group from another group inheritance list. | pperms.command.rmparent -`/setgperm [world]` | Adds a permission to the group. | pperms.command.setgperm -`/setgroup [world]` | Sets group for the user. | pperms.command.setgroup -`/setuperm [world]` | Adds a permission to the user. | pperms.command.setuperm -`/unsetgperm [world]` | Removes a permission from the group. | pperms.command.unsetgperm -`/unsetuperm [world]` | Removes a permission from the user. | pperms.command.unsetuperm -`/usrinfo [world]` | Shows info about a user. | pperms.command.usrinfo - -# Config - -``` YAML - -# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) - -# 제 블로그 이외에 허락없이 마음대로 플러그인 배포하실 시에는 바로 한국어 파일 삭제 조치하고 공유 중단합니다 - ---- -# Set default data provider for PurePerms -# - mysql, yamlv1, yamlv2 -data-provider: yamlv1 - -# Set the default language for PurePerms (<3) -# - en, ko, jp, ru, ua, it, sp, cz, sk, de, idn, tr -# English message resource by @64FF00 and @Samueljh1 (GitHub) -# Korean message resource by @64FF00 (GitHub) -# Japanese message resource by @onebone and @haniokasai (GitHub) -# Russian message resource by @vvzar and @Pub4Game (GitHub) -# Ukrainian message resource by @samalero (GitHub) -# Italian message resource by @AryToNeX (GitHub) -# Spanish message resource by @iksaku and @JoahDave (Github) -# Czech message resource by @Michael2010117 (GitHub) -# Slovak message resource by @Michael2010117 (GitHub) -# German message resource by @Exxarion (GitHub) -# Indonesian message resource by @DevillordMCPE (GitHub) -# Turkish messages resource by @PainTR (GitHub) -default-language: en - -# Disable /op permission for all players -# - true / false -disable-op: true - -# Setting this option will allow you to use per-world permissions -# - true / false -enable-multiworld-perms: false - -# Enables 'Noeul', a 'pointless' security management system for PurePerms -# - true / false -enable-noeul-sixtyfour: false - -# MySQL Settings (Only configure this if you are going to use MySQL data provider) -mysql-settings: - host: "PurePerms-FTW.loveyou.all" - port: 3306 - user: "YourUsernameGoesHere" - password: "YourPasswordGoesHere" - db: "YourDBNameGoesHere" - -# Sets a minimum length for a Noeul password when registering a new account -# - int -noeul-minimum-pw-length: 6 - -# Special thanks to @jazzwhistle for helping me with this cool feature! #JAZZWHISTLE-FTW -# Ranks that can only be set on console -# Also, users with a superadmin-rank can only have their rank changed on console -# - array -superadmin-ranks: ["OP"] -``` - -``` -YAML ---- -Guest: - alias: 'gst' - isDefault: true - inheritance: [] - permissions: - - -essentials.kit - - -essentials.kit.other - - -pocketmine.command.me - - pchat.colored.format - - pchat.colored.nametag - - pocketmine.command.list - - pperms.command.ppinfo - worlds: [] -``` +`/delrank ` | Removes a rank from the rank list. | pperms.command.delrank +`/setrank [world]` | Sets rank for the user. | pperms.command.setrank +`/unsetuperm [world]` | Removes a permission from the user. | pperms.command.unsetgperm +`/setuperm [world]` | Adds a permission to the user. | pperms.command.unsetuperm # Features -- Set up permissions for different groups! -- Multi-group inheritance system to allow you to inherit group permissions -- Multi-language support, just choose your favorite language in config.yml! (Currently supports Czech, English, German, Korean, Japanese, Russian, Italian, Indonesian, Slovak, Spanish, Turkish, and Ukrainian! :D) -- Supports YAML + MySQL providers -- Provides simple and flexible PurePerms API for plugin developers -- And so on... ;) +- Set up permissions for different rank! +- Multi-rank inheritance system to allow you to inherit rank permissions +- Supports JSON, SQLITe3 + MySQL providers +- Provides simple and flexible PurePerms usage and stable. From 91fc524be34635b0ca5d4720950a1f8a2df401ba Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Mon, 22 Nov 2021 19:19:22 -0800 Subject: [PATCH 34/46] Typo on perms --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0db67275..4535c830 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ Command | Description | Permission `/ppinfo` | Shows info about PurePerms. | pperms.command.ppinfo `/delrank ` | Removes a rank from the rank list. | pperms.command.delrank `/setrank [world]` | Sets rank for the user. | pperms.command.setrank -`/unsetuperm [world]` | Removes a permission from the user. | pperms.command.unsetgperm -`/setuperm [world]` | Adds a permission to the user. | pperms.command.unsetuperm +`/unsetuperm [world]` | Removes a permission from the user. | pperms.command.unsetuperm +`/setuperm [world]` | Adds a permission to the user. | pperms.command.setuperm # Features From 058055edffde38930c50db48abe813f09020023c Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Mon, 22 Nov 2021 19:21:22 -0800 Subject: [PATCH 35/46] Fixed link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4535c830..057fbdc8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

-
+
Manage your permissions like you did on Bukkit. The best permissions manager for PocketMine-MP.

From 31b93aee32b6547f7f7a71694bee07c7d38a4fe6 Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Mon, 22 Nov 2021 19:22:33 -0800 Subject: [PATCH 36/46] Final changes for README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 057fbdc8..9b3a5758 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

GitHubrelease - Stars + Stars Discord

From 7a28ac75ef74a03f2fdd62a012e5e30e27fde46e Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Tue, 23 Nov 2021 16:53:23 -0800 Subject: [PATCH 37/46] Fixed discord button --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b3a5758..bde1668e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

GitHubrelease Stars - Discord + Discord

# Commands From 913aa1025626e56cc4523a95d48a9a465ec8d5fd Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 28 Nov 2021 18:49:16 -0800 Subject: [PATCH 38/46] Fixed error when successfully setting a default rank doesnt show. --- resources/messages-en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/messages-en.yml b/resources/messages-en.yml index 2a3f0115..1dc32629 100644 --- a/resources/messages-en.yml +++ b/resources/messages-en.yml @@ -16,7 +16,7 @@ cmds: desc: "Allows you to set default rank." usage: "Usage: /defrank [world]" messages: - defranks_successfully: "Default rank has been successfully set to %var0%." + defrank_successfully: "Default rank has been successfully set to %var0%." rank_not_exist: "rank %var0% does NOT exist." level_not_exist: "World %var0% does NOT exist." plperms: From d5e45f45fc29c2122a7bf8916a1fe9d4122d427c Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Sun, 28 Nov 2021 18:52:57 -0800 Subject: [PATCH 39/46] Fixed messages --- src/_64FF00/PurePerms/Commands/PLPerms.php | 2 +- src/_64FF00/PurePerms/Commands/RmRank.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/_64FF00/PurePerms/Commands/PLPerms.php b/src/_64FF00/PurePerms/Commands/PLPerms.php index 74f2c373..f14c4280 100644 --- a/src/_64FF00/PurePerms/Commands/PLPerms.php +++ b/src/_64FF00/PurePerms/Commands/PLPerms.php @@ -55,7 +55,7 @@ public function execute(CommandSender $sender, string $label, array $args) : boo return false; if(!isset($args[0]) || count($args) > 2) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.fperms.usage")); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.plperms.usage")); return true; } diff --git a/src/_64FF00/PurePerms/Commands/RmRank.php b/src/_64FF00/PurePerms/Commands/RmRank.php index facb6967..83dc2f0f 100644 --- a/src/_64FF00/PurePerms/Commands/RmRank.php +++ b/src/_64FF00/PurePerms/Commands/RmRank.php @@ -60,15 +60,15 @@ public function execute(CommandSender $sender, string $label, array $args) : boo $result = $this->plugin->removeGroup($args[0]); if($result === PurePerms::SUCCESS) { - $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.group_removed_successfully", $args[0])); + $sender->sendMessage(TextFormat::GREEN . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.ranks_removed_successfully", $args[0])); } elseif($result === PurePerms::INVALID_NAME) { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.invalid_group_name", $args[0])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.invalid_ranks_name", $args[0])); } else { - $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.group_not_exist", $args[0])); + $sender->sendMessage(TextFormat::RED . PurePerms::MAIN_PREFIX . ' ' . $this->plugin->getMessage("cmds.rmrank.messages.ranks_not_exist", $args[0])); } return true; From a504cbe607fc4400f2aabc63893189a83f4e08ec Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Mon, 29 Nov 2021 16:21:55 -0800 Subject: [PATCH 40/46] Triggering Poggit build to get all latest changes --- .poggit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.poggit.yml b/.poggit.yml index 21b61e03..0d64d711 100644 --- a/.poggit.yml +++ b/.poggit.yml @@ -1,4 +1,4 @@ ---- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/Vecnavium/PurePerms +--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/Vecnavium/PurePerms build-by-default: true branches: - stable From 3bf2338a970e48daace4173f3817063dd14e1df0 Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Wed, 1 Dec 2021 19:39:43 -0800 Subject: [PATCH 41/46] Screw off and let my config.yml changes show everything --- src/_64FF00/PurePerms/PurePerms.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 4b4aa043..0109aaf4 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -68,7 +68,6 @@ class PurePerms extends PluginBase public function onLoad(): void { $this->saveDefaultConfig(); - $this->fixConfig(); $this->messages = new PPMessages($this); $this->userDataMgr = new UserDataManager($this); } @@ -89,21 +88,6 @@ public function onDisable(): void $this->provider->close(); } - private function fixConfig() - { - $config = $this->getConfig(); - if(!$config->exists("default-language")) - $config->set("default-language", "en"); - if(!$config->exists("disable-op")) - $config->set("disable-op", true); - if(!$config->exists("enable-multiworld-perms")) - $config->set("enable-multiworld-perms", false); - if(!$config->exists("superadmin-ranks")) - $config->set("superadmin-ranks", ["OP"]); - $this->saveConfig(); - $this->reloadConfig(); - } - private function registerCommands() { $commandMap = $this->getServer()->getCommandMap(); From d54de5c04730cdc7d080b667421d1f8555b45030 Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Fri, 3 Dec 2021 08:08:17 -0500 Subject: [PATCH 42/46] Fixed SQLITe class error --- .../DataProviders/SQLite3Provider.php | 104 +++++++++++------- 1 file changed, 66 insertions(+), 38 deletions(-) diff --git a/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php b/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php index 465a25f1..a5eda28c 100644 --- a/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php +++ b/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php @@ -1,39 +1,67 @@ -plugin = $plugin; - $this->db = new \SQLite3($plugin->getDataFolder()."pureperms.db"); - $this->db->exec(""); - $this->loadGroupsData(); - } - - public function loadGroupsData() - { - // - } +plugin = $plugin; + $this->db = new \SQLite3($plugin->getDataFolder()."pureperms.db"); + $this->db->exec(""); + $this->loadGroupsData(); + } + + public function loadGroupsData() + { + // + } + + public function getGroupData(PPGroup $group){ + } + + public function getGroupsData(){ + } + + public function getPlayerData(IPlayer $player){ + } + + public function getUsers(){ + } + + public function setGroupData(PPGroup $group, array $tempGroupData){ + } + + public function setGroupsData(array $tempGroupsData){ + } + + public function setPlayerData(IPlayer $player, array $tempPlayerData){ + } + + public function close(){ + } + } \ No newline at end of file From b836965d5aaa3ae9c5513e36593e12316aafc14d Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Fri, 3 Dec 2021 08:09:27 -0500 Subject: [PATCH 43/46] d54de5c04730cdc7d080b667421d1f8555b45030 --- resources/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/config.yml b/resources/config.yml index b3d59494..e83d16e0 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -5,9 +5,9 @@ --- # Set default data provider for PurePerms -# - json (JSON Database) (Stable & tested) +# - json (JSON Database) # - mysql (MYSQL Database) (UNTESTED) -# - sqlite3 (SQLITe3 Database) (NOT STABLE) +# - sqlite3 (SQLITe3 Database) data-provider: json # Set the default language for PurePerms From 2aa1502bb246ad1b1b2289ee46611d52d1c95a44 Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Fri, 3 Dec 2021 08:10:29 -0500 Subject: [PATCH 44/46] Unused --- src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php b/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php index a5eda28c..0df1fec6 100644 --- a/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php +++ b/src/_64FF00/PurePerms/DataProviders/SQLite3Provider.php @@ -4,7 +4,6 @@ use _64FF00\PurePerms\PPGroup; use _64FF00\PurePerms\PurePerms; use pocketmine\player\IPlayer; -use SQLite3; class SQLite3Provider implements ProviderInterface { From 198c8568afb42f236abd62e7661a2813379aaeda Mon Sep 17 00:00:00 2001 From: Vecnavium Date: Fri, 24 Dec 2021 04:50:21 -0800 Subject: [PATCH 45/46] Removed MYSQL temporarily --- resources/config.yml | 2 +- src/_64FF00/PurePerms/PurePerms.php | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/resources/config.yml b/resources/config.yml index e83d16e0..18afe6c1 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -6,7 +6,7 @@ --- # Set default data provider for PurePerms # - json (JSON Database) -# - mysql (MYSQL Database) (UNTESTED) +# - mysql (MYSQL Database) (Temporarily removed) # - sqlite3 (SQLITe3 Database) data-provider: json diff --git a/src/_64FF00/PurePerms/PurePerms.php b/src/_64FF00/PurePerms/PurePerms.php index 0109aaf4..4e6d3e67 100644 --- a/src/_64FF00/PurePerms/PurePerms.php +++ b/src/_64FF00/PurePerms/PurePerms.php @@ -111,13 +111,6 @@ private function setProvider($onEnable = true) $providerName = $this->getConfigValue("data-provider"); switch(strtolower($providerName)) { - case "mysql": - $provider = new MySQLProvider($this); - - if($onEnable === true) - $this->getLogger()->notice($this->getMessage("logger_messages.setProvider_MySQL")); - break; - case "sqlite3": $provider = new SQLite3Provider($this); if($onEnable === true) From 7125613a8701dc1c46798a93602a378e00aa028a Mon Sep 17 00:00:00 2001 From: Vecnavium <83182010+Vecnavium@users.noreply.github.com> Date: Fri, 24 Dec 2021 04:51:45 -0800 Subject: [PATCH 46/46] v2.0.0 is next --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 7adc666a..c512f609 100644 --- a/plugin.yml +++ b/plugin.yml @@ -3,7 +3,7 @@ name: PurePerms main: _64FF00\PurePerms\PurePerms -version: 1.4.4 +version: 2.0.0 api: [4.0.0] load: POSTWORLD author: "Vecnavium , 64FF00 & ProjectInfinity"