├── .gitignore ├── PvP-Stats ├── resources │ ├── mysql.sql │ └── Settings.yml ├── plugin.yml ├── README.md └── src │ └── jacknoordhuis │ └── pvpstats │ ├── providers │ ├── ProviderInterface.php │ ├── YAMLProvider.php │ └── MYSQLProvider.php │ ├── EventListener.php │ ├── StatsCommand.php │ └── Main.php ├── ChatLog ├── src │ └── jacknoordhuis │ │ └── chatlog │ │ └── Main.php └── plugin.yml ├── HealthStatus ├── README.md ├── plugin.yml ├── resources │ └── config.yml └── src │ └── jacknoordhuis │ └── healthstatus │ ├── Task.php │ ├── GroupChange.php │ ├── NickChange.php │ └── Main.php ├── SimpleTest ├── plugin.yml └── src │ └── jacknoordhuis │ └── simpletest │ ├── Main.php │ └── EventListener.php ├── PositionTeller ├── README.md ├── plugin.yml ├── resources │ └── Settings.yml └── src │ └── positionteller │ ├── tasks │ └── ShowPos.php │ ├── EventListener.php │ ├── Main.php │ └── commands │ └── TogglePos.php ├── Homes ├── plugin.yml └── src │ └── jacknoordhuis │ └── homes │ └── Main.php ├── MoreCommands ├── plugin.yml ├── README.md ├── resources │ └── config.yml └── src │ └── jacknoordhuis │ └── morecommands │ ├── commands │ ├── Hub.php │ ├── Lobby.php │ └── Spawn.php │ └── Main.php ├── InventoryClear ├── resources │ └── Settings.yml ├── plugin.yml └── src │ └── jacknoordhuis │ └── inventoryclear │ ├── command │ ├── ViewInv.php │ └── ClearInv.php │ ├── session │ └── ViewInv.php │ ├── Main.php │ └── EventListener.php ├── AntiHacks ├── plugin.yml ├── resources │ └── Settings.yml └── src │ └── jacknoordhuis │ └── antihacks │ ├── EventListener.php │ └── Main.php ├── DummyKits ├── src │ └── jacknoordhuis │ │ └── dummykits │ │ ├── entity │ │ ├── Dummy.php │ │ └── HumanDummy.php │ │ ├── command │ │ ├── commands │ │ │ ├── EditDummy.php │ │ │ └── AddDummy.php │ │ └── DummyCommand.php │ │ ├── kit │ │ ├── Kit.php │ │ └── KitManager.php │ │ ├── skin │ │ └── SkinManager.php │ │ ├── EventListener.php │ │ ├── dummy │ │ └── DummyManager.php │ │ └── Main.php ├── resources │ ├── Kits │ │ └── Default.yml │ └── Dummys │ │ └── Default.yml └── plugin.yml ├── Fly ├── plugin.yml └── src │ └── jacknoordhuis │ └── fly │ ├── FlySession.php │ ├── FlyCommand.php │ ├── Main.php │ └── EventListener.php ├── Sneak ├── plugin.yml ├── README.md └── src │ └── sneak │ ├── Main.php │ └── command │ └── SneakCommand.php ├── WorldProtector ├── src │ └── worldprotector │ │ ├── Main.php │ │ └── EventListener.php ├── README.md └── plugin.yml ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | nbproject/ 3 | .DS_Store 4 | PocketMine-MP/ 5 | PocketMine-DevTools.phar 6 | *.sh -------------------------------------------------------------------------------- /PvP-Stats/resources/mysql.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS pvp_stats ( 2 | name VARCHAR(255) PRIMARY KEY, 3 | kills INT DEFAULT 0, 4 | deaths INT DEFAULT 0 5 | ); 6 | -------------------------------------------------------------------------------- /ChatLog/src/jacknoordhuis/chatlog/Main.php: -------------------------------------------------------------------------------- 1 | getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /PositionTeller/README.md: -------------------------------------------------------------------------------- 1 | PositionTeller a PocketMine-MP 1.5 Plugin by CrazedMiner (Jack Noordhuis). 2 | 3 | Versions: 4 | 5 | v1.0- Realase, Sends a player a constant poup with their location, when activated via command. Download: 6 | https://www.dropbox.com/s/j1ux6z3tnc7qdhc/PositionTeller_v1.phar?dl=0 7 | 8 | To-do: 9 | Add a Config for easy editing of messages and various other things. 10 | 11 | Bugs: 12 | No known bugs. 13 | -------------------------------------------------------------------------------- /Homes/plugin.yml: -------------------------------------------------------------------------------- 1 | name: Homes 2 | description: Allows each player that joins your server to set a home that they can teleport to! 3 | main: jacknoordhuis\homes\Main 4 | version: 0.0.2 5 | api: [3.0.0] 6 | authors: 7 | - "JackNoordhuis" 8 | 9 | commands: 10 | home: 11 | description: "Teleport to your home" 12 | usage: "/home" 13 | sethome: 14 | description: "Set your home to your current position" 15 | usage: "/sethome" -------------------------------------------------------------------------------- /MoreCommands/plugin.yml: -------------------------------------------------------------------------------- 1 | name: MoreCommands 2 | author: CrazedMiner 3 | version: 1.0 4 | description: Simple Plugin that Adds More Commands to your PocketMine Server! 5 | main: jacknoordhuis\morecommands\Main 6 | api: 1.8.0 7 | 8 | commands: 9 | spawn: 10 | description: "Teleports you to Spawn" 11 | hub: 12 | description: "Teleports you to the Hub" 13 | lobby: 14 | description: "Teleports you to the Lobby" 15 | -------------------------------------------------------------------------------- /InventoryClear/resources/Settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # InventoryClear v2.0.0 Configuration file 4 | # 5 | # Command options 6 | commands: 7 | clearinv: 8 | self: true 9 | other: false 10 | viewinv: true 11 | # 12 | # Event options 13 | events: 14 | # Clear inventory on join 15 | join: true 16 | # Clear inventory on death 17 | death: false 18 | # Clear inventory on quit 19 | leave: true 20 | ... -------------------------------------------------------------------------------- /HealthStatus/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | #HealthStatus Beta Config File 4 | # 5 | #Use true to Enable or put anything else to Disable 6 | # 7 | #Symbol used for player health 8 | Symbol: "I" 9 | # 10 | #The color used for displaying the health a player has 11 | Health-Color: "&l&5" 12 | # 13 | #The color used for displaying the health a player has lost 14 | Used-Health-Color: "&l&7" 15 | # 16 | #Health display Settings 17 | Nametag: 18 | Enabled: true 19 | Format: "&7[&r@health&r]" 20 | ... 21 | -------------------------------------------------------------------------------- /AntiHacks/plugin.yml: -------------------------------------------------------------------------------- 1 | name: AntiHacks 2 | author: JackNoordhuis 3 | description: Implements extremely basic and highly config anti-hacks to your server 4 | version: 1.0.0 5 | main: jacknoordhuis\antihacks\Main 6 | api: 7 | - 1.0.0 8 | - 2.0.0 9 | 10 | permissions: 11 | antihacks: 12 | description: "AtiHacks main permission node" 13 | default: op 14 | children: 15 | antihacks.exempt: 16 | description: "Allows users to bypass the antihacks" 17 | default: op -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/entity/Dummy.php: -------------------------------------------------------------------------------- 1 | command. 14 | - Add /player lock command. 15 | - Add /getpos command. 16 | - Add /pos command. 17 | 18 | Bugs: 19 | - No known bugs. 20 | -------------------------------------------------------------------------------- /Fly/plugin.yml: -------------------------------------------------------------------------------- 1 | name: Fly 2 | author: Jack Noordhuis 3 | version: 0.0.1 4 | description: Allows players to fly 5 | main: jacknoordhuis\fly\Main 6 | api: 2.0.0 7 | 8 | commands: 9 | fly: 10 | description: "toggles flying" 11 | 12 | permissions: 13 | fly: 14 | description: "Main fly permission node" 15 | default: op 16 | 17 | fly.command: 18 | description: "Main fly command permission node" 19 | default: op 20 | 21 | fly.command.fly: 22 | description: "Fly command permission node" 23 | default: op 24 | -------------------------------------------------------------------------------- /PvP-Stats/plugin.yml: -------------------------------------------------------------------------------- 1 | name: PvP-Stats 2 | author: Jack Noordhuis (CrazedMiner) 3 | version: 1.3 4 | description: Counts players kills and deaths. 5 | main: jacknoordhuis\pvpstats\Main 6 | api: [1.12.0] 7 | 8 | commands: 9 | stats: 10 | description: "Checks a players stats." 11 | 12 | permissions: 13 | pvp-stats.command.other: 14 | description: Players with this permission are able to check the stats of other Players. 15 | default: op 16 | 17 | pvp-stats.command.self: 18 | description: Players with this permission are able to clear their own Inventories. 19 | default: true 20 | -------------------------------------------------------------------------------- /Sneak/plugin.yml: -------------------------------------------------------------------------------- 1 | name: Sneak 2 | author: Jack Noordhuis 3 | version: 1.1.1 4 | description: Players can Sneak by simply using a Command! 5 | main: jacknoordhuis\sneak\Main 6 | api: [1.13.0] 7 | 8 | commands: 9 | sneak: 10 | description: "Toggles Sneaking for you or the specified Player" 11 | 12 | permissions: 13 | sneak.command.other: 14 | description: Players with this permission are able to toggle sneaking for other Players 15 | default: op 16 | 17 | sneak.command.self: 18 | description: Players with this permission are able to toggle Sneaking for themselves 19 | default: true 20 | -------------------------------------------------------------------------------- /AntiHacks/resources/Settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # AntiHacks v1.0.0 Configeration file - Settings.yml 4 | # 5 | # The number of seconds a player can be in the air before being kicked 6 | in-air-threshold: 6 7 | # 8 | # The number of times a player can be tagged as jump hacking before being kicked 9 | jump-tag-threshold: 3 10 | # 11 | # How high does a player have to jump to be considered jump hacking in blocks 12 | jump-blocks: 2 13 | 14 | messages: 15 | flying-kick: "&l&cYou have been kicked for fly hacks!&r &o&6Please disable mods to play.&r" 16 | jumping-kick: "&l&cYou have been kicked for jump hacks!&r &o&6Please disable mods to play.&r" 17 | ... -------------------------------------------------------------------------------- /InventoryClear/plugin.yml: -------------------------------------------------------------------------------- 1 | name: InventoryClear 2 | author: Jack Noordhuis 3 | version: 2.0.0 4 | description: Basic plugin that aloows you to view and clear a players inventory with ease. 5 | main: jacknoordhuis\inventoryclear\Main 6 | api: 2.0.0 7 | 8 | permissions: 9 | inventoryclear.clearinv.other: 10 | description: Players with this permission are able to clear the Inventory of other Players 11 | default: op 12 | 13 | inventoryclear.clearinv.self: 14 | description: Players with this permission are able to clear their own Inventories 15 | default: true 16 | 17 | inventoryclear.viewinv: 18 | description: "Allows players to view other players' inventory's" 19 | default: true -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/command/commands/EditDummy.php: -------------------------------------------------------------------------------- 1 | setPermission("dummykits.command.edit"); 16 | } 17 | 18 | public function onExecute(CommandSender $sender, array $args) { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /PvP-Stats/resources/Settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | #PvP-Stats v1.1 Settings.yml Configuration File 4 | # 5 | #Data Provider (Currently the only options are YAML and MYSQL). 6 | data-provider: yaml 7 | # 8 | #MYSQL Server Settings 9 | mysql-settings: 10 | host: "127.0.0.1" 11 | port: 3306 12 | user: "user" 13 | password: "password" 14 | database: "databaseName" 15 | # 16 | #Color Symbol 17 | color-symbol: "&" 18 | # 19 | #/stats Command format 20 | other-command-format: "&r&l&b@player&r&6('s) Stats:\n&r&o&e- &r&aKills: &r&l&6@kills\n&r&o&e- &r&aDeaths: &r&l&6@deaths\n&r&o&e- &r&aK-D Ratio: &r&l&6@kdratio" 21 | self-command-format: "&r&6Your Stats:\n&r&o&e- &r&aKills: &r&l&6@kills\n&r&o&e- &r&aDeaths: &r&l&6@deaths\n&r&o&e- &r&aK-D Ratio: &r&l&6@kdratio" 22 | ... 23 | -------------------------------------------------------------------------------- /MoreCommands/resources/config.yml: -------------------------------------------------------------------------------- 1 | #MoreCommands v1.0 Config File 2 | # 3 | #/Spawn Command 4 | Spawn-Command-Enabled: true 5 | #/Spawn Command Message. Use \n for a new line 6 | Teleport-to-Spawn-Message: "----------------------------------------\nTeleporting to Spawn\n----------------------------------------" 7 | # 8 | #/Hub Command 9 | Hub-Command-Enabled: true 10 | #/Hub Command Message. Use \n for a new line 11 | Teleport-to-Hub-Message: "----------------------------------------\nTeleporting to Hub\n----------------------------------------" 12 | # 13 | #/Lobby Command 14 | Lobby-Command-Enabled: true 15 | #/Lobby Command Message. Use \n for a new line 16 | Teleport-to-Lobby-Message: "----------------------------------------\nTeleporting to Lobby\n----------------------------------------" 17 | -------------------------------------------------------------------------------- /PvP-Stats/README.md: -------------------------------------------------------------------------------- 1 | PvP-Stats a PocketMine-MP 1.5 Plugin by CrazedMiner (Jack Noordhuis). 2 | 3 | Versions: 4 | - v1.0- Realase, counts and saves kills and deaths to the provider specified in the config. Download: https://www.dropbox.com/s/otblx1100bml5kk/PvP-Stats_v1.phar?dl=0 5 | - v1.1- Second version, fixed YAML provider bugs, added an option to change the /stats command output. Download: https://www.dropbox.com/s/xf9xrnwppf6hrsl/PvP-Stats_v1.1.phar?dl=0 6 | - v1.2 - Third version, fixed a bug with the /stats command. Download: https://www.dropbox.com/s/wmqtz8ppws274ha/PvP-Stats_v1.2.phar?dl=0 7 | - v1.3 Fourth version, fixed another bug with the /stats command. Download: 8 | https://www.dropbox.com/s/1cxlhv6nm1t68w3/PvP-Stats_v1.3.phar?dl=0 9 | 10 | To-do: 11 | - Add more data prviders. 12 | 13 | Bugs: 14 | - No known bugs. 15 | -------------------------------------------------------------------------------- /Sneak/README.md: -------------------------------------------------------------------------------- 1 | # Sneak a PocketMine plugin developed by Jack Noordhuis 2 | Sneak is PocketMine-MP plugin that was made to enable players to sneak before it was added to the game. 3 | 4 | ### Commands 5 | - **Sneak** 6 | - Toggles sneaking for the sender or the player specified. 7 | 8 | ### Permission Nodes: 9 | - **sneak.command.other** 10 | - Players with this permission are able to toggle sneaking for any player. 11 | - **sneak.command.self** 12 | - Players with this permission are able to toggle sneaking for themselves. 13 | 14 | ## Disclaimer 15 | By using this plugin it is assumed you have read the main readme file included in this repo that gives you a general overview of the entire repo. 16 | It is assumed that by reading, using or editing this plugin that you have read and understood the GNU 3.0 (http://www.gnu.org/licenses/gpl-3.0.en.html) 17 | -------------------------------------------------------------------------------- /DummyKits/resources/Dummys/Default.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # DummyKits v0.0.1_Beta - Dummys/Deafult.yml 3 | # display name (& will be treated as a color code) 4 | name: "&6Default" 5 | # centered description (& will be treated as a color code) 6 | description: "&bI'm an NPC!" 7 | # position (x, y, z) 8 | pos: "130, 72, 128" 9 | # level 10 | level: world 11 | # yaw 12 | yaw: 180 13 | # pitch 14 | pitch: 0 15 | # item displayed in hand (id, meta, amount) 16 | hand-item: "0, 0, 0" 17 | # armor displayed (only works for players) (helmet, chestplate, leggings, boots) 18 | armor: "0, 0, 0, 0" 19 | # will npc look at players? (true or false) 20 | look: true 21 | # will npc knockback players that are too close? (true or false) 22 | knockback: true 23 | # kits to give when tapped 24 | kits: 25 | - default 26 | # commands to run when tapped ({player} being the players name) 27 | commands: 28 | - tp 128 70 128 29 | - say Hello! 30 | ... -------------------------------------------------------------------------------- /SimpleTest/src/jacknoordhuis/simpletest/EventListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 15 | } 16 | 17 | public function onMove(PlayerMoveEvent $event) { 18 | $player = $event->getPlayer(); 19 | $player->sendMessage("You're traveling at " . round($event->getFrom()->distance($event->getTo()), 5) . " blocks a movement."); 20 | } 21 | 22 | public function onInteract(PlayerInteractEvent $event) { 23 | $player = $event->getPlayer(); 24 | $player->sendMessage("You reached " . round($player->distance($event->getBlock()), 5) . " blocks."); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /DummyKits/plugin.yml: -------------------------------------------------------------------------------- 1 | name: DummyKits 2 | author: JackNoordhuis 3 | description: Adds some cool Entitys that do stuff! 4 | version: 0.0.2_Beta 5 | main: jacknoordhuis\dummykits\Main 6 | api: 2.0.0 7 | 8 | permissions: 9 | dummykits: 10 | description: "DummyKit's main permission node" 11 | default: op 12 | children: 13 | dummykits.command: 14 | description: "DummyKit's main command permission node" 15 | children: 16 | dummykits.command.add: 17 | description: "DummyKit's /AddDummy command" 18 | dummykits.command.edit: 19 | description: "DummyKit's /EditDummy permission node" 20 | dummykits.command.remove: 21 | description: "DummyKit's /RemoveDummy permission node" 22 | dummykits.kit: 23 | description: "DummyKit's main kit permission node" 24 | dummykits.dummy: 25 | description: "DummyKit's main dummy permission node" -------------------------------------------------------------------------------- /Fly/src/jacknoordhuis/fly/FlySession.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 15 | $this->player = $player; 16 | } 17 | 18 | public function getFlying() { 19 | return $this->flying; 20 | } 21 | 22 | public function setFlying($value = true) { 23 | $this->flying = $value; 24 | $this->updateFly(); 25 | } 26 | 27 | public function updateFly() { 28 | $this->player->resetFallDistance(); 29 | $this->player->setAllowFlight($this->flying); 30 | } 31 | 32 | public function close() { 33 | unset($this->plugin); 34 | unset($this->player); 35 | unset($this->flying); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /WorldProtector/src/worldprotector/Main.php: -------------------------------------------------------------------------------- 1 | getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); 27 | $this->getLogger()->info(TF::AQUA . "WorldProtector v1.1.0" . TF::GREEN . " by " . TF::YELLOW . "Jack Noordhuis" . TF::GREEN . ", Enabled successfully!"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /WorldProtector/README.md: -------------------------------------------------------------------------------- 1 | # WorldProtector a PocketMine plugin developed by Jack Noordhuis 2 | WorldProtector is designed to let you control everything certain events on your server through the use of permission nodes. 3 | WorldProtector currently allows you to control block placing, breaking, interaction and players attacking or taking damage. 4 | 5 | 6 | ### Permission Nodes: 7 | - **worldprotector.block.break** 8 | - Players with this permission are able to break anything blocks, anywhere. 9 | - **worldprotector.block.place** 10 | - Players with this permission are able to place any block, anywhere. 11 | - **worldprotector.block.interact** 12 | - Players with this permission are able to interact with any block, anywhere. 13 | - **worldprotector.player.attack** 14 | - Players with this permission are able to attack any player, anywhere. 15 | - **worldprotector.player.damage** 16 | - Players with this permission are able to take damage from anything, anywhere. 17 | 18 | ## Disclaimer 19 | By using this plugin it is assumed you have read the main readme file included in this repo that gives you a general overview of the entire repo. 20 | It is assumed that by reading, using or editing this plugin that you have read and understood the GNU 3.0 (http://www.gnu.org/licenses/gpl-3.0.en.html) 21 | -------------------------------------------------------------------------------- /PvP-Stats/src/jacknoordhuis/pvpstats/providers/ProviderInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace jacknoordhuis\pvpstats\providers; 20 | 21 | use pocketmine\IPlayer; 22 | 23 | interface ProviderInterface { 24 | 25 | public function getPlayer(IPlayer $player); 26 | 27 | public function getData($player); 28 | 29 | public function playerExists(IPlayer $player); 30 | 31 | public function addPlayer(IPlayer $player); 32 | 33 | public function removePlayer(IPlayer $player); 34 | 35 | public function updatePlayer(IPlayer $player, $type); 36 | 37 | public function close(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/command/DummyCommand.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 18 | } 19 | 20 | public function getPlugin() { 21 | return $this->plugin; 22 | } 23 | 24 | public function execute(CommandSender $sender, $commandLabel, string $args) { 25 | if($this->testPermission($sender)) { 26 | $result = $this->onExecute($sender, $args); 27 | if(is_string($result)) { 28 | $sender->sendMessage($result); 29 | } 30 | return true; 31 | } 32 | return false; 33 | } 34 | 35 | abstract public function onExecute(CommandSender $sender, array $args); 36 | } 37 | -------------------------------------------------------------------------------- /Sneak/src/sneak/Main.php: -------------------------------------------------------------------------------- 1 | getCommand("sneak")->setExecutor(new SneakCommand($this)); 31 | $this->getLogger()->info(TF::AQUA . "Sneak v1.1.1" . TF::GREEN . " by " . TF::YELLOW . "Jack Noordhuis" . TF::GREEN . ", Enabled successfully!"); 32 | } 33 | 34 | public function toggleSneak(Player $player) { 35 | $player->setSneaking(!$player->isSneaking()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /PositionTeller/resources/Settings.yml: -------------------------------------------------------------------------------- 1 | # PostionTeller v1.1 - Settings.yml Configeration file 2 | settings: 3 | general: 4 | 5 | messages: 6 | showpos: 7 | format: "&6X: &l&b@x&r &6Y: &l&b@y&r &6Z: &l&b@z" 8 | togglepos: 9 | self: 10 | succeed: 11 | activate: "&aYou have activated PositionTeller!" 12 | de-activate: "&6You have de-activated PositionTeller!" 13 | fail: 14 | default: "&cPositionTeller couldn't be activated." 15 | permission: "&cYou do not have permissions to use this command!" 16 | game: "&cPlease run this command in-game!" 17 | other: 18 | succeed: 19 | activate: 20 | sender: "&aYou have activated PostionTeller for &l&b@reciver&r&a!" 21 | reciver: "&l&b@sender&r &ahas activated PositionTeller for you!" 22 | de-activate: 23 | sender: "&aPositionTeller has been de-activated for &l&b@reciver&r&a!" 24 | reciver: "&l&b@sender&r &ahas de-activated PositionTeller for you!" 25 | fail: 26 | default: "&cPositionTeller couldn't find a player named &l&b@reciver&r&a, make sure you type a valid players name." 27 | permission: "&cYou do not have permissions to use this command!" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PocketMine-MP plugins 2 | This repo contains pretty much all of my public plugins for PocketMine. 3 | 4 | All plugins and code included in the repository are protected by the General Public license 3.0 (http://www.gnu.org/licenses/gpl-3.0.en.html) 5 | 6 | ### Working plugins 7 | - **Fly** 8 | - Allows players to fly by running the fly command if they have permission 9 | - **HealthStatus** 10 | - Displays a players health as part of their names 11 | - **InventoryClear** 12 | - Allows players to clear their own or another players inventory by running the clearinv command 13 | - **PositionTeller** 14 | - Displays a players location in a constant tip when they run the togglepos command 15 | - **PvP-Stats** 16 | - Saves players kills and deaths to either local yaml files or saves them in a MySQL database and displays them when the stats command is run 17 | - **Sneak** 18 | - Allows players to toggle sneaking by running the /sneak command 19 | - **WorldProtector** 20 | - Controls block breaking, placing, interaction and player damage through the use of permission nodes 21 | - **Dummy-Kits** 22 | - Needs some more work (custom skins etc) 23 | 24 | ### Not working or unfinished plugins 25 | - **ChatLog** 26 | - Currently unfinished 27 | - **KillMoneyFix** 28 | - Needs to be updated 29 | 30 | __The content of this repo is licensed under the GNU Lesser General Public License v3. A full copy of the license is available [here](LICENSE).__ 31 | -------------------------------------------------------------------------------- /WorldProtector/plugin.yml: -------------------------------------------------------------------------------- 1 | name: WorldProtector 2 | author: Jack Noordhuis 3 | version: 1.1.0 4 | description: Protects worlds from certain events through permissions 5 | main: jacknoordhuis\worldprotect\Main 6 | api: 7 | - 1.0.0 8 | - 2.0.0 9 | 10 | permissions: 11 | worldprotector: 12 | description: WorldProtector's main permission 13 | default: op 14 | 15 | worldprotector.block: 16 | description: WorldProtector's main permission for blocky things 17 | default: op 18 | 19 | worldprotector.block.break: 20 | description: WorldProtector's permission for block breaking things 21 | default: op 22 | worldprotector.block.place: 23 | description: WorldProtector's permission for block placing things 24 | default: op 25 | worldprotector.block.interact: 26 | description: WorldProtector's permission for block interaction things 27 | default: op 28 | 29 | worldprotector.player: 30 | description: WorldProtector's main permission for player things 31 | default: op 32 | 33 | worldprotector.player.attack: 34 | description: WorldProtector's permission for player attack things 35 | default: op 36 | worldprotector.player.damage: 37 | description: WorldProtector's permission for player damage things 38 | default: op 39 | -------------------------------------------------------------------------------- /MoreCommands/src/jacknoordhuis/morecommands/commands/Hub.php: -------------------------------------------------------------------------------- 1 | main = $plugin; 18 | } 19 | 20 | public function onCommand(CommandSender $sender, Command $cmd, $label,array $args){ 21 | if(strtolower($cmd->getName()) === "hub" && $this->main->getConfig()->get("Hub-Command-Enabled") === true) { 22 | if($sender instanceof Player) { 23 | if($sender->hasPermission("morecommands.command.hub")) { 24 | $sender->sendMessage($this->main->getConfig()->get("Teleport-to-Hub-Message")); 25 | $sender->teleport($this->main->getServer()->getDefaultLevel()->getSpawnLocation()); 26 | return true; 27 | } 28 | else { 29 | $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command."); 30 | } 31 | } 32 | else { 33 | $sender->sendMessage(TextFormat::RED . "Please use this command in-game!"); 34 | return true; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MoreCommands/src/jacknoordhuis/morecommands/commands/Lobby.php: -------------------------------------------------------------------------------- 1 | main = $plugin; 18 | } 19 | 20 | public function onCommand(CommandSender $sender, Command $cmd, $label,array $args){ 21 | if(strtolower($cmd->getName()) === "lobby" && $this->main->getConfig()->get("Lobby-Command-Enabled") === true) { 22 | if($sender instanceof Player) { 23 | if($sender->hasPermission("morecommands.command.lobby")) { 24 | $sender->sendMessage($this->main->getConfig()->get("Teleport-to-Lobby-Message")); 25 | $sender->teleport($this->main->getServer()->getDefaultLevel()->getSpawnLocation()); 26 | return true; 27 | } 28 | else { 29 | $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command."); 30 | } 31 | } 32 | else { 33 | $sender->sendMessage(TextFormat::RED . "Please use this command in-game!"); 34 | return true; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MoreCommands/src/jacknoordhuis/morecommands/commands/Spawn.php: -------------------------------------------------------------------------------- 1 | main = $plugin; 18 | } 19 | 20 | public function onCommand(CommandSender $sender, Command $cmd, $label,array $args){ 21 | if(strtolower($cmd->getName()) === "spawn" && $this->main->getConfig()->get("Spawn-Command-Enabled") === true) { 22 | if($sender instanceof Player) { 23 | if($sender->hasPermission("morecommands.command.spawn")) { 24 | $sender->sendMessage($this->main->getConfig()->get("Teleport-to-Spawn-Message")); 25 | $sender->teleport($this->main->getServer()->getDefaultLevel()->getSpawnLocation()); 26 | return true; 27 | } 28 | else { 29 | $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command."); 30 | } 31 | } 32 | else { 33 | $sender->sendMessage(TextFormat::RED . "Please use this command in-game!"); 34 | return true; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /PositionTeller/src/positionteller/tasks/ShowPos.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace jacknoordhuis\positionteller\tasks; 20 | 21 | use pocketmine\scheduler\PluginTask; 22 | 23 | use jacknoordhuis\positionteller\Main; 24 | 25 | class ShowPos extends PluginTask { 26 | 27 | private $plugin; 28 | 29 | public function __construct(Main $plugin){ 30 | parent::__construct($plugin); 31 | $this->plugin = $plugin; 32 | } 33 | 34 | public function getPlugin() { 35 | return $this->plugin; 36 | } 37 | 38 | public function onRun($tick){ 39 | foreach($this->getPlugin()->active as $player) { 40 | $player->sendPopup(str_replace(array("@x", "@y", "@z"), array(round($player->getX(), 1), round($player->getY(), 2), round($player->getZ(), 1)), Main::translateColors($this->getPlugin()->getConfigValue("messages.showpos.format")))); 41 | } 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /Fly/src/jacknoordhuis/fly/FlyCommand.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 17 | } 18 | 19 | public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { 20 | if(strtolower($cmd->getName()) === "fly") { 21 | if($sender instanceof Player) { 22 | if($sender->hasPermission("fly.command.fly")) { 23 | if($this->plugin->hasFlyingSession($sender)) { 24 | $session = $this->plugin->getFlyingSession($sender); 25 | $this->plugin->getFlyingSession($sender)->setFlying(!$session->getFlying()); 26 | $sender->sendMessage($session->getFlying() ? TF::GREEN . "You have enabled flying!" : TF::GOLD . "You have disabled flying!"); 27 | } 28 | } else { 29 | $sender->sendMessage(TF::RED . "You don't have permissions to use the 'fly' command!"); 30 | } 31 | } else { 32 | $sender->sendMessage(TF::RED . "You must use the 'fly' command in-game!"); 33 | } 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /PositionTeller/src/positionteller/EventListener.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace jacknoordhuis\positionteller; 20 | 21 | use pocketmine\event\Listener; 22 | use pocketmine\event\player\PlayerDeathEvent; 23 | use pocketmine\event\player\PlayerQuitEvent; 24 | 25 | class EventListener implements Listener { 26 | 27 | private $plugin; 28 | 29 | public function __construct(Main $main) { 30 | $this->plugin = $main; 31 | } 32 | 33 | public function getPlugin() { 34 | return $this->plugin; 35 | } 36 | 37 | public function onDeath(PlayerDeathEvent $event) { 38 | $player = $event->getEntity(); 39 | if($this->plugin->isActive($player)) { 40 | $this->plugin->removeActive($player); 41 | } 42 | } 43 | 44 | public function onQuit(PlayerQuitEvent $event) { 45 | $player = $event->getPlayer(); 46 | if($this->getPlugin()->isActive($player)) { 47 | $this->getPlugin()->removeActive($player); 48 | } 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /HealthStatus/src/jacknoordhuis/healthstatus/Task.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 36 | $this->player = $player; 37 | } 38 | 39 | public function onRun($tick) { 40 | $this->plugin = $this->getOwner(); 41 | $this->plugin->setHealthNametag($this->player); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/kit/Kit.php: -------------------------------------------------------------------------------- 1 | name = $name; 25 | $this->armor = $armor; 26 | $this->items = $items; 27 | $this->effects = $effects; 28 | $this->clearInv = $clearInv; 29 | $this->clearEffects = $clearEffects; 30 | } 31 | 32 | public function getName() { 33 | return $this->name; 34 | } 35 | 36 | public function getArmor() { 37 | return $this->armor; 38 | } 39 | 40 | public function addItem(Item $item) { 41 | $this->items[] = $item; 42 | } 43 | 44 | public function getItems() { 45 | return $this->items; 46 | } 47 | 48 | public function addEffect(Effect $effect) { 49 | $this->effects[] = $effect; 50 | } 51 | 52 | public function getEffects() { 53 | return $this->effects; 54 | } 55 | 56 | public function getClearInv() { 57 | return $this->clearInv; 58 | } 59 | 60 | public function getClearEffects() { 61 | return $this->clearEffects; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Fly/src/jacknoordhuis/fly/Main.php: -------------------------------------------------------------------------------- 1 | getCommand("fly")->setExecutor(new FlyCommand($this)); 15 | $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); 16 | $this->getLogger()->info(TF::AQUA . "Fly v1.0" . TF::GREEN . " by " . TF::YELLOW . "Jack Noordhuis" . TF::GREEN . ", Loaded successfully!"); 17 | } 18 | 19 | public function addFlyingSession(Player $player) { 20 | if($this->hasFlyingSession($player)) 21 | return null; 22 | $name = $player->getName(); 23 | return $this->active[spl_object_hash($player)] = new FlySession($this, $player); 24 | } 25 | 26 | public function hasFlyingSession(Player $player) { 27 | $name = $player->getName(); 28 | if(!isset($this->active[spl_object_hash($player)])) 29 | return false; 30 | return $this->active[spl_object_hash($player)] instanceof FlySession; 31 | } 32 | 33 | public function getFlyingSession(Player $player) { 34 | if(!$this->hasFlyingSession($player)) 35 | return null; 36 | return $this->active[spl_object_hash($player)]; 37 | } 38 | 39 | public function removeFlyingSession(Player $player) { 40 | if(!$this->hasFlyingSession($player)) 41 | return false; 42 | $this->getFlyingSession($player)->close(); 43 | unset($this->active[spl_object_hash($player)]); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /PvP-Stats/src/jacknoordhuis/pvpstats/EventListener.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace jacknoordhuis\pvpstats; 20 | 21 | use pocketmine\event\Listener; 22 | use pocketmine\event\player\PlayerJoinEvent; 23 | use pocketmine\event\player\PlayerDeathEvent; 24 | use pocketmine\event\entity\EntityDamageByEntityEvent; 25 | use pocketmine\Player; 26 | 27 | use CrazedMiner\Main; 28 | 29 | class EventListener implements Listener { 30 | 31 | public function __construct(Main $plugin) { 32 | $this->plugin = $plugin; 33 | } 34 | 35 | public function onJoin(PlayerJoinEvent $event) { 36 | if(!$this->plugin->playerExists($event->getPlayer())) { 37 | $this->plugin->addPlayer($event->getPlayer()); 38 | } 39 | } 40 | 41 | public function onDeath(PlayerDeathEvent $event) { 42 | if($event->getEntity()->getLastDamageCause() instanceof EntityDamageByEntityEvent) { 43 | $killer = $event->getEntity()->getLastDamageCause()->getDamager(); 44 | if($killer instanceof Player) { 45 | $this->plugin->updatePlayer($event->getEntity(), "deaths"); 46 | $this->plugin->updatePlayer($killer, "kills"); 47 | } 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /HealthStatus/src/jacknoordhuis/healthstatus/GroupChange.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 36 | } 37 | 38 | public function onGroupChange(PPGroupChangedEvent $event) { 39 | $this->player = $event->getPlayer(); 40 | $this->config = $this->plugin->getConfig()->getAll(); 41 | if($this->config["Nametag"]["Enabled"] === true) { 42 | $this->plugin->getServer()->getScheduler()->scheduleDelayedTask(new Task($this->plugin, $this->player), 1); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /HealthStatus/src/jacknoordhuis/healthstatus/NickChange.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 36 | } 37 | 38 | public function onNickChange(PlayerNickChangeEvent $event) { 39 | $this->plugin->broadcastMessage("A Players Nick has changed!"); 40 | $this->player = $event->getPlayer(); 41 | $this->config = $this->plugin->getConfig()->getAll(); 42 | if($this->config["Nametag"]["Enabled"] === true) { 43 | $this->plugin->getServer()->getScheduler()->scheduleDelayedTask(new Task($this, $this->player), 1); 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /InventoryClear/src/jacknoordhuis/inventoryclear/command/ViewInv.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 19 | } 20 | 21 | public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { 22 | if($sender instanceof Player) { 23 | if(isset($args[0])) { 24 | $name = $args[0]; 25 | $target = $this->plugin->getServer()->getPlayer($name); 26 | if($sender->hasPermission("inventoryclear.viewinv")) { 27 | if($target instanceof Player) { 28 | $this->plugin->viewInventory($sender, $target); 29 | } else { 30 | $sender->sendMessage(TF::RED . "Sorry, " . $name . " is not online!"); 31 | } 32 | } else { 33 | $sender->sendMessage(TF::RED . "You don't have permissions to use this command."); 34 | } 35 | } elseif($this->plugin->isViewing($sender->getName())) { 36 | $this->plugin->stopViewing($sender->getName()); 37 | } else { 38 | $sender->sendMessage(TF::RED . "Please specify a player!"); 39 | } 40 | } else { 41 | $sender->sendMessage(TF::RED . "Please run this command in-game!"); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /InventoryClear/src/jacknoordhuis/inventoryclear/command/ClearInv.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 19 | } 20 | 21 | public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { 22 | if(isset($args[0])) { 23 | $name = $args[0]; 24 | $target = $this->plugin->getServer()->getPlayer($name); 25 | if($sender->hasPermission("inventoryclear.clearinv.other")) { 26 | if($target instanceof Player) { 27 | $this->plugin->clearInventory($target, $sender); 28 | } else { 29 | $sender->sendMessage(TF::RED . "Sorry, " . $name . " is not online!"); 30 | } 31 | } else { 32 | $sender->sendMessage(TF::RED . "You don't have permissions to use this command."); 33 | } 34 | } else { 35 | if($sender instanceof Player) { 36 | if($sender->hasPermission("inventoryclear.clerinv.self")) { 37 | $this->plugin->clearInventory($sender); 38 | } else { 39 | $sender->sendMessage(TF::RED . "You don't have permissions to use this command."); 40 | } 41 | } else { 42 | $sender->sendMessage(TF::RED . "Please run this command in-game!"); 43 | } 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Fly/src/jacknoordhuis/fly/EventListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 20 | } 21 | 22 | public function onJoin(PlayerJoinEvent $event) { 23 | $player = $event->getPlayer(); 24 | if($this->plugin->hasFlyingSession($player)) { 25 | $this->plugin->removeFlyingSession($player); 26 | } 27 | $this->plugin->addFlyingSession($player); 28 | } 29 | 30 | public function onDamage(EntityDamageEvent $event) { 31 | $victim = $event->getEntity(); 32 | if($victim instanceof Player) { 33 | if(!$event->isCancelled()) { 34 | if($this->plugin->getFlyingSession($victim)->getFlying()) { 35 | $this->plugin->getFlyingSession($victim)->setFlying(false); 36 | $victim->sendMessage(TF::GOLD . "You are no longer in fly mode!"); 37 | } 38 | } 39 | } 40 | } 41 | 42 | public function onKick(PlayerKickEvent $event) { 43 | $player = $event->getPlayer(); 44 | if($this->plugin->hasFlyingSession($player)) { 45 | $this->plugin->removeFlyingSession($player); 46 | } 47 | } 48 | 49 | public function onQuit(PlayerQuitEvent $event) { 50 | $player = $event->getPlayer(); 51 | if($this->plugin->hasFlyingSession($player)) { 52 | $this->plugin->removeFlyingSession($player); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /MoreCommands/src/jacknoordhuis/morecommands/Main.php: -------------------------------------------------------------------------------- 1 | getLogger()->info(TextFormat::YELLOW . "Loading MoreCommands v1.0 By CrazedMiner...."); 41 | } 42 | 43 | public function onEnable() { 44 | if(!file_exists($this->getDataFolder() . "config.yml")) { 45 | @mkdir($this->getDataFolder()); 46 | file_put_contents($this->getDataFolder() . "config.yml",$this->getResource("config.yml")); 47 | } 48 | $this->getCommand("spawn")->setExecutor(new Spawn($this)); 49 | $this->getCommand("hub")->setExecutor(new Hub($this)); 50 | $this->getCommand("lobby")->setExecutor(new Lobby($this)); 51 | $this->getLogger()->info(TextFormat::GREEN . "MoreCommands v1.0 By CrazedMiner Enabled!"); 52 | } 53 | 54 | public function onDisable() { 55 | $this->getLogger()->info(TextFormat::LIGHT_PURPLE . "MoreCommands v1.0 By CrazedMiner Disabled!"); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/command/commands/AddDummy.php: -------------------------------------------------------------------------------- 1 | "); 15 | $this->setPermission("dummykits.command.add"); 16 | } 17 | 18 | public function onExecute(CommandSender $sender, array $args) { 19 | switch(count($args) - 1) { 20 | case 0: 21 | if($sender instanceof Player) { 22 | $this->getPlugin()->dummyManager->spawn(Main::translateColors($args[0]), "", $sender->getLevel(), $sender, $sender->getYaw(), $sender->getPitch(), $sender->getInventory()->getItemInHand(), $sender->getInventory()->getArmorContents()); 23 | } else { 24 | return "You must be a player to execute this command!"; 25 | } 26 | break; 27 | case 1: 28 | if($sender instanceof Player) { 29 | $this->getPlugin()->dummyManager->spawn(Main::translateColors($args[0]), Main::translateColors($args[1]), $sender->getLevel(), $sender, $sender->getYaw(), $sender->getPitch(), $sender->getInventory()->getItemInHand(), $sender->getInventory()->getArmorContents()); 30 | } else { 31 | return "You must be a player to execute this command!"; 32 | } 33 | break; 34 | default: 35 | if($sender instanceof Player) { 36 | $this->getPlugin()->dummyManager->spawn($sender->getName(), "", $sender->getLevel(), $sender, $sender->getYaw(), $sender->getPitch(), $sender->getInventory()->getItemInHand(), $sender->getInventory()->getArmorContents()); 37 | } else { 38 | return "You must be a player to execute this command!"; 39 | } 40 | break; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /InventoryClear/src/jacknoordhuis/inventoryclear/session/ViewInv.php: -------------------------------------------------------------------------------- 1 | owner = $owner; 19 | $this->target = $target; 20 | if($open) { 21 | $this->open(); 22 | } 23 | } 24 | 25 | public function open() { 26 | $this->lastKnownInv = clone $this->owner->getInventory(); 27 | $this->owner->getInventory()->setArmorContents($this->target->getInventory()->getArmorContents()); 28 | $this->owner->getInventory()->sendArmorContents($this->owner); 29 | $this->owner->getInventory()->setContents($this->target->getInventory()->getContents()); 30 | $this->owner->getInventory()->sendContents($this->owner); 31 | $this->owner->sendMessage(TF::GREEN . "You are now viewing " . TF::BOLD . TF::DARK_AQUA . $this->target->getName() . TF::RESET . TF::GREEN . "'s inventory, run " . TF::BOLD . TF::DARK_AQUA . "/viewinv" . TF::RESET . TF::GREEN . " to exit."); 32 | 33 | } 34 | 35 | public function close() { 36 | if(isset($this->lastKnownInv) and $this->lastKnownInv instanceof PlayerInventory) { 37 | $this->owner->getInventory()->clearAll(); 38 | $this->owner->getInventory()->setArmorContents($this->lastKnownInv->getArmorContents()); 39 | $this->owner->getInventory()->sendArmorContents($this->owner); 40 | $this->owner->getInventory()->setContents($this->lastKnownInv->getContents()); 41 | $this->owner->getInventory()->sendContents($this->owner); 42 | $this->lastKnownInv = null; 43 | $this->owner->sendMessage(TF::GOLD . "You are no longer viewing " . TF::BOLD . TF::DARK_AQUA . $this->target->getName() . TF::RESET . TF::GOLD . "'s inventory!"); 44 | } 45 | } 46 | 47 | public function end() { 48 | $this->close(); 49 | unset($this->owner); 50 | unset($this->target); 51 | unset($this->lastKnownInv); 52 | } 53 | 54 | public function __destruct() { 55 | $this->end(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/skin/SkinManager.php: -------------------------------------------------------------------------------- 1 | getDataFolder() . DIRECTORY_SEPARATOR . "Skins" . DIRECTORY_SEPARATOR; 16 | if(!is_dir(self::$path)) { 17 | @mkdir(self::$path); 18 | } 19 | } 20 | 21 | public static function writeSkin($name, $data, $skinName) { 22 | if(!self::skinExists($name)) { 23 | $file = fopen(($path = self::$path . $name . ".skin"), "w"); 24 | fwrite($file, "name: " . $name . "\n\r\n"); 25 | fwrite($file, "skin: " . zlib_encode($data, ZLIB_ENCODING_DEFLATE, 9). "\n\r\n"); 26 | fwrite($file, "skin-name: " . $skinName . "\n\r\n"); 27 | } else { 28 | return null; 29 | } 30 | } 31 | 32 | public static function readSkin($name) { 33 | $args = []; 34 | if(self::skinExists($name)) { 35 | foreach(explode("\n", self::$path . $name . ".skin") as $line){ 36 | $line = trim($line); 37 | if($line === "" or $line{0} === "#"){ 38 | continue; 39 | } 40 | 41 | $t = explode(":", $line); 42 | if(count($t) < 2){ 43 | continue; 44 | } 45 | 46 | $key = trim(array_shift($t)); 47 | $value = trim(implode(":", $t)); 48 | 49 | if($value === ""){ 50 | continue; 51 | } 52 | 53 | if($key === "name") { 54 | $args = ["name" => $value]; 55 | } elseif($key === "data") { 56 | $args = ["data" => zlib_decode($value)]; 57 | } elseif($key === "skin-name") { 58 | $args = ["skin-name" => $value]; 59 | } 60 | } 61 | return $args; 62 | } else { 63 | return null; 64 | } 65 | } 66 | 67 | public static function skinExists($name) { 68 | return file_exists(self::$path . $name . ".skin"); 69 | } 70 | 71 | public static function removeSkin($name) { 72 | if(self::skinExists($name)) { 73 | unlink(self::$path . $name . ".skin"); 74 | } else { 75 | return; 76 | } 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/EventListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 19 | } 20 | 21 | public function onPacketRecive(DataPacketReceiveEvent $event) { 22 | if($event->getPacket() instanceof InteractPacket) { 23 | $player = $event->getPlayer(); 24 | if(($target = $player->getLevel()->getEntity($event->getPacket()->target)) instanceof Dummy) { 25 | $event->setCancelled(true); 26 | foreach($target->kits as $kitName) { 27 | if(($kit = $this->plugin->kitManager->getKit(Main::removeColors($kitName))) instanceof Kit) { 28 | $this->plugin->kitManager->applyKit($player, $kit); 29 | } else { 30 | $this->plugin->getLogger()->error(Main::translateColors("&cCouldn't find a kit named " . $kitName ."!")); 31 | continue; 32 | } 33 | } 34 | foreach($target->commands as $cmd) { 35 | $this->plugin->getServer()->dispatchCommand($player, str_replace("{player}", $player->getName(), $cmd)); 36 | } 37 | } 38 | } 39 | } 40 | 41 | public function onMove(PlayerMoveEvent $event) { 42 | $player = $event->getPlayer(); 43 | foreach($player->level->getNearbyEntities($player->boundingBox->grow(4, 4, 4), $player) as $entity) { 44 | $distance = $player->distance($entity); 45 | if($entity instanceof Dummy) { 46 | $event->setCancelled(true); 47 | if($entity->knockback and $distance <= 1.4) { 48 | $player->knockBack($entity, 0, ($player->x - $entity->x), ($player->z - $entity->z), 0.4); 49 | } 50 | if($entity->move and $distance <= 10) { 51 | $entity->look($player); 52 | } 53 | } else { 54 | continue; 55 | } 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /AntiHacks/src/jacknoordhuis/antihacks/EventListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 33 | $plugin->getServer()->getPluginManager()->registerEvents($this, $plugin); 34 | } 35 | 36 | /** 37 | * 38 | * Get owning plugin instance 39 | * 40 | * @return Main 41 | */ 42 | public function getPlugin() { 43 | return $this->plugin; 44 | } 45 | 46 | /** 47 | * 48 | * @param PlayerMoveEvent $event 49 | * 50 | * @return null 51 | * 52 | * @priority HIGHEST 53 | */ 54 | public function onMove(PlayerMoveEvent $event) { 55 | $player = $event->getPlayer(); 56 | if($event->isCancelled() or $player->hasPermission("antifly.exempt")or $player->isCreative() or $player->isSpectator() or $player->getAllowFlight() or $player->hasEffect(Effect::JUMP)) { 57 | return; 58 | } else { 59 | if(($player->getInAirTicks() * 20) >= $this->plugin->getSettings()["in-air-threshold"]) { 60 | $player->kick(Main::applyColor($this->plugin->getSettings()["messages"]["flying-kick"]), false); 61 | } elseif(abs($event->getFrom()->y - $event->getTo()->y) >= $this->plugin->getSettings()["jump-blocks"]) { 62 | $this->plugin->addTag($player); 63 | } 64 | if($this->plugin->checkTag($player)) { 65 | $player->kick(Main::applyColor($this->plugin->getSettings()["messages"]["jumping-kick"]), false); 66 | } 67 | } 68 | return; 69 | } 70 | 71 | /** 72 | * @param PlayerQuitEvent $event 73 | * 74 | * @return null; 75 | */ 76 | public function onQuit(PlayerQuitEvent $event) { 77 | $this->plugin->removeTag($event->getPlayer()); 78 | return; 79 | } 80 | 81 | /** 82 | * @param PlayerKickEvent $event 83 | * 84 | * @return null 85 | */ 86 | public function onKick(PlayerKickEvent $event) { 87 | $this->plugin->removeTag($event->getPlayer()); 88 | return; 89 | } 90 | } -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/kit/KitManager.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 22 | $this->path = $plugin->getDataFolder() . DIRECTORY_SEPARATOR . "Kits" . DIRECTORY_SEPARATOR; 23 | $this->loadKits(); 24 | } 25 | 26 | public function loadKits() { 27 | if(!is_dir($this->path)) { 28 | @mkdir($this->path); 29 | $this->plugin->saveResource("Kits" . DIRECTORY_SEPARATOR . "Default.yml"); 30 | } 31 | 32 | foreach(scandir($this->path) as $kit) { 33 | $parts = explode(".", $kit); 34 | if(isset($parts[1]) and $parts[1] === "yml") { 35 | $data = (new Config($this->path . $kit, Config::YAML))->getAll(); 36 | $this->registerKit((string) $data["name"], Main::parseArmor($data["armor"]), Main::parseItems($data["items"]), Main::parseEffects($data["effects"]), (bool) $data["clear-inv"], (bool) $data["clear-effects"]); 37 | } else { 38 | continue; 39 | } 40 | } 41 | } 42 | 43 | public function registerKit($name, array $armor, array $items, array $effects, $clearInv, $clearEffects) { 44 | $this->kits[strtolower($name)] = new Kit($name, $armor, $items, $effects, $clearInv, $clearEffects); 45 | } 46 | 47 | public function isKit($string) { 48 | return isset($this->kits[strtolower($string)]) and $this->kits[$string] instanceof Kit; 49 | } 50 | 51 | public function getKit($string) { 52 | if(!$this->isKit($string)) return; 53 | return $this->kits[strtolower($string)]; 54 | } 55 | 56 | public function removeKit($string) { 57 | if(!$this->isKit($string)) return; 58 | unset($this->kits[strtolower($string)]); 59 | } 60 | 61 | public function applyKit(Player $player, Kit $kit) { 62 | if($kit->getClearInv()) $player->getInventory()->clearAll(); 63 | if($kit->getClearEffects()) $player->removeAllEffects(); 64 | $inv = $player->getInventory(); 65 | $armor = $kit->getArmor(); 66 | foreach($kit->getItems() as $item) { 67 | $inv->addItem($item); 68 | } 69 | $inv->setHelmet($armor[0]); 70 | $inv->setChestplate($armor[1]); 71 | $inv->setLeggings($armor[2]); 72 | $inv->setBoots($armor[3]); 73 | foreach($kit->getEffects() as $effect) { 74 | $player->addEffect($effect); 75 | } 76 | $player->sendMessage("You have recivied the " . $kit->getName() . " kit!"); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /WorldProtector/src/worldprotector/EventListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 34 | } 35 | 36 | public function onBreak(BlockBreakEvent $event) { 37 | if($event->getPlayer()->hasPermission("worldprotector.block.break")) { 38 | $event->setCancelled(false); 39 | } else { 40 | $event->setCancelled(true); 41 | } 42 | } 43 | 44 | public function onPlace(BlockPlaceEvent $event) { 45 | if($event->getPlayer()->hasPermission("worldprotector.block.place")) { 46 | $event->setCancelled(false); 47 | } else { 48 | $event->setCancelled(true); 49 | } 50 | } 51 | 52 | public function onInteract(PlayerInteractEvent $event) { 53 | if($event->getPlayer()->hasPermission("worldprotector.block.interact")) { 54 | $event->setCancelled(false); 55 | } else { 56 | $event->setCancelled(true); 57 | } 58 | } 59 | 60 | public function onDamage(EntityDamageEvent $event) { 61 | $victim = $event->getEntity(); 62 | if($victim instanceof Player) { 63 | if($victim->hasPermission("worldprotector.player.damage")) { 64 | $event->setCancelled(false); 65 | } elseif($victim->getLastDamageCause() instanceof EntityDamageByEntityEvent) { 66 | $attacker = $victim->getLastDamageCause()->getDamager(); 67 | if($attacker instanceof Player) { 68 | if($attacker->hasPermission("worldprotector.player.attack")) { 69 | $event->setCancelled(false); 70 | } else { 71 | $event->setCancelled(true); 72 | } 73 | } 74 | } else { 75 | $event->setCancelled(true); 76 | } 77 | } 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /Sneak/src/sneak/command/SneakCommand.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 35 | } 36 | 37 | public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { 38 | if(strtolower($cmd->getName()) === "sneak") { 39 | if(isset($args[0])) { 40 | $target = $this->plugin->getServer()->getPlayer($args[0]); 41 | if($sender->hasPermission("sneak.command.other")) { 42 | if($target instanceof Player) { 43 | $this->plugin->toggleSneak($target); 44 | $target->sendMessage(TF::BOLD . TF::AQUA . $sender->getName() . TF::RESET . TF::GOLD . " has toggled sneaking for you!"); 45 | $sender->sendMessage(TF::GOLD . "Toggled sneaking for " . TF::BOLD . TF::AQUA . $target->getName()) . TF::RESET . TF::GOLD . "!"; 46 | return true; 47 | } else { 48 | $sender->sendMessage(TF::RED . $args[0] . "is not online!"); 49 | return true; 50 | } 51 | } else { 52 | $sender->sendMessage(TF::RED . "You do not have permissions to use the 'sneak' command!"); 53 | return true; 54 | } 55 | } elseif($sender instanceof Player) { 56 | if($sender->hasPermission("sneak.command.self")) { 57 | $this->plugin->toggleSneak($sender); 58 | $sender->sendMessage(TF::GOLD . "You have toggled sneaking!"); 59 | } else { 60 | $sender->sendMessage(TF::RED . "You do not have permissions to use the 'sneak' command!"); 61 | } 62 | } else { 63 | $sender->sendMessage(TF::RED . "You must run the 'sneak' command in-game!"); 64 | } 65 | return false; 66 | } 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /PvP-Stats/src/jacknoordhuis/pvpstats/providers/YAMLProvider.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace jacknoordhuis\pvpstats\providers; 20 | 21 | use pocketmine\IPlayer; 22 | use pocketmine\utils\Config; 23 | 24 | use jacknoordhuis\pvpstats\Main; 25 | 26 | class YAMLProvider implements ProviderInterface { 27 | 28 | protected $plugin; 29 | 30 | public function __construct(Main $plugin) { 31 | $this->plugin = $plugin; 32 | @mkdir($this->plugin->getDataFolder() . "players/"); 33 | $this->plugin->getLogger()->info($this->plugin->translateColors("&r&aData Provider set to &r&6YAML&r&a!")); 34 | } 35 | 36 | public function getPlayer(IPlayer $player) { 37 | $name = strtolower($player->getName()); 38 | if($this->playerExists($player)) { 39 | return (new Config($this->plugin->getDataFolder() . "players/" . $name . ".yml", Config::YAML))->getAll(); 40 | } 41 | return null; 42 | } 43 | 44 | public function getData($player) { 45 | $name = strtolower($player); 46 | if(file_exists($this->plugin->getDataFolder() . "players/" . $name . ".yml")) { 47 | return (new Config($this->plugin->getDataFolder() . "players/" . $name . ".yml", Config::YAML))->getAll(); 48 | } 49 | return null; 50 | } 51 | 52 | public function playerExists(IPlayer $player) { 53 | $name = strtolower($player->getName()); 54 | return file_exists($this->plugin->getDataFolder() . "players/" . $name . ".yml"); 55 | } 56 | 57 | public function addPlayer(IPlayer $player) { 58 | $name = strtolower($player->getName()); 59 | return new Config($this->plugin->getDataFolder() . "players/" . $name . ".yml", Config::YAML, array( 60 | "name" => $name, 61 | "kills" => 0, 62 | "deaths" => 0 63 | )); 64 | } 65 | 66 | public function removePlayer(IPlayer $player) { 67 | $name = strtolower($player->getName()); 68 | if($this->playerExists($player)) { 69 | @unlink($this->plugin->getDataFolder() . "players/" . $name . ".yml"); 70 | }else { 71 | return null; 72 | } 73 | } 74 | 75 | public function updatePlayer(IPlayer $player, $type) { 76 | $name = strtolower($player->getName()); 77 | if($this->playerExists($player)) { 78 | @mkdir($this->plugin->getDataFolder() . "players/" . $name . ".yml"); 79 | $data = new Config($this->plugin->getDataFolder() . "players/" . $name . ".yml"); 80 | $data->set($type, $data->getAll()[$type] + 1); 81 | return $data->save(); 82 | }else { 83 | $this->addPlayer($player); 84 | } 85 | } 86 | 87 | public function close() { 88 | 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /Homes/src/jacknoordhuis/homes/Main.php: -------------------------------------------------------------------------------- 1 | getDataFolder()) . self::DATA_FOLDER) { 42 | @mkdir($this->getDataFolder() . self::DATA_FOLDER); 43 | } 44 | 45 | $this->getServer()->getPluginManager()->registerEvents($this, $this); 46 | } 47 | 48 | /** 49 | * Handle all the command execution 50 | * 51 | * @param CommandSender $sender 52 | * @param Command $command 53 | * @param string $label 54 | * @param array $args 55 | * 56 | * @return bool 57 | */ 58 | public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool { 59 | if($sender instanceof Player) { 60 | switch(strtolower($command->getName())) { 61 | case "home": 62 | if($this->hasHome($sender->getName())) { 63 | $sender->teleport($this->getHome($sender->getName())); 64 | $sender->sendMessage(TextFormat::GREEN . "You have been teleported!"); 65 | } else { 66 | $sender->sendMessage(TextFormat::RED . "You have no home set!"); 67 | } 68 | return true; 69 | case "sethome": 70 | $this->saveHome($sender->getName(), clone $sender->getPosition()); 71 | $sender->sendMessage(TextFormat::GREEN . "Home saved!"); 72 | return true; 73 | } 74 | } else { 75 | $sender->sendMessage(TextFormat::RED . "Please use this command in-game!"); 76 | return true; 77 | } 78 | 79 | return false; 80 | } 81 | 82 | /** 83 | * Get a players home 84 | * 85 | * @param $name 86 | * 87 | * @return Vector3 88 | */ 89 | public function getHome($name) : Vector3 { 90 | $data = json_decode(file_get_contents($this->getDataFolder() . self::DATA_FOLDER . strtolower($name) . ".json")); 91 | return new Vector3($data->x, $data->y, $data->z); 92 | } 93 | 94 | /** 95 | * Save a players home 96 | * 97 | * @param $name 98 | * 99 | * @param Vector3 $pos 100 | */ 101 | public function saveHome($name, Vector3 $pos) : void { 102 | $file = fopen($this->getDataFolder() . self::DATA_FOLDER . strtolower($name) . ".json", "w"); 103 | fwrite($file, json_encode([ 104 | "x" => $pos->x, 105 | "y" => $pos->y, 106 | "z" => $pos->z 107 | ])); 108 | fclose($file); 109 | } 110 | 111 | /** 112 | * Check if a player has a home 113 | * 114 | * @param $name 115 | * 116 | * @return bool 117 | */ 118 | public function hasHome($name) : bool { 119 | return is_file($this->getDataFolder() . self::DATA_FOLDER . strtolower($name) . ".json"); 120 | } 121 | 122 | } -------------------------------------------------------------------------------- /PvP-Stats/src/jacknoordhuis/pvpstats/StatsCommand.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 19 | } 20 | 21 | public function onCommand(CommandSender $sender, Command $cmd, $label, array $args){ 22 | if(strtolower($cmd->getName()) === "stats") { 23 | if(isset($args[0])) { 24 | $name = $args[0]; 25 | if($sender->hasPermission("pvp-stats.command.other")) { 26 | if($this->plugin->getData($name) !== null) { 27 | if($this->plugin->getData($name)["kills"] >= 1 and $this->plugin->getData($name)["deaths"] >= 1) { 28 | $sender->sendMessage($this->plugin->translateColors(str_replace(array("@player", "@kills", "@deaths", "@kdratio"), array($name, $this->plugin->getData($name)["kills"], $this->plugin->getData($name)["deaths"], (round((($this->plugin->getData($name)["kills"]) / ($this->plugin->getData($name)["deaths"])), 3))), (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["other-command-format"]))); 29 | }else { 30 | $sender->sendMessage($this->plugin->translateColors(str_replace(array("@player", "@kills", "@deaths", "@kdratio"), array($name, $this->plugin->getData($name)["kills"], $this->plugin->getData($name)["deaths"], ("&r&cN&r&7/&r&cA&r")), (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["other-command-format"]))); 31 | } 32 | } 33 | else { 34 | $sender->sendMessage(TextFormat::RED . "Sorry, stats for " . $name . " don't exist."); 35 | } 36 | } 37 | else { 38 | $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command."); 39 | } 40 | } 41 | else { 42 | if($sender instanceof Player) { 43 | if($sender->hasPermission("pvp-stats.command.self")) { 44 | if($this->plugin->getPlayer($sender)["kills"] >= 1 and $this->plugin->getPlayer($sender)["deaths"] >= 1) { 45 | $sender->sendMessage($this->plugin->translateColors(str_replace(array("@kills", "@deaths", "@kdratio"), array($this->plugin->getPlayer($sender)["kills"], $this->plugin->getPlayer($sender)["deaths"], (round(($this->plugin->getPlayer($sender)["kills"] / $this->plugin->getPlayer($sender)["deaths"]), 3))), (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["self-command-format"]))); 46 | }else { 47 | $sender->sendMessage($this->plugin->translateColors(str_replace(array("@kills", "@deaths", "@kdratio"), array($this->plugin->getPlayer($sender)["kills"], $this->plugin->getPlayer($sender)["deaths"], ("&r&cN&r&7/&r&cA&r")), (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["self-command-format"]))); 48 | } 49 | } 50 | else { 51 | $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command."); 52 | } 53 | } 54 | else { 55 | $sender->sendMessage(TextFormat::RED . "Please run this command in-game!"); 56 | } 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /PositionTeller/src/positionteller/Main.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace jacknoordhuis\positionteller; 20 | 21 | use pocketmine\plugin\PluginBase; 22 | use pocketmine\utils\Config; 23 | use pocketmine\utils\TextFormat as TF; 24 | use pocketmine\Player; 25 | 26 | use jacknoordhuis\positionteller\commands\TogglePos; 27 | use jacknoordhuis\positionteller\tasks\ShowPos; 28 | 29 | class Main extends PluginBase { 30 | 31 | /** @var array Settings.yml */ 32 | private $settings = []; 33 | 34 | /** @var array Active Players */ 35 | public $active = array(); 36 | 37 | public function onEnable() { 38 | $this->saveResource("Settings.yml"); 39 | $this->settings = new Config($this->getDataFolder() . "Settings.yml", Config::YAML); 40 | $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); 41 | $this->getCommand("togglepos")->setExecutor(new TogglePos($this)); 42 | $this->getServer()->getScheduler()->scheduleRepeatingTask(new ShowPos($this), 4); 43 | $this->getLogger()->info(TF::AQUA . "PositionTeller v1.0" . TF::GREEN . " by " . TF::YELLOW . "Jack Noordhuis" . TF::GREEN . ", Loaded successfully!"); 44 | } 45 | 46 | public function onDisable() { 47 | unset($this->settings); 48 | unset($this->active); 49 | } 50 | 51 | public function addActive(Player $player) { 52 | $this->active[spl_object_hash($player)] = $player; 53 | } 54 | 55 | public function isActive(Player $player) { 56 | return isset($this->active[spl_object_hash($player)]); 57 | } 58 | 59 | public function removeActive(Player $player) { 60 | unset($this->active[spl_object_hash($player)]); 61 | } 62 | 63 | public function getConfigValue($nested) { 64 | return $this->settings->getNested("settings." . $nested); 65 | } 66 | 67 | public static function translateColors($string, $symbol = "&") { 68 | $string = str_replace($symbol."0", TF::BLACK, $string); 69 | $string = str_replace($symbol."1", TF::DARK_BLUE, $string); 70 | $string = str_replace($symbol."2", TF::DARK_GREEN, $string); 71 | $string = str_replace($symbol."3", TF::DARK_AQUA, $string); 72 | $string = str_replace($symbol."4", TF::DARK_RED, $string); 73 | $string = str_replace($symbol."5", TF::DARK_PURPLE, $string); 74 | $string = str_replace($symbol."6", TF::GOLD, $string); 75 | $string = str_replace($symbol."7", TF::GRAY, $string); 76 | $string = str_replace($symbol."8", TF::DARK_GRAY, $string); 77 | $string = str_replace($symbol."9", TF::BLUE, $string); 78 | $string = str_replace($symbol."a", TF::GREEN, $string); 79 | $string = str_replace($symbol."b", TF::AQUA, $string); 80 | $string = str_replace($symbol."c", TF::RED, $string); 81 | $string = str_replace($symbol."d", TF::LIGHT_PURPLE, $string); 82 | $string = str_replace($symbol."e", TF::YELLOW, $string); 83 | $string = str_replace($symbol."f", TF::WHITE, $string); 84 | 85 | $string = str_replace($symbol."k", TF::OBFUSCATED, $string); 86 | $string = str_replace($symbol."l", TF::BOLD, $string); 87 | $string = str_replace($symbol."m", TF::STRIKETHROUGH, $string); 88 | $string = str_replace($symbol."n", TF::UNDERLINE, $string); 89 | $string = str_replace($symbol."o", TF::ITALIC, $string); 90 | $string = str_replace($symbol."r", TF::RESET, $string); 91 | 92 | return $string; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /PvP-Stats/src/jacknoordhuis/pvpstats/providers/MYSQLProvider.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace Cjacknoordhuis\pvpstats\providers; 20 | 21 | use pocketmine\utils\Config; 22 | use pocketmine\IPlayer; 23 | 24 | use jacknoordhuis\pvpstats\Main; 25 | 26 | class MYSQLProvider implements ProviderInterface { 27 | 28 | protected $plugin; 29 | 30 | protected $database; 31 | 32 | public function __construct(Main $plugin) { 33 | $this->plugin = $plugin; 34 | $settings = (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["mysql-settings"]; 35 | 36 | if(!isset($settings["host"]) or !isset($settings["user"]) or !isset($settings["password"]) or !isset($settings["database"]) or !isset($settings["port"])) { 37 | $this->plugin->getLogger()->critical("Invalid MySQL Settings!"); 38 | return; 39 | } 40 | 41 | $this->database = new \mysqli($settings["host"], $settings["user"], $settings["password"], $settings["database"], $settings["port"]); 42 | if($this->database->connect_error) { 43 | $this->plugin->getLogger()->critical("Couldn't connect to MySQL:" . $this->database->connect_error); 44 | return; 45 | } 46 | 47 | $resource = $this->plugin->getResource("mysql.sql"); 48 | $this->database->query(stream_get_contents($resource)); 49 | fclose($resource); 50 | $this->plugin->getLogger()->info("Data Provider set to MySQL!"); 51 | } 52 | 53 | public function getPlayer(IPlayer $player) { 54 | $name = strtolower($player->getName()); 55 | $result = $this->database->query("SELECT * FROM pvp_stats WHERE name = '" . $this->database->escape_string($name). "'"); 56 | if($result instanceof \mysqli_result) { 57 | $data = $result->fetch_assoc(); 58 | $result->free(); 59 | if(isset($data["name"]) and strtolower($data["name"] === $name)) { 60 | unset($data["name"]); 61 | return $data; 62 | } 63 | } 64 | return null; 65 | } 66 | 67 | public function getData($player) { 68 | $name = strtolower($player); 69 | $result = $this->database->query("SELECT * FROM pvp_stats WHERE name = '" . $this->database->escape_string($name). "'"); 70 | if($result instanceof \mysqli_result) { 71 | $data = $result->fetch_assoc(); 72 | $result->free(); 73 | if(isset($data["name"]) and strtolower($data["name"] === $name)) { 74 | unset($data["name"]); 75 | return $data; 76 | } 77 | } 78 | return null; 79 | } 80 | 81 | public function playerExists(IPlayer $player) { 82 | if($this->getPlayer($player) !== null) { 83 | return true; 84 | } 85 | return null; 86 | } 87 | 88 | public function addPlayer(IPlayer $player) { 89 | $name = strtolower($player->getName()); 90 | $this->database->query("INSERT INTO pvp_stats 91 | (name, kills, deaths) 92 | VALUES 93 | ('" . $this->database->escape_string($name) . "', '0', '0') 94 | "); 95 | } 96 | 97 | public function removePlayer(IPlayer $player) { 98 | $name = strtolower($player->getName()); 99 | if($this->playerExists($player)) { 100 | $this->database->query("DELETE FROM pvp_stats WHERE name = '" . $name . "'"); 101 | }else { 102 | return null; 103 | } 104 | } 105 | 106 | public function updatePlayer(IPlayer $player, $type) { 107 | $name = strtolower($player->getName()); 108 | $this->database->query("UPDATE pvp_stats SET " . $type . " = " . $type . " + 1 WHERE name = '" . $name . "'"); 109 | } 110 | 111 | public function close() { 112 | 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /PositionTeller/src/positionteller/commands/TogglePos.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace jacknoordhuis\positionteller\commands; 20 | 21 | use pocketmine\command\CommandExecutor; 22 | use pocketmine\command\Command; 23 | use pocketmine\command\CommandSender; 24 | use pocketmine\Player; 25 | 26 | use jacknoordhuis\positionteller\Main; 27 | 28 | class TogglePos implements CommandExecutor { 29 | 30 | 31 | private $plugin; 32 | 33 | public function __construct(Main $plugin){ 34 | $this->plugin = $plugin; 35 | } 36 | 37 | public function getPlugin() { 38 | return $this->plugin; 39 | } 40 | 41 | public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { 42 | if(strtolower($cmd->getName()) === "togglepos") { 43 | if(isset($args[0])) { 44 | if($sender->hasPermission("positionteller.command.togglepos.other")) { 45 | $name = $args[0]; 46 | $target = $this->getPlugin()->getServer()->getPlayer($name); 47 | if($target instanceof Player) { 48 | if($this->getPlugin()->isActive($target)) { 49 | $this->getPlugin()->removeActive($target); 50 | $sender->sendMessage(str_replace("@reciver", $target->getName(), Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.succeed.de-activate.sender")))); 51 | $target->sendMessage(str_replace("@sender", $sender->getName(), Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.succeed.de-activate.reciver")))); 52 | return true; 53 | } else { 54 | $this->getPlugin()->addActive($target); 55 | $sender->sendMessage(str_replace("@reciver", $target->getName(), Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.succeed.activate.sender")))); 56 | $target->sendMessage(str_replace("@sender", $sender->getName(), Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.succeed.activate.reciver")))); 57 | return true; 58 | } 59 | } else { 60 | $sender->sendMessage(str_replace("@reciver", $name, Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.fail.default")))); 61 | return true; 62 | } 63 | } else { 64 | $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.fail.permisson"))); 65 | return true; 66 | } 67 | } else { 68 | if($sender instanceof Player) { 69 | if($sender->hasPermission("positionteller.command.togglepos.self")) { 70 | if($this->getPlugin()->isActive($sender)) { 71 | $this->getPlugin()->removeActive($sender); 72 | $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.self.succeed.de-activate"))); 73 | return true; 74 | } else { 75 | $this->getPlugin()->addActive($sender); 76 | $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.self.succeed.activate"))); 77 | return true; 78 | } 79 | } else { 80 | $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.self.fail.permission"))); 81 | return true; 82 | } 83 | } else { 84 | $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.self.fail.game"))); 85 | return true; 86 | } 87 | } 88 | } 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /InventoryClear/src/jacknoordhuis/inventoryclear/Main.php: -------------------------------------------------------------------------------- 1 | loadConfigs(); 49 | $this->registerCommands(); 50 | new EventListener($this); 51 | $this->getLogger()->info(TF::GREEN . "InventoryClear v2.0.0 by JackNoordhuis has been enabled!"); 52 | } 53 | 54 | public function loadConfigs() { 55 | $this->saveResource("Settings.yml"); 56 | $this->settings = (new Config($this->getDataFolder() . "Settings.yml", Config::YAML))->getAll(); 57 | } 58 | 59 | public function registerCommands() { 60 | if((bool) $this->settings["commands"]["clearinv"]["self"] or (bool) $this->settings["commands"]["clearinv"]["other"]) { 61 | $cmd = (new PluginCommand("clearinv", $this)); 62 | $cmd->setDescription("Clear your own or another players inventory"); 63 | $cmd->setExecutor(new ClearInv($this)); 64 | $this->getServer()->getCommandMap()->register("ic", $cmd); 65 | } 66 | if($this->settings["commands"]["viewinv"]) { 67 | $cmd = new PluginCommand("viewinv", $this); 68 | $cmd->setDescription("View a players inventory"); 69 | $cmd->setExecutor(new ViewInv($this)); 70 | $this->getServer()->getCommandMap()->register("ic", $cmd); 71 | } 72 | } 73 | 74 | public function onDisable() { 75 | $this->getLogger()->info(TF::DARK_GREEN . "InventoryClear v2.0.0 by JackNoordhuis has been disabled!"); 76 | } 77 | 78 | public function clearInventory(Player $player, CommandSender $sender = null) { 79 | if($player instanceof Player and $player->getInventory()instanceof PlayerInventory) { 80 | $player->getInventory()->clearAll(); 81 | } 82 | if($sender instanceof CommandSender) { 83 | $player->sendMessage(TF::GOLD . "Your inventory has been cleared by " . TF::BOLD . TF::DARK_AQUA . $sender->getName() . TF::RESET . TF::GOLD . "!"); 84 | $sender->sendMessage(TF::GOLD . "Successfully cleared " . TF::BOLD . TF::DARK_AQUA . $player->getName() . TF::RESET . TF::GOLD . "'s inventory!"); 85 | } else { 86 | $player->sendMessage(TF::GOLD . "Your inventory was cleared successfully!"); 87 | } 88 | } 89 | 90 | public function viewInventory(Player $player, Player $target) { 91 | $this->viewing[$player->getName()] = new ViewSession($player, $target, true); 92 | } 93 | 94 | public function isViewing($name) { 95 | return isset($this->viewing[$name]) and $this->viewing[$name] instanceof ViewSession; 96 | } 97 | 98 | public function stopViewing($name) { 99 | if(!$this->isViewing($name)) return; 100 | $this->viewing[$name]->end(); 101 | unset($this->viewing[$name]); 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /PvP-Stats/src/jacknoordhuis/pvpstats/Main.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | */ 18 | 19 | namespace jacknoordhuis\pvpstats; 20 | 21 | use pocketmine\plugin\PluginBase; 22 | use pocketmine\utils\TextFormat; 23 | use pocketmine\utils\Config; 24 | use pocketmine\IPlayer; 25 | 26 | use jacknoordhuis\pvpstats\providers\ProviderInterface; 27 | use jacknoordhuis\pvpstats\providers\YAMLProvider; 28 | use jacknoordhuis\pvpstats\providers\MYSQLProvider; 29 | 30 | class Main extends PluginBase { 31 | 32 | protected $provider; 33 | 34 | 35 | public function onEnable() { 36 | $this->getCommand("stats")->setExecutor(new StatsCommand($this)); 37 | $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); 38 | $this->saveResource("Settings.yml"); 39 | $this->setProvider(); 40 | $this->getLogger()->info(TextFormat::GREEN . "PvP-Stats v1.3 by CrazedMiner is now Enabled!"); 41 | } 42 | 43 | public function onDisable() { 44 | $this->getLogger()->info(TextFormat::RED . "PvP Stats v1.3 by CrazedMiner is now Disabled!"); 45 | } 46 | 47 | public function setProvider() { 48 | $provider = (new Config($this->getDataFolder() . "Settings.yml"))->getAll()["data-provider"]; 49 | unset($this->provider); 50 | 51 | switch(strtolower($provider)) { 52 | case "yaml": 53 | $provider = new YAMLProvider($this); 54 | break; 55 | case "mysql": 56 | $provider = new MySQLProvider($this); 57 | break; 58 | } 59 | 60 | if(!isset($this->provider) or !($this->provider instanceof ProviderInterface)) { 61 | $this->provider = $provider; 62 | }else { 63 | $this->getLogger()->critical("Data Provider error!"); 64 | $this->getServer()->getPluginManager()->disablePlugin($this); 65 | } 66 | } 67 | 68 | public function getProvider() { 69 | return $this->provider; 70 | } 71 | 72 | public function getPlayer(IPlayer $player) { 73 | return $this->provider->getPlayer($player); 74 | } 75 | 76 | public function getData($player) { 77 | return $this->provider->getData($player); 78 | } 79 | 80 | public function playerExists(IPlayer $player) { 81 | return $this->provider->playerExists($player); 82 | } 83 | 84 | public function addPlayer(IPlayer $player) { 85 | return $this->provider->addPlayer($player); 86 | } 87 | 88 | public function removePlayer(IPlayer $player) { 89 | return $this->provider->removePlayer($player); 90 | } 91 | 92 | public function updatePlayer(IPlayer $player, $type) { 93 | return $this->provider->updatePlayer($player, $type); 94 | } 95 | 96 | public function translateColors($message){ 97 | $symbol = (new Config($this->getDataFolder() . "Settings.yml"))->getAll()["color-symbol"]; 98 | 99 | $message = str_replace($symbol."0", TextFormat::BLACK, $message); 100 | $message = str_replace($symbol."1", TextFormat::DARK_BLUE, $message); 101 | $message = str_replace($symbol."2", TextFormat::DARK_GREEN, $message); 102 | $message = str_replace($symbol."3", TextFormat::DARK_AQUA, $message); 103 | $message = str_replace($symbol."4", TextFormat::DARK_RED, $message); 104 | $message = str_replace($symbol."5", TextFormat::DARK_PURPLE, $message); 105 | $message = str_replace($symbol."6", TextFormat::GOLD, $message); 106 | $message = str_replace($symbol."7", TextFormat::GRAY, $message); 107 | $message = str_replace($symbol."8", TextFormat::DARK_GRAY, $message); 108 | $message = str_replace($symbol."9", TextFormat::BLUE, $message); 109 | $message = str_replace($symbol."a", TextFormat::GREEN, $message); 110 | $message = str_replace($symbol."b", TextFormat::AQUA, $message); 111 | $message = str_replace($symbol."c", TextFormat::RED, $message); 112 | $message = str_replace($symbol."d", TextFormat::LIGHT_PURPLE, $message); 113 | $message = str_replace($symbol."e", TextFormat::YELLOW, $message); 114 | $message = str_replace($symbol."f", TextFormat::WHITE, $message); 115 | 116 | $message = str_replace($symbol."k", TextFormat::OBFUSCATED, $message); 117 | $message = str_replace($symbol."l", TextFormat::BOLD, $message); 118 | $message = str_replace($symbol."m", TextFormat::STRIKETHROUGH, $message); 119 | $message = str_replace($symbol."n", TextFormat::UNDERLINE, $message); 120 | $message = str_replace($symbol."o", TextFormat::ITALIC, $message); 121 | $message = str_replace($symbol."r", TextFormat::RESET, $message); 122 | 123 | return $message; 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/dummy/DummyManager.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 33 | $this->path = $plugin->getDataFolder() . DIRECTORY_SEPARATOR . "Dummys" . DIRECTORY_SEPARATOR; 34 | $this->checkDummys(); 35 | } 36 | 37 | public function checkDummys() { 38 | if(!is_dir($this->path)) { 39 | @mkdir($this->path); 40 | $this->plugin->saveResource("Dummys" . DIRECTORY_SEPARATOR . "Default.yml"); 41 | } 42 | if(!is_dir($this->path . "data" . DIRECTORY_SEPARATOR)) @mkdir($this->path . "data" . DIRECTORY_SEPARATOR); 43 | 44 | foreach(scandir($this->path) as $dummy) { 45 | $parts = explode(".", $dummy); 46 | if(isset($parts[1]) and $parts[1] === "yml") { 47 | $data = (new Config($this->path . $dummy, Config::YAML))->getAll(); 48 | if(!$this->isSpawned($data["name"])) { 49 | $this->spawn($data["name"], $data["description"], $data["level"], Main::parsePos($data["pos"]), $data["yaw"], $data["pitch"], Main::parseItem($data["hand-item"]), Main::parseArmor($data["armor"]), (bool) $data["look"], (bool) $data["knockback"], $data["kits"], $data["commands"]); 50 | } else { 51 | continue; 52 | } 53 | } else { 54 | continue; 55 | } 56 | } 57 | } 58 | 59 | public function spawn($name, $description, $level, Vector3 $pos, $yaw, $pitch, Item $handItem, array $armor, $look = true, $knockback = false, array $kits = [], array $commands = []) { 60 | $nbt = new CompoundTag; 61 | 62 | $nbt->Pos = new EnumTag("Pos", [ 63 | new DoubleTag("", $pos->x), 64 | new DoubleTag("", $pos->y), 65 | new DoubleTag("", $pos->z) 66 | ]); 67 | 68 | $nbt->Motion = new EnumTag("Motion", [ 69 | new DoubleTag("", 0), 70 | new DoubleTag("", 0), 71 | new DoubleTag("", 0) 72 | ]); 73 | 74 | $nbt->Rotation = new EnumTag("Rotation", [ 75 | new FloatTag("", $yaw), 76 | new FloatTag("", $pitch) 77 | ]); 78 | 79 | $nbt->Health = new ShortTag("Health", 1); 80 | 81 | $nbt->DummyData = new CompoundTag("DummyData", [ 82 | "Name" => new StringTag("Name", $name), 83 | "Description" => new StringTag("Description", $description), 84 | "Kits" => new EnumTag("Kits", Main::array2StringTag($kits)), 85 | "Commands" => new EnumTag("Commands", Main::array2StringTag($commands)), 86 | "Look" => new ByteTag("Look", ($look ? 1 : 0)), 87 | "Knockback" => new ByteTag("Knockback", ($knockback ? 1 : 0)) 88 | ]); 89 | 90 | if(($level = $this->plugin->getServer()->getLevelByName($level)) instanceof Level) { 91 | $dummy = Entity::createEntity("HumanDummy", $level->getChunk($pos->x >> 4, $pos->z >> 4), $nbt); 92 | if($dummy instanceof HumanDummy) { 93 | $inv = $dummy->getInventory(); 94 | $inv->setItemInHand($handItem); 95 | $inv->setHelmet($armor[0]); 96 | $inv->setChestplate($armor[1]); 97 | $inv->setLeggings($armor[2]); 98 | $inv->setBoots($armor[3]); 99 | $dummy->spawnToAll(); 100 | $this->writeSpawned($name); 101 | } else { 102 | $dummy->kill(); 103 | } 104 | } else { 105 | return; 106 | } 107 | } 108 | 109 | public function writeSpawned($name) { 110 | $file = fopen($this->path . "data" . DIRECTORY_SEPARATOR . Main::removeColors($name) . ".npc", "w"); 111 | fwrite($file, "name: " . Main::removeColors($name) . "\n\r\n"); 112 | fclose($file); 113 | } 114 | 115 | public function isSpawned($name) { 116 | return is_file($this->path . "data" . DIRECTORY_SEPARATOR . Main::removeColors($name) . ".npc"); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /InventoryClear/src/jacknoordhuis/inventoryclear/EventListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 28 | $plugin->getServer()->getPluginManager()->registerEvents($this, $plugin); 29 | } 30 | 31 | public function onJoin(PlayerJoinEvent $event) { 32 | $player = $event->getPlayer(); 33 | if($this->plugin->settings["events"]["join"]) { 34 | $this->plugin->clearInventory($player); 35 | } 36 | } 37 | 38 | public function onArmorChange(EntityArmorChangeEvent $event) { 39 | if(($player = $event->getEntity()) instanceof Player) { 40 | if($this->plugin->isViewing($player->getName())) { 41 | $event->setCancelled(true); 42 | $player->sendMessage(TF::RED . "You can't change you armor while viewing a players inventory!"); 43 | } 44 | } 45 | } 46 | 47 | public function onDrop(PlayerDropItemEvent $event) { 48 | $player = $event->getPlayer(); 49 | if($this->plugin->isViewing($player->getName())) { 50 | $event->setCancelled(true); 51 | $player->sendMessage(TF::RED . "You can't drop items while viewing a players inventory!"); 52 | } 53 | } 54 | 55 | public function onItemPickup(InventoryPickupItemEvent $event) { 56 | if(($player = $event->getInventory()->getHolder()) instanceof Player) { 57 | if($this->plugin->isViewing($player->getName())) { 58 | $event->setCancelled(true); 59 | $player->sendMessage(TF::RED . "You can't pick up items while viewing a players inventory!"); 60 | } 61 | } 62 | } 63 | 64 | public function onArrowPickup(InventoryPickupArrowEvent $event) { 65 | if(($player = $event->getInventory()->getHolder()) instanceof Player) { 66 | if($this->plugin->isViewing($player->getName())) { 67 | $event->setCancelled(true); 68 | $player->sendMessage(TF::RED . "You can't pick up arrows while viewing a players inventory!"); 69 | } 70 | } 71 | } 72 | 73 | public function onBlockPlace(BlockPlaceEvent $event) { 74 | $player = $event->getPlayer(); 75 | if($this->plugin->isViewing($player->getName())) { 76 | $event->setCancelled(true); 77 | $player->sendMessage(TF::RED . "You can't place blocks while viewing a players inventory!"); 78 | } 79 | } 80 | 81 | public function onBreak(BlockBreakEvent $event) { 82 | $player = $event->getPlayer(); 83 | if($this->plugin->isViewing($player->getName())) { 84 | $event->setCancelled(true); 85 | $player->sendMessage(TF::RED . "You can't break blocks while viewing a players inventory!"); 86 | } 87 | } 88 | 89 | public function onInteract(PlayerInteractEvent $event) { 90 | $player = $event->getPlayer(); 91 | if($this->plugin->isViewing($player->getName())) { 92 | if($event->getBlock()->getId() === Block::CHEST or $event->getBlock()->getId() === Block::TRAPPED_CHEST) { 93 | $event->setCancelled(true); 94 | $player->sendMessage(TF::RED . "You can't use chest's while viewing a players inventory!"); 95 | } 96 | } 97 | } 98 | 99 | // public function onInventoryClose(InventoryCloseEvent $event) { 100 | // $player = $event->getPlayer(); 101 | // if(isset($this->plugin->viewing[$player->getName()])) { 102 | // $this->plugin->viewing[$player->getName()]->end(); 103 | // unset($this->plugin->viewing[$player->getName()]); 104 | // } 105 | // return; 106 | // } 107 | 108 | public function onDeath(PlayerDeathEvent $event) { 109 | if($this->plugin->settings["events"]["death"]) { 110 | $event->setDrops([]); 111 | } 112 | } 113 | 114 | public function onQuit(PlayerQuitEvent $event) { 115 | $player = $event->getPlayer(); 116 | if($this->plugin->settings["events"]["leave"]) { 117 | $this->plugin->clearInventory($player); 118 | } 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /AntiHacks/src/jacknoordhuis/antihacks/Main.php: -------------------------------------------------------------------------------- 1 | loadConfigs(); 33 | $this->setListener(); 34 | $this->getLogger()->info(self::applyColor("&eAntiHacks &b" . self::VERSION_STRING . " &ahas been enabled!")); 35 | } 36 | 37 | /** 38 | * Save and load configs 39 | */ 40 | public function loadConfigs() { 41 | $this->saveResource("Settings.yml"); 42 | $this->settings = new Config($this->getDataFolder() . "Settings.yml", Config::YAML); 43 | } 44 | 45 | /** 46 | * Set the event listener 47 | * 48 | * @return null 49 | */ 50 | public function setListener() { 51 | if(!$this->listener instanceof EventListener) { 52 | $this->listener = new EventListener($this); 53 | } 54 | return; 55 | } 56 | 57 | /** 58 | * Returns the event listener 59 | * 60 | * @return EventListener|null 61 | */ 62 | public function getListener() { 63 | return $this->listener; 64 | } 65 | 66 | /** 67 | * Returns an array of the settings data 68 | * 69 | * @return array 70 | */ 71 | public function getSettings() { 72 | return $this->settings->getAll(); 73 | } 74 | 75 | /** 76 | * Updates a players jump tag 77 | * 78 | * @param string|Player $player 79 | */ 80 | public function addTag($player) { 81 | if($player instanceof Player) { 82 | $player = $player->getName(); 83 | } 84 | 85 | $name = strtolower($player); 86 | if(isset($this->tags[$name])) { 87 | $this->tags[$name]++; 88 | } else { 89 | $this->tags[$name] = 1; 90 | } 91 | } 92 | 93 | /** 94 | * Checks a players jump tag to see if they should be kicked 95 | * 96 | * @param string|Player $player 97 | * @return bool 98 | */ 99 | public function checkTag($player) { 100 | if($player instanceof Player) { 101 | $player = $player->getName(); 102 | } 103 | 104 | $name = strtolower($player); 105 | if(isset($this->tags[$name])) { 106 | if($this->tags[$player] >= $this->getSettings()["jump-tag-threshold"]) { 107 | return true; 108 | } 109 | } 110 | return false; 111 | } 112 | 113 | /** 114 | * Removes a players jump tag 115 | * 116 | * @param string|Player $player 117 | */ 118 | public function removeTag($player) { 119 | if($player instanceof Player) { 120 | $player = $player->getName(); 121 | } 122 | 123 | $name = strtolower($player); 124 | if(isset($this->tags[$name])) { 125 | unset($this->tags[$name]); 126 | } 127 | } 128 | 129 | /** 130 | * Applys Minecraft color codes to a string using a different symbol 131 | * 132 | * @param string $string 133 | * @param string $symbol 134 | * 135 | * @return string 136 | */ 137 | public static function applyColor($string, $symbol = "&") { 138 | $string = str_replace($symbol."0", TF::BLACK, $string); 139 | $string = str_replace($symbol."1", TF::DARK_BLUE, $string); 140 | $string = str_replace($symbol."2", TF::DARK_GREEN, $string); 141 | $string = str_replace($symbol."3", TF::DARK_AQUA, $string); 142 | $string = str_replace($symbol."4", TF::DARK_RED, $string); 143 | $string = str_replace($symbol."5", TF::DARK_PURPLE, $string); 144 | $string = str_replace($symbol."6", TF::GOLD, $string); 145 | $string = str_replace($symbol."7", TF::GRAY, $string); 146 | $string = str_replace($symbol."8", TF::DARK_GRAY, $string); 147 | $string = str_replace($symbol."9", TF::BLUE, $string); 148 | $string = str_replace($symbol."a", TF::GREEN, $string); 149 | $string = str_replace($symbol."b", TF::AQUA, $string); 150 | $string = str_replace($symbol."c", TF::RED, $string); 151 | $string = str_replace($symbol."d", TF::LIGHT_PURPLE, $string); 152 | $string = str_replace($symbol."e", TF::YELLOW, $string); 153 | $string = str_replace($symbol."f", TF::WHITE, $string); 154 | 155 | $string = str_replace($symbol."k", TF::OBFUSCATED, $string); 156 | $string = str_replace($symbol."l", TF::BOLD, $string); 157 | $string = str_replace($symbol."m", TF::STRIKETHROUGH, $string); 158 | $string = str_replace($symbol."n", TF::UNDERLINE, $string); 159 | $string = str_replace($symbol."o", TF::ITALIC, $string); 160 | $string = str_replace($symbol."r", TF::RESET, $string); 161 | 162 | return $string; 163 | } 164 | 165 | } -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/entity/HumanDummy.php: -------------------------------------------------------------------------------- 1 | customName = $name; 34 | $this->setNameTag(Main::translateColors(Main::centerString($this->customName, $this->customDescription) . "\n" . Main::centerString($this->customDescription, $this->customName))); 35 | } 36 | 37 | public function setCustomDescription($string) { 38 | $this->customDescription = $string; 39 | $this->setNameTag(Main::translateColors(Main::centerString($this->customName, $this->customDescription) . "\n" . Main::centerString($this->customDescription, $this->customName))); 40 | } 41 | 42 | public function addKit($string) { 43 | $this->kits[] = $string; 44 | } 45 | 46 | public function addCommand($string) { 47 | $this->commands[] = $string; 48 | } 49 | 50 | public function setMove($value = true) { 51 | $this->move = $value; 52 | } 53 | 54 | public function setKnockback($value = true) { 55 | $this->kockback = $value; 56 | } 57 | 58 | public function spawnTo(Player $player) { 59 | if($player !== $this and ! isset($this->hasSpawned[$player->getLoaderId()])) { 60 | $this->hasSpawned[$player->getLoaderId()] = $player; 61 | 62 | $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), "", $player->getSkinName(), $player->getSkinData(), [$player]); 63 | 64 | $pk = new AddPlayerPacket(); 65 | $pk->uuid = $this->getUniqueId(); 66 | $pk->username = $this->getNameTag(); 67 | $pk->eid = $this->getId(); 68 | $pk->x = $this->x; 69 | $pk->y = $this->y; 70 | $pk->z = $this->z; 71 | $pk->speedX = 0; 72 | $pk->speedY = 0; 73 | $pk->speedZ = 0; 74 | $pk->yaw = $this->yaw; 75 | $pk->pitch = $this->pitch; 76 | $pk->item = $this->getInventory()->getItemInHand(); 77 | $pk->metadata = $this->dataProperties; 78 | $player->dataPacket($pk); 79 | 80 | $this->inventory->sendArmorContents($player); 81 | } 82 | } 83 | 84 | public function saveNBT() { 85 | parent::saveNBT(); 86 | $this->namedtag->DummyData = new Compound("DummyData", [ 87 | "Name" => new StringTag("Name", $this->customName), 88 | "Description" => new StringTag("Description", $this->customDescription), 89 | "Kits" => new EnumTag("Kits", Main::array2StringTag($this->kits)), 90 | "Commands" => new EnumTag("Commands", Main::array2StringTag($this->commands)), 91 | "Look" => new ByteTag("Look", ($this->move ? 1 : 0)), 92 | "Knockback" => new ByteTag("Knockback", ($this->knockback ? 1 : 0)) 93 | ]); 94 | } 95 | 96 | protected function initEntity() { 97 | parent::initEntity(); 98 | if(isset($this->namedtag->DummyData)) { 99 | if(isset($this->namedtag->DummyData["Name"])) { 100 | $this->setCustomName($this->namedtag->DummyData["Name"]); 101 | } 102 | if(isset($this->namedtag->DummyData["Description"])) { 103 | $this->setCustomDescription($this->namedtag->DummyData["Description"]); 104 | } 105 | if(isset($this->namedtag->DummyData["Kits"])) { 106 | foreach($this->namedtag->DummyData["Kits"]->getValue() as $kit) { 107 | $this->addKit($kit); 108 | } 109 | } 110 | if(isset($this->namedtag->DummyData["Commands"])) { 111 | foreach($this->namedtag->DummyData["Commands"]->getValue() as $cmd) { 112 | $this->addCommand($cmd); 113 | } 114 | } 115 | if(isset($this->namedtag->DummyData["Look"])) { 116 | $this->setMove((bool) $this->namedtag->DummyData["Look"]); 117 | } 118 | if(isset($this->namedtag->DummyData["Knockback"])) { 119 | $this->setKnockback((bool) $this->namedtag->DummyData["Knockback"]); 120 | } 121 | } else { 122 | $this->kill(); 123 | } 124 | $this->setNameTag(Main::translateColors(Main::centerString($this->customName, $this->customDescription) . "\n" . Main::centerString($this->customDescription, $this->customName))); 125 | } 126 | 127 | public function look(Player $player) { 128 | $x = $this->x - $player->x; 129 | $y = $this->y - $player->y; 130 | $z = $this->z - $player->z; 131 | $yaw = asin($x / sqrt($x * $x + $z * $z)) / 3.14 * 180; 132 | $pitch = round(asin($y / sqrt($x * $x + $z * $z + $y * $y)) / 3.14 * 180); 133 | if($z > 0) $yaw = -$yaw + 180; 134 | 135 | $pk = new MovePlayerPacket(); 136 | $pk->eid = $this->id; 137 | $pk->x = $this->x; 138 | $pk->y = $this->y; 139 | $pk->z = $this->z; 140 | $pk->bodyYaw = $yaw; 141 | $pk->pitch = $pitch; 142 | $pk->yaw = $yaw; 143 | $pk->mode = 0; 144 | $player->dataPacket($pk); 145 | } 146 | 147 | } 148 | -------------------------------------------------------------------------------- /HealthStatus/src/jacknoordhuis/healthstatus/Main.php: -------------------------------------------------------------------------------- 1 | saveDefaultConfig(); 42 | $this->registerEvents(); 43 | $this->getLogger()->info(TextFormat::GREEN . "HealthStatus Beta By CrazedMiner Enabled!"); 44 | } 45 | 46 | public function onDisable() { 47 | $this->getLogger()->info(TextFormat::GREEN . "HealthStatus Beta By CrazedMiner Disabled!"); 48 | } 49 | 50 | public function registerEvents() { 51 | $this->getServer()->getPluginManager()->registerEvents($this, $this); 52 | if(is_dir($this->getServer()->getPluginPath() . "PureChat")){ 53 | $this->getServer()->getPluginManager()->registerEvents(new GroupChange($this), $this); 54 | } 55 | elseif(is_dir($this->getServer()->getPluginPath() . "EssentialsPE")) { 56 | $this->getServer()->getPluginManager()->registerEvents(new NickChange($this), $this); 57 | } 58 | } 59 | 60 | public function translateColors($symbol, $message){ 61 | 62 | $message = str_replace($symbol."0", TextFormat::BLACK, $message); 63 | $message = str_replace($symbol."1", TextFormat::DARK_BLUE, $message); 64 | $message = str_replace($symbol."2", TextFormat::DARK_GREEN, $message); 65 | $message = str_replace($symbol."3", TextFormat::DARK_AQUA, $message); 66 | $message = str_replace($symbol."4", TextFormat::DARK_RED, $message); 67 | $message = str_replace($symbol."5", TextFormat::DARK_PURPLE, $message); 68 | $message = str_replace($symbol."6", TextFormat::GOLD, $message); 69 | $message = str_replace($symbol."7", TextFormat::GRAY, $message); 70 | $message = str_replace($symbol."8", TextFormat::DARK_GRAY, $message); 71 | $message = str_replace($symbol."9", TextFormat::BLUE, $message); 72 | $message = str_replace($symbol."a", TextFormat::GREEN, $message); 73 | $message = str_replace($symbol."b", TextFormat::AQUA, $message); 74 | $message = str_replace($symbol."c", TextFormat::RED, $message); 75 | $message = str_replace($symbol."d", TextFormat::LIGHT_PURPLE, $message); 76 | $message = str_replace($symbol."e", TextFormat::YELLOW, $message); 77 | $message = str_replace($symbol."f", TextFormat::WHITE, $message); 78 | 79 | $message = str_replace($symbol."k", TextFormat::OBFUSCATED, $message); 80 | $message = str_replace($symbol."l", TextFormat::BOLD, $message); 81 | $message = str_replace($symbol."m", TextFormat::STRIKETHROUGH, $message); 82 | $message = str_replace($symbol."n", TextFormat::UNDERLINE, $message); 83 | $message = str_replace($symbol."o", TextFormat::ITALIC, $message); 84 | $message = str_replace($symbol."r", TextFormat::RESET, $message); 85 | 86 | return $message; 87 | } 88 | 89 | public function onJoin(PlayerJoinEvent $event) { 90 | $player = $event->getPlayer(); 91 | $config = $this->getConfig()->getAll(); 92 | if($config["Nametag"]["Enabled"] === true) { 93 | $this->getServer()->getScheduler()->scheduleDelayedTask(new Task($this, $player), 1); 94 | } 95 | } 96 | 97 | public function onRespawn(PlayerRespawnEvent $event) { 98 | $player = $event->getPlayer(); 99 | $config = $this->getConfig()->getAll(); 100 | if($config["Nametag"]["Enabled"] === true) { 101 | $this->getServer()->getScheduler()->scheduleDelayedTask(new Task($this, $player), 1); 102 | } 103 | } 104 | 105 | public function onHurt(EntityDamageEvent $event) { 106 | $entity = $event->getEntity(); 107 | $config = $this->getConfig()->getAll(); 108 | if($config["Nametag"]["Enabled"] === true) { 109 | $this->getServer()->getScheduler()->scheduleDelayedTask(new Task($this, $entity), 1); 110 | } 111 | } 112 | 113 | public function onHeal(EntityRegainHealthEvent $event) { 114 | $entity = $event->getEntity(); 115 | $config = $this->getConfig()->getAll(); 116 | if($config["Nametag"]["Enabled"] === true) { 117 | $this->getServer()->getScheduler()->scheduleDelayedTask(new Task($this, $entity), 1); 118 | } 119 | } 120 | 121 | public function setHealthNametag(Player $player) { 122 | $config = $this->getConfig()->getAll(); 123 | if($player instanceof Player) { 124 | $statusformat = ($config["Nametag"]["Format"]); 125 | if(is_dir($this->getServer()->getPluginPath() . "PureChat")){ 126 | $name = $this->getServer()->getPluginManager()->getPlugin("PureChat")->getNametag($player, ($player->getLevel()->getName())); 127 | $player->setNameTag($this->translateColors("&", ($name . "\n" . (str_replace("@health", $this->getHealthStatus($player), $statusformat))))); 128 | } 129 | elseif(is_dir($this->getServer()->getPluginPath() . "EssentialsPE")) { 130 | $nick = ($this->getServer()->getPluginManager()->getPlugin("EssentialsPE")->getNewNick($player)); 131 | $name = ($this->translateColors("&", ($nick . "\n" . (str_replace("@health", $this->getHealthStatus($player), $statusformat))))); 132 | $this->getServer()->getPluginManager()->getPlugin("EssentialsPE")->setNick($name); 133 | } 134 | else { 135 | $name = $player->getName(); 136 | $player->setNameTag($this->translateColors("&", ($name . "\n" . (str_replace("@health", $this->getHealthStatus($player), $statusformat))))); 137 | } 138 | } 139 | } 140 | 141 | public function getHealthStatus(Player $player) { 142 | $config = $this->getConfig()->getAll(); 143 | $symbol = $config["Symbol"]; 144 | $currenthealth = ($player->getHealth()); 145 | $usedhealth = (($player->getMaxHealth()) - ($player->getHealth())); 146 | $healthstatus = (($config["Health-Color"]) . (str_repeat($symbol, $currenthealth / 2)) . TextFormat::RESET . ($config["Used-Health-Color"]) . (str_repeat($symbol, $usedhealth / 2))); 147 | return $healthstatus; 148 | } 149 | 150 | } 151 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /DummyKits/src/jacknoordhuis/dummykits/Main.php: -------------------------------------------------------------------------------- 1 | registerEntities(); 31 | $this->setKitManager(); 32 | $this->setDummyManager(); 33 | $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); 34 | } 35 | 36 | public function registerCommands() { 37 | $this->getServer()->getCommandMap()->registerAll("dk", [ 38 | new AddDummy($this), 39 | new EditDummy($this), 40 | ]); 41 | } 42 | 43 | public static function getInstance() { 44 | return self::$instance; 45 | } 46 | 47 | public function registerEntities() { 48 | Entity::registerEntity(HumanDummy::class, true); 49 | } 50 | 51 | public function setKitManager() { 52 | if(isset($this->kitManager) and $this->kitManager instanceof KitManager) return; 53 | $this->kitManager = new KitManager($this); 54 | } 55 | 56 | public function setDummyManager() { 57 | if(isset($this->dummyManager) and $this->dummyManager instanceof DummyManager) return; 58 | $this->dummyManager = new DummyManager($this); 59 | } 60 | 61 | public function setSkinManager() { 62 | if(isset($this->skinManager) and $this->skinManager instanceof SkinManager) return; 63 | $this->skinManager = new SkinManager($this); 64 | } 65 | 66 | public static function centerString($string, $around) { 67 | return str_pad($string, strlen($around), " ", STR_PAD_BOTH); 68 | } 69 | 70 | public static function translateColors($string, $symbol = "&") { 71 | $string = str_replace($symbol . "0", TF::BLACK, $string); 72 | $string = str_replace($symbol . "1", TF::DARK_BLUE, $string); 73 | $string = str_replace($symbol . "2", TF::DARK_GREEN, $string); 74 | $string = str_replace($symbol . "3", TF::DARK_AQUA, $string); 75 | $string = str_replace($symbol . "4", TF::DARK_RED, $string); 76 | $string = str_replace($symbol . "5", TF::DARK_PURPLE, $string); 77 | $string = str_replace($symbol . "6", TF::GOLD, $string); 78 | $string = str_replace($symbol . "7", TF::GRAY, $string); 79 | $string = str_replace($symbol . "8", TF::DARK_GRAY, $string); 80 | $string = str_replace($symbol . "9", TF::BLUE, $string); 81 | $string = str_replace($symbol . "a", TF::GREEN, $string); 82 | $string = str_replace($symbol . "b", TF::AQUA, $string); 83 | $string = str_replace($symbol . "c", TF::RED, $string); 84 | $string = str_replace($symbol . "d", TF::LIGHT_PURPLE, $string); 85 | $string = str_replace($symbol . "e", TF::YELLOW, $string); 86 | $string = str_replace($symbol . "f", TF::WHITE, $string); 87 | 88 | $string = str_replace($symbol . "k", TF::OBFUSCATED, $string); 89 | $string = str_replace($symbol . "l", TF::BOLD, $string); 90 | $string = str_replace($symbol . "m", TF::STRIKETHROUGH, $string); 91 | $string = str_replace($symbol . "n", TF::UNDERLINE, $string); 92 | $string = str_replace($symbol . "o", TF::ITALIC, $string); 93 | $string = str_replace($symbol . "r", TF::RESET, $string); 94 | 95 | return $string; 96 | } 97 | 98 | public static function removeColors($string, $symbol = "&") { 99 | $string = str_replace($symbol . "0", "", $string); 100 | $string = str_replace($symbol . "1", "", $string); 101 | $string = str_replace($symbol . "2", "", $string); 102 | $string = str_replace($symbol . "3", "", $string); 103 | $string = str_replace($symbol . "4", "", $string); 104 | $string = str_replace($symbol . "5", "", $string); 105 | $string = str_replace($symbol . "6", "", $string); 106 | $string = str_replace($symbol . "7", "", $string); 107 | $string = str_replace($symbol . "8", "", $string); 108 | $string = str_replace($symbol . "9", "", $string); 109 | $string = str_replace($symbol . "a", "", $string); 110 | $string = str_replace($symbol . "b", "", $string); 111 | $string = str_replace($symbol . "c", "", $string); 112 | $string = str_replace($symbol . "d", "", $string); 113 | $string = str_replace($symbol . "e", "", $string); 114 | $string = str_replace($symbol . "f", "", $string); 115 | 116 | $string = str_replace($symbol . "k", "", $string); 117 | $string = str_replace($symbol . "l", "", $string); 118 | $string = str_replace($symbol . "m", "", $string); 119 | $string = str_replace($symbol . "n", "", $string); 120 | $string = str_replace($symbol . "o", "", $string); 121 | $string = str_replace($symbol . "r", "", $string); 122 | 123 | $string = TF::clean($string); 124 | 125 | return $string; 126 | } 127 | 128 | public static function parseArmor($string) { 129 | $temp = explode(",", str_replace(" ", "", $string)); 130 | if(isset($temp[3])) { 131 | return [Item::get($temp[0]), Item::get($temp[1]), Item::get($temp[2]), Item::get($temp[3])]; 132 | } else { 133 | return []; 134 | } 135 | } 136 | 137 | public static function parseItems(array $strings) { 138 | $items = []; 139 | foreach($strings as $string) { 140 | $items[] = self::parseItem($string); 141 | } 142 | return $items; 143 | } 144 | 145 | public static function parseEffects(array $strings) { 146 | $effects = []; 147 | foreach($strings as $string) { 148 | $temp = explode(",", str_replace(" ", "", $string)); 149 | if(!isset($temp[3])) { 150 | $effects[] = Effect::getEffectByName($temp[0])->setAmplifier($temp[1])->setDuration(20 * $temp[2]); 151 | } else { 152 | continue; 153 | } 154 | } 155 | return $effects; 156 | } 157 | 158 | public static function parsePos($string) { 159 | $temp = explode(",", str_replace(" ", "", $string)); 160 | if(isset($temp[2])) { 161 | return new Vector3($temp[0], $temp[1], $temp[2]); 162 | } else { 163 | return; 164 | } 165 | } 166 | 167 | public static function parseItem($string) { 168 | $temp = explode(",", str_replace(" ", "", $string)); 169 | if(isset($temp[2])) { 170 | return Item::get($temp[0], $temp[1], $temp[2]); 171 | } else { 172 | return; 173 | } 174 | } 175 | 176 | public static function array2StringTag(array $array) { 177 | $temp = []; 178 | foreach($array as $key => $data) { 179 | $temp[] = new StringTag($key, $data); 180 | } 181 | return $temp; 182 | } 183 | 184 | } 185 | --------------------------------------------------------------------------------