├── .gitignore ├── .poggit.yml ├── .travis.yml ├── BroomArrow ├── plugin.yml ├── resources │ └── config.yml └── src │ └── BroomArrow │ ├── BroomArrow.php │ ├── BroomSession.php │ ├── Database.php │ └── InventoryBroom.php ├── BulkCommands ├── bin │ ├── BulkCommands.phar │ └── README.md ├── plugin.yml └── src │ └── pemapmodder │ └── bulkcommands │ ├── BulkCommandSession.php │ └── BulkCommands.php ├── CONTRIBUTING.md ├── ChatChannels ├── bin │ ├── ChatChannels.phar │ └── README.md ├── plugin.yml ├── resources │ └── config.yml └── src │ └── chatchannels │ ├── CallbackPrefix.php │ ├── Channel.php │ ├── ChannelManager.php │ ├── ChannelSubscriber.php │ ├── ChatChannels.php │ ├── Configuration.php │ ├── ConsoleSubscriber.php │ ├── PlayerSubscriber.php │ ├── Prefix.php │ ├── PrefixAPI.php │ ├── PriorityPrefixEnum.php │ ├── SessionControl.php │ └── cmds │ ├── ChatChannelsCommand.php │ ├── ForceRankCommand.php │ └── JoinCommand.php ├── ChatLineBreaker ├── plugin.yml ├── resources │ └── config.yml └── src │ └── pemapmodder │ └── clb │ ├── CallbackTask.php │ ├── Database.php │ ├── Lang.php │ ├── Main.php │ ├── Old.php │ └── WriteFileTask.php ├── CommandSelectors ├── bin │ ├── CommandSelectors_dev_build.phar │ ├── README.md │ └── ignoreme │ │ ├── .gitignore │ │ ├── compile.cmd │ │ └── compile.php ├── plugin.yml └── src │ └── pemapmodder │ └── cmdsel │ ├── CmdSel.php │ ├── event │ ├── PlayerCommandPreprocessEvent_sub.php │ ├── RemoteServerCommandEvent_sub.php │ └── ServerCommandEvent_sub.php │ └── selector │ ├── AllRecursiveSelector.php │ ├── NearestSelector.php │ ├── RandomSelector.php │ ├── RecursiveSelector.php │ ├── Selector.php │ ├── UsernameSelector.php │ └── WorldSelector.php ├── ConsolePush ├── README.md ├── bin │ ├── ConsolePush.phar │ └── README.md ├── plugin.yml └── src │ └── PEMapModder │ └── ConsolePush │ └── ConsolePush.php ├── CustomAreas ├── bin │ ├── CustomAreas.phar │ └── README.md ├── plugin.yml ├── resources │ └── config.yml └── src │ └── customareas │ ├── CustomAreas.php │ ├── area │ └── Area.php │ ├── db │ ├── Database.php │ ├── DummyDatabase.php │ └── LocalDatabase.php │ ├── pocketmine │ ├── CacheCleanTask.php │ └── EventListener.php │ └── shape │ ├── Cached.php │ ├── CircularShape.php │ ├── IrregularShape.php │ ├── Line.php │ ├── RectangularShape.php │ └── Shape.php ├── DeFactoGui ├── .idea │ └── php.xml ├── plugin.yml └── src │ └── defactogui │ ├── Button.php │ ├── DeFactoGui.php │ ├── EventListener.php │ └── InteractiveInventory.php ├── DynamicSignTechnology ├── README.md ├── plugin.yml ├── resources │ ├── config.yml │ └── ids.json └── src │ └── pemapmodder │ └── dst │ ├── Main.php │ └── TickUpdater.php ├── FastJoin └── src │ └── pemapmodder │ └── fastjoin │ ├── FastJoin.php │ ├── FlatProvider.php │ └── TeleportTask.php ├── IPLogger ├── bin │ ├── IPLogger.phar │ └── README.md ├── icon │ ├── IP.jpg │ ├── Icon_2.png │ └── pad.jpg ├── plugin.yml ├── resources │ └── config.yml └── src │ └── pemapmodder │ └── iplogger │ └── Main.php ├── IRCBridge ├── bin │ ├── IRCBridge.phar │ └── README.md ├── plugin.yml ├── resoruces │ └── config.yml └── src │ └── pemapmodder │ └── ircbridge │ ├── IRCBridge.php │ ├── TickTask.php │ └── bridge │ ├── Buffer.php │ ├── ClientManager.php │ ├── IRCServer.php │ ├── IRCSession.php │ └── protocol │ ├── Command.php │ ├── IRCLine.php │ ├── ModeCommand.php │ ├── NickCommand.php │ ├── PassCommand.php │ ├── QuitCommand.php │ └── UserCommand.php ├── InfoEssentials ├── plugin.yml └── src │ └── pemapmodder │ └── infoess │ └── InfoEss.php ├── LICENSE ├── LagFixer ├── plugin.yml └── src │ └── pemapmodder │ └── lagfixer │ ├── HealthCommand.php │ ├── LagFixer.php │ └── ShowCommand.php ├── MemoryFullRestarter ├── bin │ ├── MemoryFullRestarter.phar │ └── README.md ├── plugin.yml ├── resources │ └── config.yml └── src │ └── memfullrestart │ ├── CheckMemoryTask.php │ └── MemFullRestarter.php ├── Mist ├── plugin.yml └── src │ └── pemapmodder │ └── mist │ ├── Mist.php │ ├── MistPlugin.php │ └── MistySpecter.php ├── NailedKeyboard ├── README.md ├── bin │ ├── NailedKeyboard.phar │ ├── NailedKeyboard_dev_build.phar │ ├── README.md │ ├── demo-1.png │ ├── demo-2.png │ ├── full-signs-1.png │ ├── full-signs-2.png │ └── signs-left.png ├── plugin.yml └── src │ └── pemapmodder │ └── nailedkeyboard │ ├── Line.php │ ├── NailedKeyboard.php │ └── PlayerCommandPreprocessEvent_sub.php ├── NameCorrector ├── README.md ├── bin │ ├── NameCorrector.phar │ └── README.md ├── plugin.yml ├── resources │ └── config.yml └── src │ └── PEMapModder │ └── NameCorrector │ ├── NameCorrector.php │ └── Special.php ├── NumericRanks ├── plugin.yml ├── resources │ └── config.yml └── src │ └── NumericRanks │ ├── GeneralListener.php │ ├── NumericRanks.php │ ├── PlayerListener.php │ ├── cmd │ └── NumericRanksCommand.php │ ├── data │ ├── Rank.php │ └── User.php │ └── provider │ ├── MysqlProvider.php │ ├── NumRanksProvider.php │ └── YamlProvider.php ├── PastebinPoster ├── plugin.yml ├── resources │ └── config.yml └── src │ └── pemapmodder │ └── pastebinposter │ ├── Main.php │ └── PostTask.php ├── RARFix ├── bin │ ├── RARFix.phar │ └── README.md ├── plugin.yml └── src │ └── rarfix │ └── RARFix.php ├── README.md ├── RemoteChat ├── README.md ├── plugin.yml ├── resources │ ├── Documentation.md │ └── config.yml └── src │ └── PEMapModder │ └── RemoteChat │ ├── ListenerThread.php │ ├── PullSyncTask.php │ ├── RemoteChat.php │ ├── RemoteChatCommand.php │ └── RequestAsyncTask.php ├── SimpleMacros ├── icon.png ├── plugin.yml └── src │ └── pemapmodder │ └── simplemacros │ ├── Main.php │ └── RecordSession.php ├── Spacefiller ├── bin │ ├── README.md │ └── Spacefiller.phar ├── plugin.yml ├── resources │ └── config.yml └── src │ └── spacefiller │ ├── Rule.php │ └── Spacefiller.php ├── ThirdPersonDiscourager ├── bin │ ├── README.md │ └── ThirdPersonDiscourager.phar ├── plugin.yml ├── resources │ └── config.yml └── src │ └── thirdpersondiscour │ ├── Session.php │ └── ThirdPersonDiscour.php ├── VotifierPE ├── README.md ├── plugin.yml └── src │ ├── phpseclib │ ├── Crypt │ │ ├── AES.php │ │ ├── Base.php │ │ ├── DES.php │ │ ├── Hash.php │ │ ├── RC4.php │ │ ├── RSA.php │ │ ├── Random.php │ │ ├── Rijndael.php │ │ └── TripleDES.php │ ├── File │ │ ├── ASN1.php │ │ └── X509.php │ ├── LICENSE │ └── Math │ │ └── BigInteger.php │ └── votifierpe │ ├── TCPListener.php │ ├── VoteListener.php │ ├── VotifierPE.php │ └── VotifierPEVoteEvent.php ├── WorldEditArt ├── Description + Documentation.md ├── README.md ├── bin │ ├── README.md │ ├── WorldEditArt.phar │ └── WorldEditArt_dev_build.phar ├── plugin.yml ├── plugin_icon.png ├── resources │ └── config.yml └── src │ └── pemapmodder │ └── worldeditart │ ├── WorldEditArt.php │ ├── events │ ├── AnchorChangeEvent.php │ ├── CancellableWorldEditArtEvent.php │ ├── SelectionChangeEvent.php │ ├── WorldEditArtEvent.php │ └── space │ │ ├── SpaceEvent.php │ │ ├── SpaceReplaceEvent.php │ │ └── SpaceSetEvent.php │ ├── tasks │ ├── GarbageCollectionTask.php │ └── UndoTestTask.php │ └── utils │ ├── StringReader.php │ ├── StringWriter.php │ ├── clip │ └── Clip.php │ ├── macro │ ├── Macro format documentation.md │ ├── Macro.php │ ├── MacroOperation.php │ └── MacroOperationTask.php │ ├── provider │ ├── Cache.php │ ├── Cached.php │ ├── DataProvider.php │ ├── clip │ │ ├── BinaryClipboardProvider.php │ │ ├── CachedClipboardProvider.php │ │ ├── ClipboardProvider.php │ │ ├── DummyClipboardProvider.php │ │ └── MysqliClipboardProvider.php │ ├── macro │ │ ├── CachedMacroDataProvider.php │ │ ├── DummyMacroDataProvider.php │ │ ├── LocalNBTMacroDataProvider.php │ │ ├── MacroDataProvider.php │ │ └── MysqliMacroDataProvider.php │ └── player │ │ ├── DummyPlayerDataProvider.php │ │ ├── FilePlayerDataProvider.php │ │ ├── JSONFilePlayerDataProvider.php │ │ ├── MysqliPlayerDataProvider.php │ │ ├── PlayerData.php │ │ ├── PlayerDataProvider.php │ │ ├── SQLPlayerDataProvider.php │ │ ├── SQLite3PlayerDataProvider.php │ │ ├── SelectedTool.php │ │ └── YAMLFilePlayerDataProvider.php │ ├── spaces │ ├── BlockList.php │ ├── BlockPatternParseException.php │ ├── CuboidSpace.php │ ├── CylinderSpace.php │ ├── SelectionExceedWorldException.php │ ├── SingleList.php │ ├── Space.php │ └── SphereSpace.php │ └── subcommand │ ├── Anchor.php │ ├── Copy.php │ ├── Cuboid.php │ ├── Cut.php │ ├── Cylinder.php │ ├── Desel.php │ ├── MacroSubcmd.php │ ├── Paste.php │ ├── PosSubcommand.php │ ├── Replace.php │ ├── SelectedToolSetterSubcommand.php │ ├── Set.php │ ├── Sphere.php │ ├── Subcommand.php │ ├── SubcommandMap.php │ └── Test.php ├── compile.cmd └── compile.php /.gitignore: -------------------------------------------------------------------------------- 1 | # PhpStorm configuration files 2 | .idea/ 3 | # Hex Editor temporary files 4 | *.bak 5 | *.bat 6 | commit-msg.txt 7 | *.lnk 8 | 9 | WorldEditArt/changes.txt 10 | WorldEditArt/commit.php 11 | 12 | /_bin 13 | -------------------------------------------------------------------------------- /.poggit.yml: -------------------------------------------------------------------------------- 1 | --- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/PEMapModder/Small-ZC-Plugins 2 | projects: 3 | BulkCommands: 4 | path: BulkCommands/ 5 | ChatLineBreaker: 6 | path: ChatLineBreaker/ 7 | CommandSelectors: 8 | path: CommandSelectors/ 9 | ConsolePush: 10 | path: ConsolePush/ 11 | DynamicSignTechnology: 12 | path: DynamicSignTechnology/ 13 | IPLogger: 14 | path: IPLogger/ 15 | IRCBridge: 16 | path: IRCBridge/ 17 | InfoEssentials: 18 | path: InfoEssentials/ 19 | LagFixer: 20 | path: LagFixer/ 21 | Mist: 22 | path: Mist/ 23 | NailedKeyboard: 24 | path: NailedKeyboard/ 25 | NameCorrector: 26 | path: NameCorrector/ 27 | NumericRanks: 28 | path: NumericRanks/ 29 | PastebinPoster: 30 | path: PastebinPoster/ 31 | RemoteChat: 32 | path: RemoteChat/ 33 | SimpleMacros: 34 | path: SimpleMacros/ 35 | icon: icon.png 36 | WorldEditArt: 37 | path: WorldEditArt/ 38 | ... 39 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: ["7.0"] 3 | sudo: false 4 | dist: trusty 5 | 6 | install: 7 | - wget -O - https://poggit.pmmp.io/res/travisInstall.sh | bash -s - https://github.com/pmmp/PocketMine-MP/releases/download/1.6.1dev-87/PocketMine-MP_1.6.1dev-87_e51a2725_API-2.1.0.phar 8 | script: 9 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - BulkCommands 10 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - ChatLineBreaker 11 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - CommandSelectors 12 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - ConsolePush 13 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - DynamicSignTechnology 14 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - IPLogger 15 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - IRCBridge 16 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - InfoEssentials 17 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - LagFixer 18 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - Mist 19 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - NailedKeyboard 20 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - NameCorrector 21 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - NumericRanks 22 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - PastebinPoster 23 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - RemoteChat 24 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - SimpleMacros 25 | - wget -O - https://poggit.pmmp.io/res/travisScript.sh | bash -s - WorldEditArt 26 | -------------------------------------------------------------------------------- /BroomArrow/plugin.yml: -------------------------------------------------------------------------------- 1 | name: BroomArrow 2 | version: 1.0.0 3 | api: [1.13.0, 2.0.0] 4 | main: BroomArrow\BroomArrow 5 | author: PEMapModder 6 | -------------------------------------------------------------------------------- /BroomArrow/src/BroomArrow/BroomArrow.php: -------------------------------------------------------------------------------- 1 | getServer()->getPluginManager()->registerEvents($this, $this); 28 | foreach($this->getServer()->getOnlinePlayers() as $player){ 29 | $this->openSession($player); 30 | } 31 | } 32 | 33 | public function onDisable(){ 34 | foreach($this->getServer()->getOnlinePlayers() as $player){ 35 | $this->closeSession($player); 36 | } 37 | } 38 | 39 | public function e_join(PlayerJoinEvent $event){ 40 | $this->openSession($event->getPlayer()); 41 | } 42 | 43 | private function openSession(Player $player){ 44 | $this->sessions[$player->getId()] = new BroomSession($this, $player); 45 | } 46 | 47 | private function closeSession(Player $player){ 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /BroomArrow/src/BroomArrow/BroomSession.php: -------------------------------------------------------------------------------- 1 | main = $main; 32 | $this->player = $player; 33 | } 34 | 35 | public function getMain(){ 36 | return $this->main; 37 | } 38 | 39 | public function getPlayer(){ 40 | return $this->player; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /BroomArrow/src/BroomArrow/Database.php: -------------------------------------------------------------------------------- 1 | - Use %s to represent the content input; Use %% to represent 16 | %; Using %s multiple times is OK. 17 | permission: bulkcommands.cmd 18 | permissions: 19 | bulkcommands: 20 | description: main permission node 21 | default: true 22 | children: 23 | bulkcommands.cmd: 24 | description: Permission to use the command 25 | default: true 26 | bulkcommands.noslash: 27 | description: Permission to enable BulkCommands without starting with a slash. 28 | Giving this permission may make spamming easier. 29 | default: op 30 | bulkcommands.silent: 31 | description: If a player has this permission node on and uses the /bc command, 32 | no messages will be sent to him. However, error messages (not warning messages) 33 | will still be sent. 34 | default: false 35 | ... 36 | -------------------------------------------------------------------------------- /BulkCommands/src/pemapmodder/bulkcommands/BulkCommandSession.php: -------------------------------------------------------------------------------- 1 | format, ...array_fill(0, $this->cnt, $message)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Gudielines for Creating Issues 2 | === 3 | 4 | * Confirm that issues are not to be duplicated before creating one. 5 | * Do not make custom tags except [RepoName]. For other tags, I will add them via [labels](https://github.com/PEMapModder/Small-ZC-Plugins/labels) myself 6 | * Do not make generic titles like "Help", "Question", etc. 7 | * Paste crash dumps in pastebins like http://pastebin.com 8 | * Try to confirm that the issue is related to this plugin. 9 | * If possible, find out the crash dump on http://crash.pocketmine.net 10 | * Only use the issues to report bugs or request features. Support requests should be done on the PocketMine forums plugin release thread or contacting me via PM on PocketMine forums, or finding me (@PEMapModder) on Twitter or asking on freenode IRC channel `#pmplugins`. 11 | * Please provide a professional report for bugs. By "professional", I mean: 12 | * The bug should be **reproducible**. 13 | * The title should be as brief (short and clean but specific) as possible. Details should be provided in the issue body. 14 | * For feature requests, 15 | * The feature must not be duplicated. 16 | * Confirm, if possible, that the feature is possible. 17 | * Do not use the issue conversation as a forum. 18 | * If you offend these rules, your issue may be edited, closed, locked, or even your account may be blocked from interacting with the repositories of @PEMapModder. 19 | * For pull requests, 20 | * Please test your changes, or specify that it is untested if you don't want to or cannot 21 | * Please conform to the [PocketMine contribution guidelines code style](https://github.com/PocketMine/PocketMine-MP/blob/master/CONTRIBUTING.md) 22 | -------------------------------------------------------------------------------- /ChatChannels/bin/ChatChannels.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/ChatChannels/bin/ChatChannels.phar -------------------------------------------------------------------------------- /ChatChannels/bin/README.md: -------------------------------------------------------------------------------- 1 | ChatChannels/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. -------------------------------------------------------------------------------- /ChatChannels/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ChatChannels 3 | authors: 4 | - PEMapModder 5 | - Falk 6 | description: Separate chat in channels 7 | main: chatchannels/ChatChannels 8 | api: 2.0.0 9 | version: INDEV_#002 10 | website: https://github.com/PEMapModder/Small-ZC-Plugins/tree/master/ChatChannels 11 | prefix: ChatChannels 12 | permissions: 13 | chatchannels: 14 | description: Grandparent permission node of ChatChannels. Setting me or some of 15 | my children's permission may lead to problems in joining chat channels, so do 16 | NOT modify me, `chatchannels.channel` or children of `chatchannels.channel`. 17 | default: false 18 | children: 19 | chatchannels.channel: 20 | description: Parent permission node for ChatChannels chat channels. My children 21 | are dynamic; this means, every time a channel is created, I have a new child. 22 | In order for chat channels to work properly, do NOT modify me or my children. 23 | default: false 24 | children: [] 25 | chatchannels.create: 26 | description: Permission to create chat channels. 27 | default: true 28 | chatchannels.forcejoin: 29 | description: Permission to "break in" (join) chat channels without getting 30 | invited or getting the specific permission to join it. 31 | default: op 32 | chatchannels.forcemod: 33 | description: Permission to become a moderator in a chat channel with the command 34 | /forcemod 35 | default: op 36 | chatchannels.forceadmin: 37 | description: Permission to become an admin in a chat channel with the command 38 | /forceadmin 39 | commands: 40 | forcejoin: 41 | usage: /forcejoin 42 | description: Force-join a channel without getting the specific permission to 43 | permission: chatchannels.forcejoin 44 | create: 45 | usage: /create [o|open] 46 | permission: chatchannels.create 47 | ... 48 | -------------------------------------------------------------------------------- /ChatChannels/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | console name: Console 3 | default channel name: server 4 | ... 5 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/CallbackPrefix.php: -------------------------------------------------------------------------------- 1 | callback = $callback; 11 | } 12 | 13 | public function getPrefix(ChannelSubscriber $sender, Channel $channel){ 14 | return call_user_func($this->callback, $sender, $channel); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/Channel.php: -------------------------------------------------------------------------------- 1 | name = $name; 35 | $this->joinPerm = $joinPerm; 36 | $this->modes[$founder->getID()] = [self::MODE_FOUNDER, self::MODE_ADMIN, self::MODE_MOD]; 37 | } 38 | 39 | public function getJoinPermission(){ 40 | return $this->joinPerm; 41 | } 42 | 43 | public function join(ChannelSubscriber $sub){ 44 | if(isset($this->subs[$hash = spl_object_hash($sub)])){ 45 | return "already joined"; // already joined 46 | } 47 | $flags = $this->getFlags($sub->getID()); 48 | if(in_array(self::MODE_BANNED, $flags)){ 49 | return "banned"; 50 | } 51 | $this->subs[$hash] = $sub; 52 | return true; 53 | } 54 | 55 | public function quit(ChannelSubscriber $sub){ 56 | if(!isset($this->subs[$hash = spl_object_hash($sub)])){ 57 | return false; // is not on this channel 58 | } 59 | unset($this->subs[$hash]); 60 | return true; 61 | } 62 | 63 | public function send($message, ChannelSubscriber $source){ 64 | if($source->isMuted()){ 65 | $source->sendMessage("You are muted!", $this); 66 | } 67 | if(in_array(self::MODE_MUTED, $this->getFlags($source->getID()))){ 68 | $source->sendMessage("You are muted on this channel!", $this); 69 | } 70 | $this->broadcast(sprintf("%s<%s> %s", $this->plugin->getPrefixAPI()->getPrefixes($source, $this), $source->getDisplayName(), $message), self::LEVEL_CHAT); 71 | } 72 | 73 | public function broadcast($message, $level){ 74 | foreach($this->subs as $sub){ 75 | if($sub->getSubscribingLevel() <= $level){ 76 | $sub->sendMessage($message, $this); 77 | } 78 | } 79 | } 80 | 81 | public function getFlags($id){ 82 | return isset($this->modes[$id]) ? $this->modes[$id] : []; 83 | } 84 | 85 | public function setFlags($id, array $flags){ 86 | $this->modes[$id] = $flags; 87 | } 88 | 89 | public function __toString(){ 90 | return $this->name; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/ChannelManager.php: -------------------------------------------------------------------------------- 1 | main = $main; 15 | $this->parentPerm = $this->main->getServer()->getPluginManager()->getPermission("chatchannels.channel"); 16 | } 17 | 18 | /** 19 | * @param string $name 20 | * @param ChannelSubscriber $founder 21 | * @param bool $freeJoin 22 | * 23 | * @return bool|Channel 24 | */ 25 | public function addChannel($name, ChannelSubscriber $founder, $freeJoin = false){ 26 | $name = $this->normalize($name); 27 | if(!isset($this->channels[$name])){ 28 | return false; 29 | } 30 | $this->channels[$name] = new Channel($name, $this->addChannelPermission($name, $freeJoin), $founder); 31 | return $this->getChannel($name); 32 | } 33 | 34 | /** 35 | * @param string $name 36 | * @param bool $default 37 | * 38 | * @return Permission 39 | */ 40 | private function addChannelPermission($name, $default){ 41 | $name = $this->normalize($name); 42 | $perm = new Permission("chatchannels.channel.$name", "Allow joining channel '$name'", ($default === true or $default === Permission::DEFAULT_TRUE) ? Permission::DEFAULT_TRUE : Permission::DEFAULT_FALSE); 43 | $this->parentPerm->getChildren()[$perm->getName()] = $perm; 44 | $this->main->getServer()->getPluginManager()->getPermission($perm); 45 | return $perm; 46 | } 47 | 48 | /** 49 | * @return Channel[] 50 | */ 51 | public function getChannels(){ 52 | return $this->channels; 53 | } 54 | 55 | /** 56 | * @param string $name 57 | * 58 | * @return bool|Channel 59 | */ 60 | public function getChannel($name){ 61 | if(isset($this->channels[$name = $this->normalize($name)])){ 62 | return $this->channels[$name]; 63 | } 64 | return true; 65 | } 66 | 67 | /** 68 | * @param string $name 69 | * 70 | * @return string 71 | */ 72 | public function normalize($name){ 73 | return strtolower($name); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/ChannelSubscriber.php: -------------------------------------------------------------------------------- 1 | saveDefaultConfig(); 24 | $this->configuration = new Configuration($this->getConfig()); 25 | $this->console = new ConsoleSubscriber($this, $this->configuration->getConsoleName()); 26 | $this->chanMgr = new ChannelManager($this); 27 | $this->chanMgr->addChannel($this->configuration->getDefaultChannel(), $this->console, true); // must be free join 28 | $this->prefixes = new PrefixAPI($this); 29 | $this->getServer()->getPluginManager()->registerEvents($this->sessions = new SessionControl($this), $this); 30 | $this->getServer()->getCommandMap()->registerAll("chan", [ 31 | new ForceRankCommand($this, "mod", Channel::MODE_MOD, "fa"), 32 | new ForceRankCommand($this, "admin", Channel::MODE_ADMIN, "fa"), 33 | ]); 34 | } 35 | 36 | public function getPrefixAPI(){ 37 | return $this->prefixes; 38 | } 39 | 40 | public function getChannelManager(){ 41 | return $this->chanMgr; 42 | } 43 | 44 | public function getConsole(){ 45 | return $this->console; 46 | } 47 | 48 | public function getPlayerSub(Player $sender){ 49 | return $this->sessions->getSession($sender); 50 | } 51 | 52 | public function getDefaultChannel(){ 53 | return $this->chanMgr->getChannel($this->configuration->getDefaultChannel()); 54 | } 55 | 56 | /** 57 | * @param Server $server 58 | * 59 | * @return self 60 | */ 61 | public static function getInstance(Server $server){ 62 | return $server->getPluginManager()->getPlugin("ChatChannels"); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/Configuration.php: -------------------------------------------------------------------------------- 1 | config = $config->getAll(); 13 | } 14 | 15 | public function getConsoleName(){ 16 | return $this->config["console name"]; 17 | } 18 | 19 | public function getDefaultChannel(){ 20 | return $this->config["default channel name"]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/ConsoleSubscriber.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 12 | $this->displayName = $displayName; 13 | } 14 | 15 | public function getID(){ 16 | return "server/console"; 17 | } 18 | 19 | public function getDisplayName(){ 20 | return $this->displayName; 21 | } 22 | 23 | public function sendMessage($message, Channel $channel){ 24 | $this->plugin->getLogger()->info("<$channel> $message"); // should I use server logger instead? 25 | } 26 | 27 | public function getSubscribingLevel(){ 28 | return $this->subLevel; 29 | } 30 | 31 | public function isMuted(){ 32 | return false; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/PlayerSubscriber.php: -------------------------------------------------------------------------------- 1 | player = $player; 19 | $this->writeChannel = $main->getDefaultChannel(); 20 | } 21 | 22 | public function getID(){ 23 | return "player/" . strtolower($this->player->getName()); 24 | } 25 | 26 | public function getDisplayName(){ 27 | return $this->player->getDisplayName(); 28 | } 29 | 30 | public function getSubscribingLevel(){ 31 | return $this->level; 32 | } 33 | 34 | public function sendMessage($message, Channel $channel){ 35 | $this->player->sendMessage("<#$channel> $message"); 36 | } 37 | 38 | public function isMuted(){ 39 | return $this->muted; 40 | } 41 | 42 | public function release(){ 43 | $this->player = null; 44 | } 45 | 46 | public function onChatEvent($msg){ 47 | $this->writeChannel->send($msg, $this); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/Prefix.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 17 | } 18 | 19 | public static function addPrefix(Server $server, Plugin $context, Prefix $prefix, $priority){ 20 | self::getInstance($server)->registerPrefix($context, $prefix, $priority); 21 | } 22 | 23 | public function registerPrefix(Plugin $context, Prefix $prefix, $priority){ 24 | $this->pluginsUsing[spl_object_hash($context)] = true; 25 | if(!isset($this->prefixes[$priority])){ 26 | $this->prefixes[$priority] = new PriorityPrefixEnum; 27 | krsort($this->prefixes, SORT_NUMERIC); 28 | } 29 | $this->prefixes[$priority]->add($prefix, $context); 30 | } 31 | 32 | public function recalculateAll(Plugin $context = null){ 33 | if($context !== null){ 34 | if(!isset($this->pluginsUsing[$k = spl_object_hash($context)])){ 35 | return; 36 | } 37 | unset($this->pluginsUsing[$k]); 38 | } 39 | foreach($this->prefixes as $prefixes){ 40 | $prefixes->recalculate(); 41 | } 42 | } 43 | 44 | public function getPrefixes(ChannelSubscriber $sender, Channel $channel){ 45 | $output = ""; 46 | foreach($this->prefixes as $enum){ 47 | $output .= $enum->getPrefixes($sender, $channel); 48 | } 49 | return $output; 50 | } 51 | 52 | public static function getInstance(Server $server){ 53 | return ChatChannels::getInstance($server)->getPrefixAPI(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/PriorityPrefixEnum.php: -------------------------------------------------------------------------------- 1 | registries[] = ["prefix" => $prefix, "plugin" => $context]; 13 | } 14 | 15 | public function recalculate(){ 16 | foreach($this->registries as $k => $reg){ 17 | /** @var Plugin $plugin */ 18 | $plugin = $reg["plugin"]; 19 | if(!$plugin->isEnabled()){ 20 | unset($this->registries[$k]); 21 | } 22 | } 23 | $this->registries = array_values($this->registries); 24 | } 25 | 26 | public function getPrefixes(ChannelSubscriber $sender, Channel $channel, $recalculate = false){ 27 | if($recalculate){ 28 | $this->recalculate(); 29 | } 30 | $output = ""; 31 | foreach($this->registries as $reg){ 32 | /** @var Prefix $prefix */ 33 | $prefix = $reg["prefix"]; 34 | $output .= $prefix->getPrefix($sender, $channel); 35 | } 36 | return $output; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/SessionControl.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 19 | } 20 | 21 | public function onPluginDisabled(PluginDisableEvent $e){ 22 | $this->plugin->getPrefixAPI()->recalculateAll($e->getPlugin()); 23 | } 24 | 25 | public function onJoin(PlayerJoinEvent $event){ 26 | $player = $event->getPlayer(); 27 | $this->playerSubs[$player->getId()] = new PlayerSubscriber($this->plugin, $player); 28 | } 29 | 30 | /** 31 | * @param Player $player 32 | * 33 | * @return PlayerSubscriber 34 | */ 35 | public function getSession(Player $player){ 36 | return $this->playerSubs[$player->getId()]; 37 | } 38 | 39 | public function onQuit(PlayerQuitEvent $event){ 40 | $p = $event->getPlayer(); 41 | if(isset($this->playerSubs[$p->getId()])){ 42 | $this->playerSubs[$p->getId()]->release(); 43 | unset($this->playerSubs[$p->getId()]); 44 | } 45 | } 46 | 47 | public function onChat(PlayerChatEvent $event){ 48 | $event->setCancelled(); 49 | $player = $event->getPlayer(); 50 | $sub = $this->playerSubs[$player->getID()]; 51 | $sub->onChatEvent($event->getMessage()); 52 | } 53 | 54 | public function setMute(Player $player, $muted){ 55 | $sub = $this->playerSubs[$player->getId()]; 56 | $original = $sub->muted; 57 | $sub->muted = $muted; 58 | return $original; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/cmds/ChatChannelsCommand.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 29 | $this->testPerm = true; 30 | parent::__construct($name, $desc, $usage, $aliases); 31 | } 32 | 33 | /** 34 | * @return ChatChannels 35 | */ 36 | public function getPlugin(){ 37 | return $this->plugin; 38 | } 39 | 40 | public function execute(CommandSender $sender, $alias, array $args){ 41 | /** @var ChannelSubscriber $sub */ 42 | if($sender instanceof ConsoleCommandSender){ 43 | $sub = $this->plugin->getConsole(); 44 | }elseif($sender instanceof Player){ 45 | $sub = $this->plugin->getPlayerSub($sender); 46 | }else{ 47 | $class = new \ReflectionClass($sender); 48 | try{ 49 | $method = $class->getMethod("getChannelSubscriber"); 50 | }catch(\ReflectionException $e){ 51 | $method = null; 52 | } 53 | if($method instanceof \ReflectionMethod){ 54 | $sub = $method->invoke($sender); 55 | } 56 | if(!isset($sub) or !($sub instanceof ChannelSubscriber)){ 57 | throw new \InvalidArgumentException("Unknown command sender"); 58 | } 59 | } 60 | $r = $this->onRun($args, $sender, $sub); 61 | if(is_string($r)){ 62 | $sender->sendMessage($r); 63 | }elseif($r === false){ 64 | $sender->sendMessage($this->getUsage()); 65 | } 66 | return true; 67 | } 68 | 69 | protected abstract function onRun(array $args, CommandSender $sender, ChannelSubscriber $sub); 70 | } 71 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/cmds/ForceRankCommand.php: -------------------------------------------------------------------------------- 1 | ", ...$aliases); 16 | $this->setPermission("chatchannels.force$name"); 17 | $this->rankName = $name; 18 | $this->flag = $flag; 19 | } 20 | 21 | public function onRun(array $args, CommandSender $sender, ChannelSubscriber $sub){ 22 | if(!isset($args[0])){ 23 | return false; 24 | } 25 | $channel = $this->getPlugin()->getChannelManager()->getChannel(array_shift($args)); 26 | if(!($channel instanceof Channel)){ 27 | return "Channel doesn't exist!"; 28 | } 29 | $flags = $channel->getFlags($sub->getID()); 30 | if(in_array($this->flag, $flags)){ 31 | return "You are already {$this->rankName} on channel $channel!"; 32 | } 33 | $flags[] = $this->flag; 34 | $channel->setFlags($sub->getID(), $flags); 35 | return "You are now a {$this->rankName} on channel $channel."; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ChatChannels/src/chatchannels/cmds/JoinCommand.php: -------------------------------------------------------------------------------- 1 | getPlugin()->getChannelManager()->getChannel($args[0]); 15 | if(!($channel instanceof Channel)){ 16 | return "Channel $channel doesn't exist!"; 17 | } 18 | if(!$sender->hasPermission($channel->getJoinPermission())){ 19 | return "You don't have permission to join channel $channel"; 20 | } 21 | $channel->join($sub); 22 | return "You joined channel $channel"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ChatLineBreaker/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ChatLineBreaker 2 | version: 3.2 3 | api: [2.0.0] 4 | main: pemapmodder\clb\Main 5 | author: PEMapModder 6 | prefix: CLB 7 | website: https://github.com/PEMapModder/Small-ZC-Plugins/tree/master/ChatLineBreaker 8 | commands: 9 | clb: 10 | usage: 11 | description: Calibrate/set/view your CLB settings; Toggle CLB 12 | -------------------------------------------------------------------------------- /ChatLineBreaker/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | default-enable: true 3 | default-length: 50 4 | ... 5 | -------------------------------------------------------------------------------- /ChatLineBreaker/src/pemapmodder/clb/CallbackTask.php: -------------------------------------------------------------------------------- 1 | callback = $callback; 17 | $this->args = $args; 18 | } 19 | 20 | public function onRun($ticks){ 21 | call_user_func_array($this->callback, $this->args); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ChatLineBreaker/src/pemapmodder/clb/Database.php: -------------------------------------------------------------------------------- 1 | path = $path; 15 | $this->dummyData(); 16 | $this->load(); 17 | } 18 | 19 | public function dummyData(){ 20 | $this->data["console"] = 0xFF; 21 | } 22 | 23 | public function load(){ 24 | $data = @file_get_contents($this->path); 25 | if($data === false){ 26 | $this->dummyData(); 27 | $this->save(); 28 | return; 29 | } 30 | if(ord(substr($data, 0, 1)) > self::API){ 31 | trigger_error("Database corrupted, recreating database", E_USER_WARNING); 32 | $this->dummyData(); 33 | $this->save(); 34 | return; 35 | } 36 | if(strlen($data) % 13){ 37 | trigger_error("Database corrupted, recreating database", E_USER_WARNING); 38 | $this->dummyData(); 39 | $this->save(); 40 | return; 41 | } 42 | $data = str_split($data, 13); 43 | foreach($data as $datum){ 44 | $this->data[Main::decompressName(substr($datum, 0, 12))] = ord(substr($datum, 12, 1)); 45 | } 46 | $max = count($this->data); 47 | if(array_keys($this->data)[$max] !== "console" or $this->data["console"] !== 0xFF){ 48 | trigger_error("Database corrupted, recovering database", E_USER_WARNING); 49 | unset($this->data[array_keys($this->data)[$max]]); 50 | $this->data["console"] = 0xFF; 51 | $this->save(); 52 | return; 53 | } 54 | } 55 | 56 | public function save(){ 57 | $res = fopen($this->path, "wb"); 58 | foreach($this->data as $name => $length){ 59 | fwrite($res, Main::compressName($name)); 60 | fwrite($res, chr($length)); 61 | } 62 | fclose($res); // TODO change to GZIP 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /ChatLineBreaker/src/pemapmodder/clb/WriteFileTask.php: -------------------------------------------------------------------------------- 1 | file = $file; 14 | $this->content = $content; 15 | } 16 | 17 | public function onRun(){ 18 | file_put_contents($this->file, $this->content, \LOCK_EX); 19 | } 20 | 21 | public function onCompletion(Server $server){ 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CommandSelectors/bin/CommandSelectors_dev_build.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/CommandSelectors/bin/CommandSelectors_dev_build.phar -------------------------------------------------------------------------------- /CommandSelectors/bin/README.md: -------------------------------------------------------------------------------- 1 | bin 2 | === 3 | A directory that stores compiled binaries (.phar files) of commits 4 | -------------------------------------------------------------------------------- /CommandSelectors/bin/ignoreme/.gitignore: -------------------------------------------------------------------------------- 1 | bin/* 2 | 3 | copy.php 4 | -------------------------------------------------------------------------------- /CommandSelectors/bin/ignoreme/compile.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | TITLE WorldEditArt PHAR compiler 3 | set PHP_BINARY=bin\php\php.exe 4 | set START_FILE=compile.php 5 | start "" bin\mintty.exe -o Columns=88 -o Rows=32 -o AllowBlinking=0 -o FontQuality=3 -o Font="DejaVu Sans Mono" -o FontHeight=10 -o CursorType=0 -o CursorBlinks=1 -h error -t "PocketMine-MP" -i bin/pocketmine.ico -w max %PHP_BINARY% %START_FILE% --enable-ansi %* 6 | REM bin\php\php compile.php -dphar.readonly=0 --enable-ansi 7 | -------------------------------------------------------------------------------- /CommandSelectors/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: CommandSelectors 3 | version: 1.0.0_dev_build_#014 4 | api: 5 | - 2.0.0 6 | main: pemapmodder\cmdsel\CmdSel 7 | permissions: 8 | cmdsel: 9 | chidren: 10 | cmdsel.loopall: 11 | description: Allow using the '@a' selector 12 | default: op 13 | author: PEMapModder 14 | ... 15 | -------------------------------------------------------------------------------- /CommandSelectors/src/pemapmodder/cmdsel/event/PlayerCommandPreprocessEvent_sub.php: -------------------------------------------------------------------------------- 1 | getOnlinePlayers() as $p){ 21 | if(CmdSel::checkSelectors($args, $sender, $p)){ 22 | $result[] = $p->getName(); 23 | } 24 | } 25 | return $result; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CommandSelectors/src/pemapmodder/cmdsel/selector/NearestSelector.php: -------------------------------------------------------------------------------- 1 | getName(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CommandSelectors/src/pemapmodder/cmdsel/selector/RandomSelector.php: -------------------------------------------------------------------------------- 1 | getServer()->getOnlinePlayers() as $player){ 21 | if($player === $sender){ 22 | continue; 23 | } 24 | if(CmdSel::checkSelectors($args, $sender, $player)){ 25 | continue; 26 | } 27 | $players[] = $player; 28 | } 29 | if(count($players) === 0){ 30 | return false; 31 | } 32 | /** @var \pocketmine\Player $rand */ 33 | $rand = array_rand($players); 34 | return $rand; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CommandSelectors/src/pemapmodder/cmdsel/selector/RecursiveSelector.php: -------------------------------------------------------------------------------- 1 | getName(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CommandSelectors/src/pemapmodder/cmdsel/selector/WorldSelector.php: -------------------------------------------------------------------------------- 1 | getLevel()->getName(); 21 | } 22 | return false; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ConsolePush/README.md: -------------------------------------------------------------------------------- 1 | ConsolePush 2 | === 3 | 4 | Usage: `normal-console-cmd args here\[switch]` 5 | 6 | Possible values for `[switch]`: 7 | * `t`: trim the whtiespace before the last `\` 8 | * `c`: cancel the event, which is equivalent to deleting/backspace-ing this line 9 | * `p`: do not dispatch the command line. Print the typed line onto the next line as if you didn't type the commands before. 10 | * `n`: do nothing, simply ignore the `\[switch]`. Useful for retaining the whitespace at the end of a command line. 11 | -------------------------------------------------------------------------------- /ConsolePush/bin/ConsolePush.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/ConsolePush/bin/ConsolePush.phar -------------------------------------------------------------------------------- /ConsolePush/bin/README.md: -------------------------------------------------------------------------------- 1 | ConsolePush/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. 4 | -------------------------------------------------------------------------------- /ConsolePush/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ConsolePush 3 | version: "1.003" 4 | api: 2.0.0 5 | author: PEMapModder 6 | main: PEMapModder\ConsolePush\ConsolePush 7 | ... 8 | -------------------------------------------------------------------------------- /ConsolePush/src/PEMapModder/ConsolePush/ConsolePush.php: -------------------------------------------------------------------------------- 1 | getServer()->getPluginManager()->registerEvents($this, $this); 19 | } 20 | 21 | public function onConsoleCmd(ServerCommandEvent $event){ 22 | if(isset($this->currentLine)){ 23 | $event->setCommand($this->currentLine . $event->getCommand()); 24 | unset($this->currentLine); 25 | } 26 | $msg = $event->getCommand(); 27 | if(preg_match('/^(.*)\\\\([a-z])$/', $msg, $match)){ 28 | $char = $match[2]; 29 | switch($char){ 30 | case self::CHAR_NORMAL: 31 | $event->setCommand($match[1]); 32 | break; 33 | case self::CHAR_RTRIM: 34 | $event->setCommand(rtrim($match[1])); 35 | break; 36 | case self::CHAR_CANCEL: 37 | $event->setCancelled(); 38 | break; 39 | case self::CHAR_PUSH: 40 | $event->setCancelled(); 41 | $this->simulateInput($match[1]); 42 | break; 43 | } 44 | } 45 | } 46 | 47 | public function simulateInput($input){ 48 | echo $input; 49 | $this->currentLine = $input; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /CustomAreas/bin/CustomAreas.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/CustomAreas/bin/CustomAreas.phar -------------------------------------------------------------------------------- /CustomAreas/bin/README.md: -------------------------------------------------------------------------------- 1 | CustomAreas/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. 4 | -------------------------------------------------------------------------------- /CustomAreas/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | database: 3 | # database type to use. Options: local, mysql (MySQL IS NOT SUPPORTED YET! DON'T SELECT IT!) 4 | type: local 5 | # LocalDatabase creates a file for each area, and also a file for indexing. 6 | local: 7 | # directories will be automatically created if they do not exist. 8 | index-file: areas/.index 9 | # $${areaname} will be replaced by the area's lowercase name 10 | # You may need to delete the index file or just rename existing area files if you modified this option, because the areas are loaded according to this option. 11 | area-file: "areas/$${areaname}.dat" 12 | # MySQLDatabase stores data to a MySQL database. It is more effective to use a LocalDatabase. 13 | mysql: 14 | host: localhost 15 | port: 3306 16 | username: root 17 | password: "" 18 | schema: customareas 19 | # you most likely don't want to change this 20 | socket: "" 21 | ... 22 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/CustomAreas.php: -------------------------------------------------------------------------------- 1 | saveDefaultConfig(); 17 | $this->initDb(); 18 | $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); 19 | } 20 | 21 | private function initDb(){ 22 | $type = $this->getConfig()->getNested("database.type"); 23 | switch(strtolower($type)){ 24 | case "mysql": 25 | /** @noinspection PhpMissingBreakStatementInspection */ 26 | case "mysqli": 27 | $this->getLogger()->warning("MySQL database is not supported yet! It will be changed into local database."); 28 | case "local": 29 | case "nbt": 30 | $this->setDatabase(new LocalDatabase($this), $this->getConfig()->getNested("database.local")); 31 | break; 32 | case "none": 33 | $this->setDatabase(new DummyDatabase); 34 | break; 35 | } 36 | } 37 | 38 | public function setDatabase(Database $db, $args = null){ 39 | $db->init($args); 40 | $this->db = $db; 41 | } 42 | 43 | /** 44 | * @return Database 45 | */ 46 | public function getDatabase(){ 47 | return $this->db; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/db/Database.php: -------------------------------------------------------------------------------- 1 | getAreas() as $area){ 53 | $l = $area->getShape()->getLevelName(); 54 | if($l !== $pos->getLevel()->getName()){ 55 | continue; 56 | } 57 | if($area->getShape()->isInside($pos)){ 58 | return $area; 59 | } 60 | } 61 | return null; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/db/DummyDatabase.php: -------------------------------------------------------------------------------- 1 | areas[$area->getName()] = $area; 23 | } 24 | 25 | public function rmArea(Area $area){ 26 | unset($this->areas[$area->getName()]); 27 | } 28 | 29 | public function getArea($name){ 30 | return isset($this->areas[$name]) ? $this->areas[$name] : null; 31 | } 32 | 33 | public function getAreas(){ 34 | return $this->areas; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/pocketmine/CacheCleanTask.php: -------------------------------------------------------------------------------- 1 | getOwner(); 12 | foreach($main->getDatabase()->getAreas() as $area){ 13 | $shape = $area->getShape(); 14 | if($shape instanceof Cached){ 15 | $shape->cleanCache(); 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/shape/Cached.php: -------------------------------------------------------------------------------- 1 | $this->radius, 21 | "x" => $this->centerx, 22 | "z" => $this->centerz, 23 | "lv" => $this->levelName, 24 | "v" => 0, 25 | ]); 26 | } 27 | 28 | public function unserialize($serialized){ 29 | $d = unserialize($serialized); 30 | $this->radius = $d["rad"]; 31 | $this->centerx = $d["x"]; 32 | $this->centerz = $d["z"]; 33 | $this->levelName = $d["lv"]; 34 | } 35 | 36 | public static function getName(){ 37 | return "circ"; 38 | } 39 | 40 | public function isInside(Vector3 $p){ 41 | return (new Vector2($this->centerx, $this->centerz))->distanceSquared(new Vector2($p->x, $p->z)) <= $this->radiusSquared; 42 | } 43 | 44 | /** 45 | * @return number 46 | */ 47 | public function getRadius(){ 48 | return $this->radius; 49 | } 50 | 51 | /** 52 | * @param number $radius 53 | */ 54 | public function setRadius($radius){ 55 | $this->radius = $radius; 56 | $this->radiusSquared = $radius ** 2; 57 | } 58 | 59 | public function getLevelName(){ 60 | return $this->levelName; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/shape/IrregularShape.php: -------------------------------------------------------------------------------- 1 | points; 22 | } 23 | 24 | /** 25 | * @param Vector2[] $points 26 | */ 27 | public function setPoints($points){ 28 | if(count($points) < 3){ 29 | throw new \InvalidArgumentException("A shape must have at least 3 points"); 30 | } 31 | $this->points = array_values($points); 32 | $this->recalculateLines(); 33 | } 34 | 35 | private function recalculateLines(){ 36 | $this->lines = []; 37 | foreach($this->points as $i => $pt){ 38 | $this->lines[$i] = new Line($pt, isset($this->points[$i + 1]) ? $this->points[$i + 1] : $this->points[0]); 39 | } 40 | } 41 | 42 | public function serialize(){ 43 | return ["p" => serialize(array_map(function (Vector2 $c){ 44 | return "$c->x:$c->y"; 45 | }, $this->points)), "v" => 0]; 46 | } 47 | 48 | public function unserialize($serialized){ 49 | $d = unserialize($serialized)["p"]; 50 | $this->setPoints(array_map(function ($str){ 51 | list($x, $y) = explode(":", $str); 52 | return new Vector2($x, $y); 53 | }, $d)); 54 | } 55 | 56 | public static function getName(){ 57 | return "ireg"; 58 | } 59 | 60 | public function isInside(Vector3 $p){ 61 | $v2 = new Vector2($p->x, $p->z); 62 | $hash = $this->hash($v2); 63 | if(isset($this->cache[$hash])){ 64 | return $this->cache[$hash]; 65 | } 66 | $intersects = 0; 67 | foreach($this->lines as $line){ 68 | $intersects += $line->isAbsolutelyAbove($v2); 69 | } 70 | $this->cache[$hash] = $result = (bool) ($intersects & 1); 71 | return $result; 72 | } 73 | 74 | public function getLevelName(){ 75 | return $this->levelName; 76 | } 77 | 78 | public function hash($x, $z = null){ 79 | if($x instanceof Vector2){ 80 | return $this->hash($x->x, $x->y); 81 | } 82 | $x = round($x, 1); 83 | $z = round($z, 1); 84 | return "$x:$z"; 85 | } 86 | 87 | public function cleanCache(){ 88 | $this->cache = []; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/shape/Line.php: -------------------------------------------------------------------------------- 1 | fromx = $from->x; 16 | $this->fromz = $from->y; 17 | $this->tox = $to->x; 18 | $this->toz = $to->y; 19 | } 20 | 21 | public function getSlope(){ 22 | return ($this->toz - $this->fromz) / ($this->tox - $this->fromx); 23 | } 24 | 25 | public function getZInterceptByX($x0){ 26 | return $this->fromz - ($this->fromx - $x0) * $this->getSlope(); 27 | } 28 | 29 | public function isAbsolutelyAbove(Vector2 $pt){ 30 | $intercept = $this->getZInterceptByX($pt->x); 31 | if($intercept > $pt->y){ 32 | return self::ABOVE; 33 | } 34 | if($intercept === $pt->y){ 35 | return self::INTERSECT; 36 | } 37 | return self::BELOW; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/shape/RectangularShape.php: -------------------------------------------------------------------------------- 1 | $this->fromx, "fz" => $this->fromz, "tox" => $this->tox, "toz" => $this->toz, "lv" => $this->levelName, "v" => 0]; 15 | return serialize($data); 16 | } 17 | 18 | public function unserialize($d){ 19 | $d = unserialize($d); 20 | $this->fromx = $d["fx"]; 21 | $this->fromz = $d["fz"]; 22 | $this->tox = $d["tx"]; 23 | $this->toz = $d["tz"]; 24 | $this->levelName = $d["lv"]; 25 | } 26 | 27 | public static function getName(){ 28 | return "rect"; 29 | } 30 | 31 | public function isInside(Vector3 $pos){ 32 | return ($this->fromx <= $pos->x) and ($this->fromz <= $pos->z) and ($this->tox >= $pos->x) and ($this->toz >= $pos->z); 33 | } 34 | 35 | public function getLevelName(){ 36 | return $this->levelName; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /CustomAreas/src/customareas/shape/Shape.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /DeFactoGui/plugin.yml: -------------------------------------------------------------------------------- 1 | name: DeFactoGui 2 | version: 2.0.0_build#000 3 | api: 2.0.0 4 | main: defactogui\DeFactoGui 5 | website: https://github.com/PEMapModder/Small-ZC-Plugins/tree/DeFactoGui 6 | author: PEMapModder 7 | description: MCPE commands are terrible. Use GUI instead. 8 | -------------------------------------------------------------------------------- /DeFactoGui/src/defactogui/Button.php: -------------------------------------------------------------------------------- 1 | getServer()->getDefaultLevel(); 38 | $spawn = $lv->getSpawnLocation()->floor(); 39 | $chunk = $lv->getChunk($spawn->x >> 4, $spawn->z >> 4); 40 | $nbt = new CompoundTag; 41 | $nbt->Items = new ListTag("Items", []); 42 | $nbt->Items->setTagType(NBT::TAG_List); 43 | $nbt->id = new StringTag("id", Tile::CHEST); 44 | $nbt->x = new IntTag("x", $spawn->x); 45 | $nbt->y = new IntTag("y", $spawn->y); 46 | $nbt->z = new IntTag("z", $spawn->z); 47 | $this->fakeTile = new Chest($chunk, $nbt); 48 | } 49 | 50 | public function registerButton(Button $button){ 51 | $this->registeredButtons[get_class($button)] = $button; 52 | } 53 | 54 | /** 55 | * @return Chest 56 | */ 57 | public function getFakeTile(){ 58 | return $this->fakeTile; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /DeFactoGui/src/defactogui/EventListener.php: -------------------------------------------------------------------------------- 1 | main = $main; 30 | } 31 | 32 | public function onJoin(PlayerJoinEvent $event){ 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DynamicSignTechnology/README.md: -------------------------------------------------------------------------------- 1 | DynamicSignTechnology 2 | === 3 | This plugin allows dynamic signs to be implemented. By-products, like sign signatures, are also supported. 4 | -------------------------------------------------------------------------------- /DynamicSignTechnology/plugin.yml: -------------------------------------------------------------------------------- 1 | name: DynamicSignTechnology 2 | author: PEMapModder 3 | version: 3.1 4 | api: [2.0.0] 5 | main: pemapmodder\dst\Main 6 | load: POSTWORLD 7 | prefix: DST 8 | -------------------------------------------------------------------------------- /DynamicSignTechnology/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # every how many ticks should the database be checked. Note that modifying this value will cause bugs of some texts never showing up. 3 | ticks rate: 1 4 | ... 5 | -------------------------------------------------------------------------------- /DynamicSignTechnology/resources/ids.json: -------------------------------------------------------------------------------- 1 | { 2 | "signs": 0 3 | } 4 | -------------------------------------------------------------------------------- /DynamicSignTechnology/src/pemapmodder/dst/TickUpdater.php: -------------------------------------------------------------------------------- 1 | getOwner(); 13 | $dels = 0; 14 | foreach($main->getServer()->getLevels() as $level){ 15 | $db = $main->getDb($level); 16 | $op = $db->prepare("SELECT * FROM signs WHERE (:ticks % intv) = 0;"); 17 | $op->bindValue(":ticks", $ticks); // didn't know I would ever use this :D 18 | $result = $op->execute(); 19 | while(($data = $result->fetchArray(SQLITE3_ASSOC)) !== false){ 20 | $tile = $level->getTile(new Vector3($data["x"], $data["y"], $data["z"])); 21 | if($tile instanceof Sign){ 22 | $lengths = $data["lengths"]; 23 | $text = $data["texts"]; 24 | $texts = []; 25 | $offset = 0; 26 | for($i = 0; $i < strlen($lengths) * 2; $i++){ 27 | $texts[] = substr($text, $offset, $length = $this->getHalfByteValue($lengths, $i)); 28 | $offset += $length; 29 | } 30 | $last = count($texts) - 1; 31 | if($texts[$last] === ""){ 32 | unset($texts[$last]); 33 | } 34 | while(($count = count($texts)) % 4 !== 0){ 35 | $texts[] = ""; 36 | } 37 | $scroll = $data["scrolltype"]; 38 | $pages = ceil($count / $scroll); 39 | $curPage = $ticks % ($data["intv"] * $pages); 40 | $cur = array_slice($texts, $curPage * $scroll, 4); 41 | $tile->setText($cur[0], $cur[1], $cur[2], $cur[3]); 42 | }else{ 43 | $op = $db->prepare("DELETE FROM signs WHERE id = :id;"); 44 | $op->bindValue(":id", $data["id"]); 45 | $op->execute(); 46 | $dels++; 47 | } 48 | } 49 | } 50 | if($dels){ 51 | $main->getLogger()->notice(($dels === 1 ? "A dynamic sign has" : "$dels dynamic signs have") . " been unregistered due to being removed."); 52 | } 53 | } 54 | 55 | public static function getHalfByteValue($string, $offset){ 56 | $back = (bool) ($offset % 2); 57 | $char = substr($string, $offset >> 1, 1); 58 | $ord = ord($char); 59 | return ($back ? $ord & 0x0F : $ord >> 4); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /FastJoin/src/pemapmodder/fastjoin/FastJoin.php: -------------------------------------------------------------------------------- 1 | getServer()->getDataPath() . "/worlds/.fastjoin/"; 16 | FlatProvider::generate($path, ".fastjoin", 0, ""); 17 | $this->getServer()->loadLevel(".fastjoin"); 18 | } 19 | 20 | public function onPreLogin(PlayerLoginEvent $event){ 21 | $player = $event->getPlayer(); 22 | $this->table[spl_object_hash($player)] = $player->getPosition(); 23 | $player->teleport(new Position(0, 128, 0, $this->getServer()->getLevelByName(".fastjoin"))); 24 | } 25 | 26 | public function onJoin(PlayerJoinEvent $event){ 27 | $player = $event->getPlayer(); 28 | $this->getServer()->getScheduler()->scheduleDelayedTask(new TeleportTask($this, $player, $this->table[spl_object_hash($player)]), 20); 29 | unset($this->table[spl_object_hash($player)]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /FastJoin/src/pemapmodder/fastjoin/TeleportTask.php: -------------------------------------------------------------------------------- 1 | player = $player; 18 | $this->pos = $pos; 19 | } 20 | 21 | public function onRun($t){ 22 | $this->player->teleport($this->pos); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /IPLogger/bin/IPLogger.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/IPLogger/bin/IPLogger.phar -------------------------------------------------------------------------------- /IPLogger/bin/README.md: -------------------------------------------------------------------------------- 1 | IPLogger/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. 4 | -------------------------------------------------------------------------------- /IPLogger/icon/IP.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/IPLogger/icon/IP.jpg -------------------------------------------------------------------------------- /IPLogger/icon/Icon_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/IPLogger/icon/Icon_2.png -------------------------------------------------------------------------------- /IPLogger/icon/pad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/IPLogger/icon/pad.jpg -------------------------------------------------------------------------------- /IPLogger/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: IPLogger 3 | main: pemapmodder\iplogger\Main 4 | version: "002" 5 | api: 6 | - 1.0.0 7 | - 2.0.0 8 | author: PEMapModder 9 | load: PostWorld 10 | website: https://github.com/PEMapModder/Small-ZC-Plugins/tree/master/IPLogger 11 | commands: 12 | iplog: 13 | aliases: 14 | - iphist 15 | - ipl 16 | - iph 17 | description: View the IP log of yours or other players' 18 | usage: /iplog [player = yourself] 19 | permission: iplogger.iplog 20 | permissions: 21 | iplogger: 22 | description: Allow using everything of IPLogger 23 | default: false 24 | children: 25 | iplogger.iplog: 26 | description: Allow using command /iplog 27 | default: true 28 | iplogger.self.read: 29 | description: Allow reading self's IP log 30 | default: true 31 | iplogger.other.read: 32 | description: Allow reading others' IP log 33 | default: op 34 | ... 35 | -------------------------------------------------------------------------------- /IPLogger/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | warn console when using new IP: true 3 | warn level: ALERT 4 | ... 5 | -------------------------------------------------------------------------------- /IRCBridge/bin/IRCBridge.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/IRCBridge/bin/IRCBridge.phar -------------------------------------------------------------------------------- /IRCBridge/bin/README.md: -------------------------------------------------------------------------------- 1 | IRCBridge/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. -------------------------------------------------------------------------------- /IRCBridge/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: IRCBridge 3 | version: "1.003" 4 | api: 2.0.0 5 | main: pemapmodder\ircbridge\IRCBridge 6 | author: PEMapModder 7 | ... 8 | -------------------------------------------------------------------------------- /IRCBridge/resoruces/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | server: 3 | # ip: 0.0.0.0 # don't uncomment and change this unless you know what you're doing 4 | port: 6667 5 | # Server name displayed when client connects (as part of the RPL_YOURHOST message and possibly other uses) 6 | name: PocketMine IRCBridge Network 7 | # Configure service providers used by the plugin 8 | integration: 9 | auth: pemapmodder\ircbridge\integration\auth\DummyAuthIntegration # If you have the SimpleAuth plugin, you are strongly advised to change this to pemapmodder\ircbridge\integration\auth\SimpleAuthAuthIntegration 10 | channels: pemapmodder\ircbridge\integration\channels\DefaultChannelsIntegration # If you have the ChatChannels plugin, you are strongly encouraged to change thish to pemapmodder\ircbridge\integration\channels\ChatChannelsChannelsIntegration 11 | ... 12 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/IRCBridge.php: -------------------------------------------------------------------------------- 1 | saveDefaultConfig(); 18 | $this->mgr = new ClientManager($this); 19 | $this->startTime = microtime(true); 20 | $this->thread = new IRCServer($this->mgr->getBuffer(), $this->getConfig()->getNested("server.ip", "0.0.0.0"), $this->getConfig()->getNested("server.port", 6667)); 21 | } 22 | 23 | public function onDisable(){ 24 | $this->thread->stop(); 25 | } 26 | 27 | /** 28 | * @return ClientManager 29 | */ 30 | public function getManager(){ 31 | return $this->mgr; 32 | } 33 | 34 | public function getCreationTime(){ 35 | return date(DATE_ATOM, $this->startTime); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/TickTask.php: -------------------------------------------------------------------------------- 1 | getOwner(); 11 | $owner->getManager()->tick(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/Buffer.php: -------------------------------------------------------------------------------- 1 | lock){ 12 | ; 13 | } 14 | $this->lock = true; 15 | $result = strstr($this->write, "\r\n", true); 16 | $this->write = substr($this->write, strlen($result) + 2); 17 | $this->lock = false; 18 | return $result; 19 | } 20 | 21 | public function nextRead(){ 22 | while($this->lock){ 23 | ; 24 | } 25 | $this->lock = true; 26 | $result = strstr($this->read, "\r\n", true); 27 | $this->read = substr($this->read, strlen($result) + 2); 28 | $this->lock = false; 29 | return $result; 30 | } 31 | 32 | public function addWrite($line){ 33 | while($this->lock){ 34 | ; 35 | } 36 | $this->lock = true; 37 | $this->write .= $line . "\r\n"; 38 | $this->lock = false; 39 | } 40 | 41 | public function addRead($line){ 42 | while($this->lock){ 43 | ; 44 | } 45 | $this->lock = true; 46 | $this->read .= $line . "\r\n"; 47 | $this->lock = false; 48 | } 49 | 50 | public function hasMoreWrite(){ 51 | return $this->write !== ""; 52 | } 53 | 54 | public function hasMoreRead(){ 55 | return $this->read !== ""; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/ClientManager.php: -------------------------------------------------------------------------------- 1 | main = $main; 18 | $this->buffer = new Buffer; 19 | } 20 | 21 | /** 22 | * @return Buffer 23 | */ 24 | public function getBuffer(){ 25 | return $this->buffer; 26 | } 27 | 28 | public function tick(){ 29 | while($this->buffer->hasMoreRead()){ 30 | $line = IRCLine::parseInternalLine($this->buffer->nextRead(), $signal, $client); 31 | switch($signal){ 32 | case IRCLine::SIGNAL_OPEN_SESSION: 33 | $this->sessions[$line] = new IRCSession($line, $this->main); 34 | break; 35 | case IRCLine::SIGNAL_CLOSE_SESSION: 36 | if(isset($this->sessions[$line])){ 37 | $this->sessions[$line]->finalize(); 38 | unset($this->sessions[$line]); 39 | } 40 | break; 41 | case IRCLine::SIGNAL_STD_LINE: 42 | if(isset($this->sessions[$client])){ 43 | $this->sessions[$client]->handleLine(new IRCLine($line)); 44 | } 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/protocol/Command.php: -------------------------------------------------------------------------------- 1 | name = $line->getCmdName(); 12 | $this->init($line->getArguments(), $line->getPrefix()); 13 | } 14 | 15 | /** 16 | * @return string 17 | */ 18 | public function getName(){ 19 | return $this->name; 20 | } 21 | 22 | /** 23 | * @param string[] $args 24 | * @param string $prefix 25 | */ 26 | protected abstract function init($args, $prefix); 27 | 28 | public function encode(){ 29 | throw new \RuntimeException(static::class . " cannot be encoded because it isn't sent from a server."); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/protocol/IRCLine.php: -------------------------------------------------------------------------------- 1 | prefix, $this->cmd, $args) = $matches; 16 | if(($pos = strpos($args, " :")) !== false){ 17 | $this->args = explode(" ", substr($args, 0, $pos)); 18 | $this->args[] = substr($args, $pos + 2); 19 | }else{ 20 | $this->args = explode(" ", $args); 21 | } 22 | }else{ 23 | throw new \UnexpectedValueException("Incorrect IRC syntax"); 24 | } 25 | } 26 | 27 | public function getPrefix(){ 28 | return $this->prefix; 29 | } 30 | 31 | public function getCmdName(){ 32 | return $this->cmd; 33 | } 34 | 35 | public function getCommand(){ 36 | if(!self::$init){ 37 | self::init(); 38 | } 39 | if(!isset(Command::$cmds[strtoupper($this->cmd)])){ 40 | return null; 41 | } 42 | $class = Command::$cmds[strtoupper($this->cmd)]; 43 | /** @var Command $instance */ 44 | $instance = new $class($this); 45 | return $instance; 46 | } 47 | 48 | public function getArguments(){ 49 | return $this->args; 50 | } 51 | 52 | const SIGNAL_OPEN_SESSION = 0; 53 | const SIGNAL_STD_LINE = 1; 54 | const SIGNAL_CLOSE_SESSION = 2; 55 | 56 | public static function parseInternalLine($line, &$signal, &$client = false){ 57 | if($line === false){ 58 | return false; 59 | } 60 | $signal = ord(substr($line, 0, 1)); 61 | if($signal === self::SIGNAL_STD_LINE){ 62 | $client = strstr(substr($line, 1), " ", true); 63 | return substr($line, strlen($client) + 2); 64 | } 65 | return substr($line, 1); 66 | } 67 | 68 | public static function init(){ 69 | self::$init = true; 70 | Command::$cmds = [ 71 | "PASS" => PassCommand::class, 72 | "NICK" => NickCommand::class, 73 | "USER" => UserCommand::class, 74 | 75 | // TODO more 76 | ]; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/protocol/ModeCommand.php: -------------------------------------------------------------------------------- 1 | target = $args[0]; 12 | preg_match_all('/(\+|\-)([A-Za-z]+)/', $args[1], $matches, PREG_SET_ORDER); 13 | foreach($matches as $match){ 14 | $true = $match[1] === "+"; 15 | foreach(str_split($match[2]) as $char){ 16 | $this->modes[$char] = $true; 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/protocol/NickCommand.php: -------------------------------------------------------------------------------- 1 | nick = $args[0]; 12 | } 13 | 14 | public function encode(){ 15 | return ":$this->user NICK $this->nick"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/protocol/PassCommand.php: -------------------------------------------------------------------------------- 1 | pass) = $args; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/protocol/QuitCommand.php: -------------------------------------------------------------------------------- 1 | msg = $args[0]; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /IRCBridge/src/pemapmodder/ircbridge/bridge/protocol/UserCommand.php: -------------------------------------------------------------------------------- 1 | user, $mode, $this->unused, $this->realname) = $args; 11 | $this->mode = (int) $mode; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InfoEssentials/plugin.yml: -------------------------------------------------------------------------------- 1 | name: InfoEssentials 2 | version: 6.6 # gravitational constant: 6.671281903963040991511534289 3 | api: [2.0.0] 4 | author: PEMapModder 5 | prefix: InfoEss 6 | main: pemapmodder\infoess\InfoEss 7 | commands: 8 | getping: 9 | description: See the ping of other players 10 | seearmor: 11 | description: See the armor of a player 12 | seegm: 13 | description: See the gamemode of a player 14 | getpos: 15 | description: See the position of a player 16 | setarmor: 17 | description: See the armor of a player 18 | rmarmor: 19 | description: Remove the armor of a player 20 | sessions: 21 | description: See how many times a player has logged in in this server 22 | permissions: 23 | infoess: 24 | description: Allows using all InfoEssentials commands 25 | default: "true" 26 | infoess.getping: 27 | description: Allows using /getping 28 | infoess.seearmor: 29 | description: Allows using /seearmor 30 | infoess.seegm: 31 | description: Allows using /seegm 32 | infoess.getpos: 33 | description: Allows using /getpos 34 | infoess.setarmor: 35 | description: Allows using /setarmor 36 | infoess.rmarmor: 37 | description: Allows using /rmarmor 38 | infoess.sessions: 39 | description: Allows using /sessions 40 | -------------------------------------------------------------------------------- /LagFixer/plugin.yml: -------------------------------------------------------------------------------- 1 | name: LagFixer 2 | description: Get rid of invisible players and get your correct health 3 | api: [2.0.0] 4 | author: PEMapModder 5 | version: 1.0 6 | main: pemapmodder\lagfixer\LagFixer 7 | website: https://github.com/PEMapModder/Small-ZC-Plugins/tree/master/LagFixer 8 | permissions: 9 | lagfixer: 10 | description: Allows using everything of LagFixer 11 | children: 12 | lagfixer.show: 13 | description: Allows using /show 14 | children: 15 | lagfixer.show.player: 16 | default: true 17 | description: Allows using /show 18 | lagfixer.show.all: 19 | default: true 20 | description: Allows using /show -all 21 | lagfixer.realhealth: 22 | description: Allows using /realhealth 23 | default: true 24 | 25 | -------------------------------------------------------------------------------- /LagFixer/src/pemapmodder/lagfixer/HealthCommand.php: -------------------------------------------------------------------------------- 1 | plugin = $main; 16 | parent::__construct("realhealth", "Sends you your real health", null, ["rh", "rlhlth"]); 17 | $this->setPermission("lagfixer.realhealth"); 18 | $this->setPermissionMessage("Hmm, seems that you haven't been granted permission to view your real health."); 19 | } 20 | 21 | public function execute(CommandSender $sender, $alias, array $args){ 22 | if($sender instanceof Player){ 23 | $packet = new SetHealthPacket; 24 | $packet->health = $sender->getHealth(); 25 | $sender->dataPacket($packet); 26 | return true; 27 | } 28 | $sender->sendMessage("Please run this command in-game. If you want to know your device's health, don't ask me."); 29 | return false; 30 | } 31 | 32 | public function getPlugin(){ 33 | return $this->plugin; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LagFixer/src/pemapmodder/lagfixer/LagFixer.php: -------------------------------------------------------------------------------- 1 | getServer()->getCommandMap()->registerAll("lagfixer", [ 10 | new ShowCommand($this), 11 | new HealthCommand($this), 12 | ]); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /LagFixer/src/pemapmodder/lagfixer/ShowCommand.php: -------------------------------------------------------------------------------- 1 | plugin = $main; 15 | parent::__construct("show", "Force show a player(s) if they are not supposed to be invisible", ""); 16 | $this->setPermission("lagfixer.show"); 17 | $this->setPermissionMessage("Seems that someone took away your permission to show invisible players."); 18 | } 19 | 20 | public function execute(CommandSender $issuer, $alias, array $args){ 21 | if($issuer instanceof Player){ 22 | if(isset($args[0])){ 23 | if(($name = strtolower($args[0])) === "-all"){ 24 | if(!$issuer->hasPermission("lagfixer.show.all")){ 25 | $issuer->sendMessage("You don't have permission to show all invisible players in once."); 26 | return false; 27 | } 28 | foreach($this->plugin->getServer()->getOnlinePlayers() as $player){ 29 | if($player->getID() !== $issuer->getID()){ 30 | $player->spawnTo($issuer); 31 | } 32 | } 33 | $issuer->sendMessage("All visible players have been sent to you."); 34 | return true; 35 | }else{ 36 | if(!$issuer->hasPermission("lagfixer.show.player")){ 37 | $issuer->sendMessage("You don't have permission to show an invisible player."); 38 | return false; 39 | } 40 | $player = $this->plugin->getServer()->getPlayer($args[0]); 41 | if($player instanceof Player and $player->getID() !== $issuer->getID()){ 42 | $player->spawnTo($issuer); 43 | return true; 44 | } 45 | } 46 | } 47 | $issuer->sendMessage("Wrong usage: Argument 1 must be a player name or part of it."); 48 | $issuer->sendMessage("Usage: " . $this->getUsage()); 49 | return false; 50 | } 51 | $issuer->sendMessage("Please run this command in-game. You shouldn't see any graphical players here."); 52 | return false; 53 | } 54 | 55 | public function getPlugin(){ 56 | return $this->plugin; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /MemoryFullRestarter/bin/MemoryFullRestarter.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/MemoryFullRestarter/bin/MemoryFullRestarter.phar -------------------------------------------------------------------------------- /MemoryFullRestarter/bin/README.md: -------------------------------------------------------------------------------- 1 | MemoryFullRestarter/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. 4 | -------------------------------------------------------------------------------- /MemoryFullRestarter/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: MemoryFullRestarter 3 | author: PEMapModder 4 | version: 1.0#009 5 | api: 6 | - 2.0.0 7 | main: memfullrestart\MemFullRestarter 8 | ... 9 | -------------------------------------------------------------------------------- /MemoryFullRestarter/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | limit: 1280M 3 | mysql: true 4 | host: 127.0.0.1 5 | user: root 6 | pass: "" 7 | schema: "mfr" 8 | port: 3306 9 | serverid: 1 10 | ... 11 | -------------------------------------------------------------------------------- /MemoryFullRestarter/src/memfullrestart/CheckMemoryTask.php: -------------------------------------------------------------------------------- 1 | cancelled > 0){ 13 | return; 14 | } 15 | /** @var MemFullRestarter $main */ 16 | $main = $this->owner; 17 | if($main->mysqli !== null){ 18 | $sid = $main->getConfig()->get("serverid"); 19 | $main->mysqli->query("UPDATE lastping SET timestamp=unix_timestamp() WHERE serverid=$sid"); 20 | } 21 | $mem = memory_get_usage(true); 22 | if($main->mem <= $mem){ 23 | $main->getServer()->broadcastMessage("Server is overloaded! Restarting server in 5 seconds..."); 24 | $main->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "stop"]), 100); 25 | $main->getServer()->getScheduler()->cancelTask($this->getTaskId()); 26 | } 27 | } 28 | 29 | public function stop(){ 30 | foreach($this->owner->getServer()->getOnlinePlayers() as $p){ 31 | $p->close("Server restarted due to memory overloaded."); 32 | } 33 | $this->owner->getServer()->shutdown(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /MemoryFullRestarter/src/memfullrestart/MemFullRestarter.php: -------------------------------------------------------------------------------- 1 | saveDefaultConfig(); 14 | $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new CheckMemoryTask($this), 600, 600); 15 | $config = $this->getConfig(); 16 | $this->mem = self::return_bytes($config->get("limit")); 17 | if($config->get("mysql")){ 18 | $this->mysqli = new \mysqli($config->get("host"), $config->get("user"), $config->get("pass"), $config->get("schema"), $config->get("port")); 19 | $this->mysqli->query("CREATE TABLE IF NOT EXISTS lastping (serverid INT NOT NULL, pid VARCHAR(30) NOT NULL, timestamp INT NOT NULL)"); 20 | $this->getLogger()->info("Refreshing lastping status"); 21 | $serverid = $config->get("serverid"); 22 | $this->mysqli->query("INSERT INTO lastping (serverid, pid, timestamp) VALUES ($serverid, '0', 0) ON DUPLICATE KEY UPDATE pid='0',timestamp=0"); 23 | } 24 | } 25 | 26 | public function onDisable(){ 27 | $mysql = $this->mysqli; 28 | if($mysql !== null){ 29 | $config = $this->getConfig(); 30 | $serverid = $config->get("serverid"); 31 | $pid = getmypid(); 32 | $this->getLogger()->notice("Declaring server stop"); 33 | $mysql->query("UPDATE lastping SET pid=$pid,timestamp=unix_timestamp() WHERE serverid=$serverid"); 34 | } 35 | } 36 | 37 | /** 38 | * @param string $val 39 | * 40 | * @return int 41 | */ 42 | public static function return_bytes($val){ 43 | $val = trim($val); 44 | $value = (int) $val; 45 | switch(strtolower(substr($val, -1))){ 46 | /** @noinspection PhpMissingBreakStatementInspection */ 47 | case "g": 48 | $value *= 1024; 49 | /** @noinspection PhpMissingBreakStatementInspection */ 50 | case "m": 51 | $value *= 1024; 52 | case "k": 53 | $value *= 1024; 54 | break; 55 | } 56 | return $value; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Mist/plugin.yml: -------------------------------------------------------------------------------- 1 | name: Mist 2 | description: Create "Mist" for players who use anti-invisibility mod by obfuscating their vision with random invisible players 3 | api: [2.0.0] 4 | version: 1.0.0 5 | author: PEMapModder 6 | main: pemapmodder\mist\MistPlugin 7 | -------------------------------------------------------------------------------- /Mist/src/pemapmodder/mist/Mist.php: -------------------------------------------------------------------------------- 1 | player = $player; 28 | $this->count = $count; 29 | } 30 | 31 | public function init(){ 32 | for($i = 0; $i < $this->count; $i++){ 33 | $this->specters[$i] = new MistySpecter($this->player); 34 | } 35 | } 36 | 37 | public function tick(){ 38 | } 39 | 40 | /** 41 | * @return Player 42 | */ 43 | public function getPlayer(){ 44 | return $this->player; 45 | } 46 | 47 | /** 48 | * @return mixed 49 | */ 50 | public function getCount(){ 51 | return $this->count; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Mist/src/pemapmodder/mist/MistPlugin.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 14 | } 15 | 16 | /** 17 | * @return NailedKeyboard 18 | */ 19 | public function getPlugin(){ 20 | return $this->plugin; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /NameCorrector/README.md: -------------------------------------------------------------------------------- 1 | NameCorrector 2 | === 3 | > Let the whole world join, whatever names they use 4 | 5 | NameCorrector is a plugin that makes sure people with any usernames in their MCPE settings can join. **But NameCorrector would change their names to do so.** 6 | 7 | PocketMine uses a rule inherited from "Minecraft Server" by Mojang to force player names be a text of 3 to 16 characters of `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_`. Yet, some players are not aware of it. This plugin ~~helps~~ forces them to be aware of that without kicking them. It simply changes their names. 8 | 9 | By default configuration, this plugin will: 10 | * Replace all accent characters (they are disallowed) and other Latin-alphabet-based/alike characters into their original/similar Latin character. 11 | * Replace other invalid characters and multibyte characters (given that the `multibyte` extension exists on your server). 12 | * Truncate usernames longer than 16 characters into 16 characters long. 13 | * Add padding underscores behind the username until it is 3 characters long. 14 | 15 | You can modify these settings in `config.yml`. Read the comments inside `config.yml` generated by the plugin for more details. **Remember to let your app open config.yml with _UTF-8_** (instead of other encoding like _ANSI_)! 16 | 17 | The development build of the plugin can be downloaded from [GitHub](bin/NameCorrector.phar). 18 | 19 | You can also view the `config.yml` default file on [GitHub](resources/config.yml) (although it may not be of the version you are using). 20 | 21 | Please report bugs to this plugin's [issue tracker](https://github.com/PEMapModder/Small-ZC-Plugins/issues). 22 | 23 | Public API 24 | === 25 | This plugin provides a public API function: 26 | 27 | ```c 28 | public string \NameCorrector\NameCorrector::correctName(string name); 29 | ``` 30 | 31 | Example: 32 | 33 | ```php 34 | /** @var \pocketmine\Server $server the PocketMine Server instance, often retrieved using $this->getServer() in plugin main classes */ 35 | /** @var string $old the uncorrected name */ 36 | $nameCorrector = $server->getPluginManager()->getPlugin("NameCorrector"); 37 | if($nameCorrector instanceof \NameCorrector\NameCorrector and $nameCorrector->isEnabled()){ 38 | $new = $nameCorrector->correctName($old); 39 | // TODO handle success: the corrected version of $old is now stored in $new 40 | }else{ 41 | // TODO handle error: NameCorrector is not enabled 42 | } 43 | ``` 44 | -------------------------------------------------------------------------------- /NameCorrector/bin/NameCorrector.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/NameCorrector/bin/NameCorrector.phar -------------------------------------------------------------------------------- /NameCorrector/bin/README.md: -------------------------------------------------------------------------------- 1 | NameCorrector/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. 4 | -------------------------------------------------------------------------------- /NameCorrector/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: NameCorrector 3 | version: 1.0.0#build011 4 | api: 5 | - 1.8.0 6 | - 2.0.0 7 | main: PEMapModder\NameCorrector\NameCorrector 8 | author: PEMapModder 9 | ... 10 | -------------------------------------------------------------------------------- /NameCorrector/resources/config.yml: -------------------------------------------------------------------------------- 1 | # IMPORTANT: View/Edit this file with the encoding "UTF-8", or strange errors may occur!!! 2 | 3 | # DEFINITION OF TERMS 4 | # "String": a text of one or more of any characters, including normal ones (those in ASCII) and multibyte ones (like Chinese chracters). The encoding for all characters in this file are assumed as UTF-8. 5 | # "StdChar" means ONE character that is allowed in PocketMine player names. It must be a capital Latin alphabet (A to Z), a small Latin alphabet (a to z), an Arabian number digit (0 to 9) or an underscore (_). 6 | # "StdString" means a text of one or more characters that are StdChar's. 7 | 8 | # convert String into StdChar/nothing 9 | specials: 10 | # from: a String to convert from, or an array of String's to convert from 11 | - from: "!" 12 | # to: a StdChar to convert into, or put "" if you want to delete it 13 | to: "1" 14 | - from: ["À", "Á", "Â", "Ã", "ã", "Ä", "Å", "Æ"] 15 | to: "A" 16 | - from: ["à", "á", "â", "ã", "ä", "å", "æ"] 17 | to: "a" 18 | - from: "ß" 19 | to: "B" # or should this be S? 20 | - from: ["Ç", "€", "©"] 21 | to: "C" 22 | - from: "c" 23 | to: "c" 24 | - from: "Ð" 25 | to: "D" 26 | - from: "ð" 27 | to: "d" 28 | - from: ["È", "É","Ê", "Ë"] 29 | to: "E" 30 | - from: ["è", "é", "ê", "ë"] 31 | to: "e" 32 | - from: "ƒ" 33 | to: "f" 34 | - from: ["Ì", "Í", "Î", "Ï"] 35 | to: "I" 36 | - from: ["ì", "í", "î", "ï"] 37 | to: "i" 38 | - from: "Ñ" 39 | to: "N" 40 | - from: "ñ" 41 | to: "n" 42 | - from: ["Ò", "Ó", "Ô", "Õ", "Ö", "Ø"] 43 | to: "O" 44 | - from: ["ò", "ó", "ô", "õ", "ö", "ø"] 45 | to: "o" 46 | - from: "®" 47 | to: "R" 48 | - from: ["§", "Š"] 49 | to: "S" 50 | - from: "š" 51 | to: "s" 52 | - from: ["Ù", "Ú", "Û", "Ü"] 53 | to: "U" 54 | - from: ["ù", "ú", "û", "ü", "µ"] 55 | to: "u" 56 | - from: ["Ý", "Ÿ"] 57 | to: "Y" 58 | - from: ["ý", "ÿ"] 59 | to: "y" 60 | - from: "Ž" 61 | to: "Z" 62 | - from: "ž" 63 | to: "z" 64 | - from: "¡" 65 | to: "!" 66 | - from: "¿" 67 | to: "?" 68 | 69 | # convert other non-StdChar (multibyte or not) characters into this character, or put "" if you want to delete those characters 70 | default: "_" 71 | 72 | # If the username is longer than X characters, only leave the first X characters in the username. 73 | # What is X? 74 | # Put -1 if you want to disable this feature. 75 | truncate: 16 76 | 77 | # Add this StdChar or StdString behind the username until it is at least Y characters long, the requirement for PocketMine servers usernames. Put "" if you want to disable this feature. 78 | padding: "_" 79 | # Hence, what is Y? 80 | min: 3 81 | -------------------------------------------------------------------------------- /NameCorrector/src/PEMapModder/NameCorrector/Special.php: -------------------------------------------------------------------------------- 1 | main = $main; 28 | } 29 | 30 | public function onEnable(PluginEnableEvent $event){ 31 | $this->main->updatePerms($event->getPlugin()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /NumericRanks/src/NumericRanks/PlayerListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 30 | } 31 | 32 | /** 33 | * @param PlayerJoinEvent $event 34 | */ 35 | public function onJoin(PlayerJoinEvent $event){ 36 | $player = $event->getPlayer(); 37 | 38 | $this->plugin->setPermissions($player); 39 | } 40 | 41 | /** 42 | * @param PlayerKickEvent $event 43 | */ 44 | public function onKick(PlayerKickEvent $event){ 45 | $player = $event->getPlayer(); 46 | 47 | $this->plugin->removeAttachment($player); 48 | } 49 | 50 | /** 51 | * @param PlayerQuitEvent $event 52 | */ 53 | public function onQuit(PlayerQuitEvent $event){ 54 | $player = $event->getPlayer(); 55 | 56 | $this->plugin->removeAttachment($player); 57 | } 58 | } -------------------------------------------------------------------------------- /NumericRanks/src/NumericRanks/data/Rank.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 28 | $this->rankName = $rankName; 29 | } 30 | 31 | /** 32 | * @return mixed 33 | */ 34 | public function getData(){ 35 | return $this->plugin->getConfig()->getNested("ranks." . $this->rankName); 36 | } 37 | 38 | /** 39 | * @return mixed 40 | */ 41 | public function getName(){ 42 | return $this->rankName; 43 | } 44 | 45 | /** 46 | * @return array 47 | */ 48 | public function getPermissions(){ 49 | $perms = []; 50 | 51 | foreach($this->plugin->getRegisteredPermissions() as $perm => $index){ 52 | if($this->getRankIndex() >= $index){ 53 | $perms[$perm] = true; 54 | }else{ 55 | $perms[$perm] = false; 56 | } 57 | } 58 | 59 | return $perms; 60 | } 61 | 62 | /** 63 | * @return mixed 64 | */ 65 | public function getRankIndex(){ 66 | return $this->getData()["index"]; 67 | } 68 | 69 | /** 70 | * @return bool 71 | */ 72 | public function isDefault(){ 73 | $result = isset($this->getData()["defaultRank"]) and $this->getData()["defaultRank"] == true; 74 | 75 | return $result; 76 | } 77 | } -------------------------------------------------------------------------------- /NumericRanks/src/NumericRanks/data/User.php: -------------------------------------------------------------------------------- 1 | player = $player; 29 | $this->plugin = $plugin; 30 | } 31 | 32 | /** 33 | * @return mixed 34 | */ 35 | public function getConfig(){ 36 | return $this->plugin->getProvider()->getPlayerConfig($this->player); 37 | } 38 | 39 | /** 40 | * @return array 41 | */ 42 | public function getPermissions(){ 43 | return $this->getRank()->getPermissions(); 44 | } 45 | 46 | /** 47 | * @return IPlayer 48 | */ 49 | public function getPlayer(){ 50 | return $this->player; 51 | } 52 | 53 | /** 54 | * @return Rank 55 | */ 56 | public function getRank(){ 57 | $rankName = $this->getConfig()->getNested("rank"); 58 | $rank = $this->plugin->getRank($rankName); 59 | 60 | return $rank; 61 | } 62 | } -------------------------------------------------------------------------------- /NumericRanks/src/NumericRanks/provider/MysqlProvider.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 32 | 33 | $this->init(); 34 | } 35 | 36 | public function init(){ 37 | $config = $this->plugin->getConfig(); 38 | $host = $config->getNested("dataProvider.mysql.host", "127.0.0.1"); 39 | $user = $config->getNested("dataProvider.mysql.username", "root"); 40 | $pw = $config->getNested("dataProvider.mysql.password", ""); 41 | $db = $config->getNested("dataProvider.mysql.database", "numranks"); 42 | $port = $config->getNested("dataProvider.mysql.port", 3306); 43 | $this->db = new mysqli($host, $user, $pw, $db, $port); 44 | $this->db->query("CREATE TABLE IF NOT EXISTS numranks (name VARCHAR(32) PRIMARY KEY, rank VARCHAR(255))"); 45 | } 46 | 47 | /** 48 | * @param IPlayer $player 49 | * 50 | * @return array 51 | */ 52 | public function getPlayerConfig(IPlayer $player){ 53 | // TODO 54 | } 55 | 56 | public function setPlayer(IPlayer $player, $rank){ 57 | // TODO 58 | } 59 | 60 | public function close(){ 61 | $this->db->close(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /NumericRanks/src/NumericRanks/provider/NumRanksProvider.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 29 | 30 | $this->init(); 31 | } 32 | 33 | public function init(){ 34 | @mkdir($this->plugin->getDataFolder() . "players/", 0777, true); 35 | } 36 | 37 | /** 38 | * @param IPlayer $player 39 | * 40 | * @return Config 41 | */ 42 | public function getPlayerConfig(IPlayer $player){ 43 | $fileName = $this->plugin->getDataFolder() . "players/" . strtolower($player->getName()) . ".yml"; 44 | 45 | if(!(file_exists($fileName))){ 46 | return [ 47 | "name" => $player->getName(), 48 | "rank" => $this->plugin->getDefaultRank()->getName(), 49 | ]; 50 | } 51 | return (new Config($fileName, Config::YAML))->getAll(); 52 | } 53 | 54 | public function setPlayer(IPlayer $player, $rank){ 55 | $fileName = $this->plugin->getDataFolder() . "players/" . strtolower($player->getName()) . ".yml"; 56 | $config = new Config($fileName, Config::YAML, [ 57 | "name" => $player->getName(), 58 | "rank" => $rank, 59 | ]); 60 | $config->set("rank", $rank); 61 | $config->save(true); 62 | } 63 | 64 | public function close(){ 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /PastebinPoster/plugin.yml: -------------------------------------------------------------------------------- 1 | name: PastebinPoster 2 | version: 0.0 3 | api: [2.0.0] 4 | main: pemapmodder\pastebinposter\Main 5 | author: PEMapModder 6 | website: https://github.com/PEMapModder/Small-ZC-Plugins/tree/master/PastebinPoster 7 | commands: 8 | post: 9 | description: Posts a paste to http://pastebin.com 10 | usage: [privacy = public] 11 | permissions: 12 | pastebinposter: 13 | description: Allows using all features of PastebinPoster 14 | children: 15 | pastebinposter.post: 16 | description: Allows posting any pastes to pastebin.com 17 | children: 18 | pastebinposter.post.public: 19 | description: Allows posting public posts to pastebin.com 20 | pastebinposter.post.public: 21 | description: Allows posting public posts to pastebin.com 22 | pastebinposter.post.public: 23 | description: Allows posting public posts to pastebin.com 24 | -------------------------------------------------------------------------------- /PastebinPoster/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Please login at http://pastebin.com and find your API code at http://pastebin.com/api#1 3 | # After getting them, fill in the following values by replacing false into values inside "quotes". 4 | # You can leave username and password as false, but features may be limited if you don't enter them. 5 | # Member code can be fetched manually at http://pastebin.com/api/api_user_key.html if you feel uncomfortable to put your password into the config file. 6 | # If you leave it as non-text, PastebinPoster will fetch it when it is enabled (which will make the server lag for probably a second if it is run not at startup). 7 | # The value will then be overwritten by the value fetched. You don't need to worry about it changed. 8 | # e.g. api key: "01234567890abcdef01234567890abcdef" 9 | # e.g. username: "yourname" 10 | # e.g. password: "123456" 11 | # e.g. member code: false 12 | api key: false 13 | username: false 14 | password: false 15 | member code: false 16 | # how many milliseconds (1/1000 second) to wait for response from pastebin.com before shutting down the connection? 17 | timeout: 3000 18 | ... 19 | -------------------------------------------------------------------------------- /PastebinPoster/src/pemapmodder/pastebinposter/PostTask.php: -------------------------------------------------------------------------------- 1 | url = $url; 19 | $this->post = $post; 20 | $this->timeout = $timeout; 21 | $logger->debug("Created post task to \"$url\", posting \"$post\" with timeout of $timeout seconds."); 22 | $this->logger = $logger; 23 | } 24 | 25 | public function onRun(){ 26 | $res = curl_init($this->url); 27 | curl_setopt($res, CURLOPT_POST, true); 28 | curl_setopt($res, CURLOPT_POSTFIELDS, $this->post); 29 | curl_setopt($res, CURLOPT_RETURNTRANSFER, 1); 30 | curl_setopt($res, CURLOPT_VERBOSE, 1); 31 | curl_setopt($res, CURLOPT_NOBODY, 0); 32 | curl_setopt($res, CURLOPT_TIMEOUT_MS, $this->timeout); 33 | $this->setResult(curl_exec($res)); 34 | } 35 | 36 | public function onCompletion(Server $server){ 37 | /** @var Main $main */ 38 | $main = $server->getPluginManager()->getPlugin("PastebinPoster"); 39 | $main->onCompletion(spl_object_hash($this), $this->getResult()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /RARFix/bin/RARFix.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/RARFix/bin/RARFix.phar -------------------------------------------------------------------------------- /RARFix/bin/README.md: -------------------------------------------------------------------------------- 1 | RARFix/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. 4 | -------------------------------------------------------------------------------- /RARFix/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: RARFix 3 | version: "1.007" 4 | api: 2.0.0 5 | main: rarfix\RARFix 6 | author: PEMapModder 7 | ... 8 | -------------------------------------------------------------------------------- /RARFix/src/rarfix/RARFix.php: -------------------------------------------------------------------------------- 1 | getServer()->getPluginManager()->registerEvents($this, $this); 12 | } 13 | 14 | /** 15 | * @param EntityDamageEvent $event 16 | * 17 | * @priority LOWEST 18 | */ 19 | public function onDamage(EntityDamageEvent $event){ 20 | if($event->isApplicable(EntityDamageEvent::MODIFIER_ARMOR) and 21 | ($damage = $event->getDamage(EntityDamageEvent::MODIFIER_ARMOR)) > 0 22 | ){ 23 | $event->setDamage(-floor($event->getDamage() * 0.04 * $damage), EntityDamageEvent::MODIFIER_ARMOR); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Small-ZC-Plugins 2 | ================ 3 | 4 | A collection of PEMapModder's small ZekkouCake plugins. 5 | 6 | If a file or folder does not have copyright info, they are licensed under the GPL v2 license. 7 | 8 | 9 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/PEMapModder/small-zc-plugins/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 10 | 11 | -------------------------------------------------------------------------------- /RemoteChat/README.md: -------------------------------------------------------------------------------- 1 | RemoteChat 2 | === 3 | This plugin allows players from different servers to chat. It sends messages in a request-based form. It provides protection by adding blacklists/whitelists, 4 | 5 | This plugin will have a function API and may eventually become a protocol for "emails" between different servers. The listener server is run on a separate thread, and requests are sent from `AsyncTask`s. 6 | -------------------------------------------------------------------------------- /RemoteChat/plugin.yml: -------------------------------------------------------------------------------- 1 | name: RemoteChat 2 | version: 1.0.0 3 | api: [2.0.0] 4 | main: PEMapModder\RemoteChat\RemoteChat 5 | permissions: 6 | remotechat: 7 | description: Permission to use the RemoteChat command 8 | default: true 9 | -------------------------------------------------------------------------------- /RemoteChat/resources/Documentation.md: -------------------------------------------------------------------------------- 1 | RemoteChat Doucmentation 2 | === 3 | RemoteChat is a PocketMine-MP plugin developed by PEMapModder to faciliate chat between different servers. 4 | 5 | Protocol Doucmentation 6 | === 7 | In the query supported by PocketMine, RemoteChat injects an extra data field called `pm_remotechat` into the response (long query only). It is a human-readable string representing the port where the listener is hosted on. 8 | 9 | The listener opens a TCP server on the config-dependent port (default `44746`) to accept connections. 10 | 11 | Upon client socket opened, the sender server should send a line (terminated by `\r\n`) about the information of this connection: 12 | 13 | ``` 14 | REMOTECHAT 15 | ``` 16 | 17 | The current version is `0`. The hostname can be an IP or a hostname, such as `127.0.0.1` or `example.com`. 18 | 19 | Currently there is only one action: `PRIVMSG` - send a private message to a player on the target server. 20 | 21 | The following lines (each terminated by a `\r\n` line break) are the action-specific arguments for the action. 22 | 23 | For `PRIVMSG`: 24 | * replyTo: when replying to this request, PRIVMSG to this recipient., max 255 characters 25 | * recipient: the recipient of the request, max 255 characters 26 | * message: the actual message to send, max 16383 characters 27 | -------------------------------------------------------------------------------- /RemoteChat/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # settings of the command 3 | cmd: 4 | name: remchat 5 | aliases: 6 | - rc 7 | description: Send chat to a player from another server with RemoteChat enabled. 8 | usage-message: "/rc " 9 | # Warning: modifying this message will not change the format of the command, but only the usage message shown to the player! 10 | 11 | listener: 12 | # The port to listen to messages from. 13 | # You MUST have this port forwarded (TCP) in order to make it work! Also, this port must not be used for other uses, such as PocketMine query, RCon, HTTP servers, etc. 14 | port: 44746 15 | # You can change this value to a hostname that points to your EXTERNAL IP. If the value isn't empty and doesn't point to your IP, the target server will ignore this. If this value is empty, the target server will use your external IP instead. 16 | display-ip: "" 17 | 18 | # IPs to refuse messages to be sent from 19 | # Wildcard characters * and _ are allowed. 20 | blacklist: 21 | # Examples: 22 | # - 127.0.0.1 23 | # - *.example.com 24 | # - 192.168.*.* 25 | 26 | # If whitelist is enabled, only messages sent from servers of the same IP as any of the whitelisted IPs. 27 | # Two hostnames that point to the same IP will be considered as equal, so both hostnames and IPs are allowed here. 28 | whitelist: 29 | enabled: false 30 | ips: 31 | # Examples: 32 | # - 127.0.0.1 33 | # - example.com 34 | ... 35 | -------------------------------------------------------------------------------- /RemoteChat/src/PEMapModder/RemoteChat/PullSyncTask.php: -------------------------------------------------------------------------------- 1 | getOwner(); 11 | $main->tick(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RemoteChat/src/PEMapModder/RemoteChat/RemoteChatCommand.php: -------------------------------------------------------------------------------- 1 | main = $main; 14 | $config = $main->getConfig(); 15 | parent::__construct($config->getNested("cmd.name"), $config->getNested("cmd.description", "Send chat to a player on another server with RemoteChat enabled."), $config->getNested("cmd.usage-message"), $config->getNested("cmd.aliases", ["rc"])); 16 | } 17 | 18 | /** 19 | * @return RemoteChat 20 | */ 21 | public function getPlugin(){ 22 | return $this->main; 23 | } 24 | 25 | public function execute(CommandSender $sender, $lbl, array $args){ 26 | if(!isset($args[3])){ 27 | return false; 28 | } 29 | // TODO 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SimpleMacros/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/SimpleMacros/icon.png -------------------------------------------------------------------------------- /SimpleMacros/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: SimpleMacros 3 | author: PEMapModder 4 | description: Make macros of commands and run them in a once! 5 | main: pemapmodder\simplemacros\Main 6 | version: 1.1.0 7 | api: 8 | - 2.0.0 9 | - 3.0.0-ALPHA4 10 | website: https://github.com/PEMapModder/Small-ZC-Plugins/tree/master/SimpleMacros 11 | commands: 12 | macro: 13 | usage: /macro [name] [player] 14 | description: Start/end recording a macro, or run a macro (optionally sudoing a 15 | player) 16 | permission: simplemacros.record;simplemacros.run;simplemacros.sudo 17 | permissions: 18 | simplemacros: 19 | description: Allow using everything of SimpleMacros 20 | default: false 21 | children: 22 | simplemacros.record: 23 | description: Allow recording macros 24 | simplemacros.run: 25 | description: Allow running macros (with their own permissions) 26 | simplemacros.sudo: 27 | description: Allow sudoing other players with a macro 28 | simplemacros.sudo.op: 29 | description: "Allow sudoing other players with a macro while the target player can run all the commands in the macro, whether they already have permission to them or not. Equivalent to granting permission to use all commands on the server. May not work with subcommand permissions." 30 | default: false 31 | ... 32 | -------------------------------------------------------------------------------- /SimpleMacros/src/pemapmodder/simplemacros/RecordSession.php: -------------------------------------------------------------------------------- 1 | paused = false; 38 | $this->tee = $tee; 39 | $this->sprintf = $sprintf; 40 | } 41 | 42 | public function handle(string $line) : bool{ 43 | if($this->paused){ 44 | return false; 45 | } 46 | $this->stack[] = $line; 47 | // TODO add sprintf testing 48 | return !$this->tee; 49 | } 50 | 51 | public function save(Main $main, string $name, string $author) : bool{ 52 | return file_put_contents($main->getDataFolder() . "macros/$name.txt", 53 | "# Created " . date(DATE_ISO8601) . " by $author\n" . 54 | ($this->sprintf ? "#sprintf enabled\n" : "") . 55 | implode("\n", $this->stack) 56 | ) != false; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Spacefiller/bin/README.md: -------------------------------------------------------------------------------- 1 | Spacefiller/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. 4 | -------------------------------------------------------------------------------- /Spacefiller/bin/Spacefiller.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/Spacefiller/bin/Spacefiller.phar -------------------------------------------------------------------------------- /Spacefiller/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Spacefiller 3 | version: "1.001" 4 | api: 2.0.0 5 | description: Replaces spaces with one space. Also allows customizable Regex chat message 6 | processing. 7 | author: PEMapModder 8 | main: spacefiller\Spacefiller 9 | ... 10 | -------------------------------------------------------------------------------- /Spacefiller/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | rules: 3 | - from: /[ \t\n\r]+/ # replace matches of this regular expression 4 | to: " " # with this string ($n is accepted) 5 | # you can also add this to limit the number of occurrences replaced: 6 | # limit: 2 7 | process-priority: LOWEST # don't modify this unless you know what you are doing. This modifies the event handler's registered priority. Available options include LOWEST, LOW, NORMAL, HIGH and HIGHEST. 8 | ... 9 | -------------------------------------------------------------------------------- /Spacefiller/src/spacefiller/Rule.php: -------------------------------------------------------------------------------- 1 | from = $from; 31 | $this->to = $to; 32 | $this->limit = $limit; 33 | } 34 | 35 | public function process(&$string){ 36 | $string = preg_replace($this->from, $this->to, $string, $this->limit); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Spacefiller/src/spacefiller/Spacefiller.php: -------------------------------------------------------------------------------- 1 | saveDefaultConfig(); 33 | $this->rules = array_map(function ($config){ 34 | return new Rule($config["from"], $config["to"], isset($config["limit"]) ? $config["limit"] : -1); 35 | }, $this->getConfig()->get("rules")); 36 | $priorityString = $this->getConfig()->get("process-priority", "LOWEST"); 37 | if(defined($name = EventPriority::class . "::" . $priorityString)){ 38 | $priority = constant($name); 39 | }else{ 40 | $this->getLogger()->warning("Unknown priority $priorityString, assuming LOWEST"); 41 | $priority = EventPriority::LOWEST; 42 | } 43 | $this->getServer()->getPluginManager()->registerEvent(PlayerChatEvent::class, $this, $priority, new MethodEventExecutor("onChat"), $this, true); 44 | } 45 | 46 | public function onChat(PlayerChatEvent $event){ 47 | $msg = $event->getMessage(); 48 | foreach($this->rules as $rule){ 49 | $rule->process($msg); 50 | } 51 | $event->setMessage($msg); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ThirdPersonDiscourager/bin/README.md: -------------------------------------------------------------------------------- 1 | ThirdPersonDiscourager/bin 2 | === 3 | This directory stores a .phar build of the latest built version, but not necessarily the latest commit. 4 | -------------------------------------------------------------------------------- /ThirdPersonDiscourager/bin/ThirdPersonDiscourager.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/ThirdPersonDiscourager/bin/ThirdPersonDiscourager.phar -------------------------------------------------------------------------------- /ThirdPersonDiscourager/plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ThirdPersonDiscourager 3 | version: "1.010" 4 | api: 2.0.0 5 | author: PEMapModder 6 | main: thirdpersondiscour\ThirdPersonDiscour 7 | permissions: 8 | thirdpersondiscour: 9 | description: Allows running command /3pdc 10 | default: op 11 | commands: 12 | 3pdc: 13 | description: Discourage/Un-discourage/Check a player from using third person 14 | usage: /3pdc [.check] 15 | permission: thirdpersondiscour 16 | ... 17 | -------------------------------------------------------------------------------- /ThirdPersonDiscourager/resources/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | #Enable 3pdc for a player when he/she joins the server 3 | auto-enable: true 4 | # which discourage block type to use 5 | block-type: 6 | id: 7 7 | damage: 0 8 | # distance of the discourager block behind the player 9 | block-distance: 2 10 | ... 11 | -------------------------------------------------------------------------------- /VotifierPE/README.md: -------------------------------------------------------------------------------- 1 | VotifierPE 2 | === 3 | A PocketMine plugin that uses the Votifier protocol to listen to votes and fire vote listeners. 4 | 5 | Copyright and Credits 6 | === 7 | The main code of this software is written by PEMapModder, licensed under the GPL v2 license. 8 | 9 | This software includes phpseclib with the following copyright declaration: 10 | 11 | ``` 12 | Copyright 2007-2013 TerraFrost and other contributors 13 | http://phpseclib.sourceforge.net/ 14 | ``` 15 | 16 | This copy of phpseclib has been modified by @shoghicp, and the source of the copy is from https://github.com/shoghicp/BigBrother/tree/master/src/phpseclib 17 | 18 | This software uses the Votifier protocol but contains no code copied from it. The Votifier plugin software is licensed, but the protocol is not. 19 | -------------------------------------------------------------------------------- /VotifierPE/plugin.yml: -------------------------------------------------------------------------------- 1 | name: VotifierPe 2 | author: PEMapModder 3 | main: votifierpe\VotifierPE 4 | api: [2.0.0] 5 | -------------------------------------------------------------------------------- /VotifierPE/src/phpseclib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2007-2013 TerraFrost and other contributors 2 | http://phpseclib.sourceforge.net/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /VotifierPE/src/votifierpe/TCPListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 22 | $this->port = $port; 23 | $this->keys = $keys; 24 | $this->start(); 25 | } 26 | 27 | public function run(){ 28 | $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 29 | if(!$this->socket){ 30 | $this->plugin->getLogger()->critical("Cannot create TCP server socket!"); 31 | return; 32 | } 33 | if(!socket_bind($this->socket, "0.0.0.0", $this->port)){ 34 | $this->plugin->getLogger()->critical("Cannot bind TCP server socket to 0.0.0.0:$this->port. Is a server running on that port?"); 35 | return; 36 | } 37 | if(!socket_listen($this->socket, 5)){ 38 | $this->plugin->getLogger()->critical("Cannot listen to TCP server socket!"); 39 | return; 40 | } 41 | while($this->running){ 42 | $con = socket_accept($this->socket); 43 | socket_write($con, "VOTIFIER " . self::CURRENT_PROTOCOL_VERSION); 44 | $cipher = socket_read($con, 256); 45 | $keys = unserialize($this->keys); 46 | $rsa = new RSA; 47 | $rsa->loadKey($keys["publickey"]); 48 | $plain = $rsa->decrypt($cipher); 49 | list($vote, $service, $username, $address, $timestamp) = explode("\n", $plain); 50 | if($vote !== "VOTE"){ 51 | socket_close($con); 52 | } 53 | $array = [ 54 | "service" => $service, 55 | "username" => $username, 56 | "address" => $address, 57 | "timestamp" => $timestamp, 58 | ]; 59 | $serialized = serialize($array); 60 | $this->plugin->queue(function (VotifierPE $plugin) use ($serialized){ 61 | $plugin->onVoteReceived(unserialize($serialized)); 62 | }); 63 | socket_close($con); 64 | } 65 | socket_close($this->socket); 66 | $this->socketClosed = true; 67 | } 68 | 69 | public function stop(){ 70 | $this->running = false; 71 | } 72 | 73 | public function __destruct(){ 74 | if(!$this->socketClosed){ 75 | socket_close($this->socket); 76 | $this->socketClosed = true; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /VotifierPE/src/votifierpe/VoteListener.php: -------------------------------------------------------------------------------- 1 | vote = $vote; 16 | } 17 | 18 | public function getVote(){ 19 | return $this->vote; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /WorldEditArt/bin/README.md: -------------------------------------------------------------------------------- 1 | bin 2 | === 3 | A directory that stores compiled binaries (.phar files) of commits 4 | -------------------------------------------------------------------------------- /WorldEditArt/bin/WorldEditArt.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/WorldEditArt/bin/WorldEditArt.phar -------------------------------------------------------------------------------- /WorldEditArt/bin/WorldEditArt_dev_build.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/WorldEditArt/bin/WorldEditArt_dev_build.phar -------------------------------------------------------------------------------- /WorldEditArt/plugin_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PEMapModder/Small-ZC-Plugins/0cb4365a258d315c6ed024851fb9efe67b92d375/WorldEditArt/plugin_icon.png -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/events/AnchorChangeEvent.php: -------------------------------------------------------------------------------- 1 | player = $player; 19 | $this->anchor = clone $anchor; 20 | } 21 | 22 | /** 23 | * @return Player 24 | */ 25 | public function getPlayer(){ 26 | return $this->player; 27 | } 28 | 29 | /** 30 | * @return Position 31 | */ 32 | public function getAnchor(){ 33 | return $this->anchor; 34 | } 35 | 36 | /** 37 | * @param Position $anchor 38 | */ 39 | public function setAnchor($anchor){ 40 | $this->anchor = $anchor; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/events/CancellableWorldEditArtEvent.php: -------------------------------------------------------------------------------- 1 | cancelMessage; 16 | } 17 | 18 | /** 19 | * @param string $cancelMessage 20 | */ 21 | public function setCancelMessage($cancelMessage){ 22 | $this->cancelMessage = $cancelMessage; 23 | } 24 | 25 | public function sendCancelMessage(Player $player){ 26 | if(is_string($this->cancelMessage)){ 27 | $player->sendMessage($this->cancelMessage); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/events/SelectionChangeEvent.php: -------------------------------------------------------------------------------- 1 | selection = clone $space; 23 | $this->player = $player; 24 | } 25 | 26 | /** 27 | * @return Space|null 28 | */ 29 | public function getSelection(){ 30 | return $this->selection; 31 | } 32 | 33 | /** 34 | * @param Space|null $space 35 | */ 36 | public function setSelection($space){ 37 | $this->selection = $space; 38 | } 39 | 40 | /** 41 | * @return Player 42 | */ 43 | public function getPlayer(){ 44 | return $this->player; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/events/WorldEditArtEvent.php: -------------------------------------------------------------------------------- 1 | main = $main; 13 | } 14 | 15 | public function getPlugin(){ 16 | return $this->main; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/events/space/SpaceEvent.php: -------------------------------------------------------------------------------- 1 | space = $space; 17 | $this->player = $player; 18 | } 19 | 20 | /** 21 | * @return Space 22 | */ 23 | public function getSpace(){ 24 | return $this->space; 25 | } 26 | 27 | /** 28 | * @return Player 29 | */ 30 | public function getPlayer(){ 31 | return $this->player; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/events/space/SpaceReplaceEvent.php: -------------------------------------------------------------------------------- 1 | from = $from; 20 | $this->to = $to; 21 | } 22 | 23 | /** 24 | * @return \pocketmine\block\Block[] 25 | */ 26 | public function &getFrom(){ 27 | return $this->from; 28 | } 29 | 30 | /** 31 | * @param \pocketmine\block\Block[] $from 32 | */ 33 | public function setFrom($from){ 34 | $this->from = $from; 35 | } 36 | 37 | /** 38 | * @return \pemapmodder\worldeditart\utils\spaces\BlockList 39 | */ 40 | public function getTo(){ 41 | return $this->to; 42 | } 43 | 44 | /** 45 | * @param \pemapmodder\worldeditart\utils\spaces\BlockList $to 46 | */ 47 | public function setTo($to){ 48 | $this->to = $to; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/events/space/SpaceSetEvent.php: -------------------------------------------------------------------------------- 1 | blocks = $blocks; 18 | } 19 | 20 | /** 21 | * @return BlockList 22 | */ 23 | public function getBlocks(){ 24 | return $this->blocks; 25 | } 26 | 27 | /** 28 | * @param BlockList $blocks 29 | */ 30 | public function setBlocks($blocks){ 31 | $this->blocks = $blocks; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/tasks/GarbageCollectionTask.php: -------------------------------------------------------------------------------- 1 | cached = $cached; 18 | $this->expiry = $main->getConfig()->get("data providers")["cache time"]; 19 | } 20 | 21 | public function onRun($ticks){ 22 | $this->cached->collectGarbage($this->expiry); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/tasks/UndoTestTask.php: -------------------------------------------------------------------------------- 1 | space = clone $space; 16 | } 17 | 18 | public function onRun($ticks){ 19 | // $this->space->undoLastTest(); 20 | } 21 | 22 | public function onCancel(){ 23 | $this->onRun(0); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/StringWriter.php: -------------------------------------------------------------------------------- 1 | buffer .= $str; 12 | } 13 | 14 | public function appendBString($str){ 15 | $this->buffer .= chr(strlen($str)); 16 | $this->buffer .= $str; 17 | } 18 | 19 | public function appendSString($str){ 20 | $this->appendShort(strlen($str)); 21 | $this->buffer .= $str; 22 | } 23 | 24 | public function appendTString($str){ 25 | $this->appendTriad(strlen($str)); 26 | $this->buffer .= $str; 27 | } 28 | 29 | public function appendIString($str){ 30 | $this->appendInt(strlen($str)); 31 | $this->buffer .= $str; 32 | } 33 | 34 | public function appendLString($str){ 35 | $this->appendLong(strlen($str)); 36 | $this->buffer .= $str; 37 | } 38 | 39 | public function appendByte($v){ 40 | $this->buffer .= chr($v); 41 | } 42 | 43 | public function appendShort($v){ 44 | $this->buffer .= Binary::writeShort($v); 45 | } 46 | 47 | public function appendTriad($v){ 48 | $this->buffer .= Binary::writeTriad($v); 49 | } 50 | 51 | public function appendInt($v){ 52 | $this->buffer .= Binary::writeInt($v); 53 | } 54 | 55 | public function appendLong($v){ 56 | $this->buffer .= Binary::writeLong($v); 57 | } 58 | 59 | public function appendFloat($v){ 60 | $this->buffer .= Binary::writeFloat($v); 61 | } 62 | 63 | public function appendDouble($v){ 64 | $this->buffer .= Binary::writeDouble($v); 65 | } 66 | 67 | public function save($file, $mode = "wb"){ 68 | @mkdir(dirname($file), 0777, true); 69 | $res = fopen($file, $mode); 70 | if(!is_resource($res)){ 71 | return false; 72 | } 73 | fwrite($res, $this->buffer); 74 | fclose($res); 75 | $this->clear(); 76 | return true; 77 | } 78 | 79 | public function clear(){ 80 | $this->buffer = ""; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/clip/Clip.php: -------------------------------------------------------------------------------- 1 | name = $name; 24 | $this->creationTime = microtime(true); 25 | if($blocks instanceof Space){ 26 | $anchor = $anchor->round(); 27 | foreach($blocks->getBlockList() as $b){ 28 | $this->add($b->subtract($anchor), $b); 29 | } 30 | }else{ 31 | $this->blocks = $blocks; 32 | } 33 | } 34 | 35 | public function add(Vector3 $vectors, Block $block){ 36 | $this->blocks[self::key($vectors)] = $block; 37 | } 38 | 39 | public static function key(Vector3 $v){ 40 | $v = $v->floor(); 41 | return $v->x . self::KEY_SEPARATOR . $v->y . self::KEY_SEPARATOR . $v->z; 42 | } 43 | 44 | public static function unkey($string){ 45 | $tokens = explode(self::KEY_SEPARATOR, $string); 46 | return new Vector3((int) $tokens[0], (int) $tokens[1], (int) $tokens[2]); 47 | } 48 | 49 | public function paste(Position $anchor){ 50 | foreach($this->blocks as $keyed => $block){ 51 | $anchor->getLevel()->setBlock(self::unkey($keyed)->add($anchor), $block, false, false); 52 | } 53 | } 54 | 55 | /** 56 | * @return string 57 | */ 58 | public function getName(){ 59 | return $this->name; 60 | } 61 | 62 | /** 63 | * @return Block[] 64 | */ 65 | public function getBlocks(){ 66 | return $this->blocks; 67 | } 68 | 69 | /** 70 | * @return float 71 | */ 72 | public function getCreationTime(){ 73 | return $this->creationTime; 74 | } 75 | 76 | public function __toString(){ 77 | return $this->name; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/macro/MacroOperationTask.php: -------------------------------------------------------------------------------- 1 | op = $op; 18 | $this->anchor = $anchor; 19 | } 20 | 21 | public function onRun($ticks){ 22 | $this->op->operate($this->anchor); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/Cache.php: -------------------------------------------------------------------------------- 1 | path = $main->getDataFolder() . $args["path"]; 16 | } 17 | 18 | public function getPath($name){ 19 | return str_replace("", strtolower($name), $this->path); 20 | } 21 | 22 | public function getClip($name){ 23 | $path = $this->getPath($name); 24 | if(!is_file($path)){ 25 | return null; 26 | } 27 | try{ 28 | $reader = StringReader::fromFile($path); 29 | }catch(\Exception $e){ 30 | $this->getMain()->getLogger()->error("Error parsing global clip $name: " . $e->getMessage()); 31 | return null; 32 | } 33 | $clip = self::parse($reader); 34 | return $clip; 35 | } 36 | 37 | public static function parse(StringReader $reader){ 38 | $name = $reader->readBString(); 39 | $length = $reader->readLong(false); 40 | $blocks = []; 41 | for($i = 0; $i < $length; $i++){ 42 | if($reader->feof()){ 43 | throw new \Exception("Unexpected end of file"); 44 | } 45 | $x = $reader->readInt(); 46 | $y = $reader->readShort(); 47 | $z = $reader->readInt(); 48 | $v = new Vector3($x, $y, $z); 49 | $blocks[Clip::key($v)] = Block::get($reader->readByte(false), $reader->readByte(false)); 50 | } 51 | return new Clip($blocks, null, $name); 52 | } 53 | 54 | public function setClip($name, Clip $clip){ 55 | $writer = new StringWriter; 56 | $this->emit($writer, $clip); 57 | $writer->save($this->getPath($name)); 58 | } 59 | 60 | public static function emit(StringWriter $writer, Clip $clip){ 61 | $writer->appendBString($clip->getName()); 62 | $writer->appendLong(count($clip->getBlocks())); 63 | foreach($clip->getBlocks() as $key => $block){ 64 | $v = Clip::unkey($key); 65 | $writer->appendInt($v->x); 66 | $writer->appendShort($v->y); 67 | $writer->appendInt($v->z); 68 | $writer->appendByte($block->getID()); 69 | $writer->appendByte($block->getDamage()); 70 | } 71 | } 72 | 73 | public function deleteClip($name){ 74 | @unlink($this->getPath($name)); 75 | } 76 | 77 | public function getName(){ 78 | return "Binary Clipboard Provider"; 79 | } 80 | 81 | public function isAvailable(){ 82 | return true; 83 | } 84 | 85 | public function close(){ 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/clip/CachedClipboardProvider.php: -------------------------------------------------------------------------------- 1 | initGC(); 17 | } 18 | 19 | protected function initGC(){ 20 | $this->getMain()->getServer()->getScheduler()->scheduleDelayedRepeatingTask( 21 | new GarbageCollectionTask($this->getMain(), $this), 1200, 200); 22 | } 23 | 24 | public function offsetExists($name){ 25 | $name = strtolower($name); 26 | if(isset($this->caches[$name])){ 27 | return true; 28 | } 29 | $clip = $this->getClip($name); 30 | if($clip instanceof Clip){ 31 | $this->caches[$name] = $clip; 32 | return true; 33 | } 34 | return false; 35 | } 36 | 37 | public function offsetGet($name){ 38 | $name = strtolower($name); 39 | if($this->offsetExists($name)){ 40 | return $this->caches[$name]; 41 | } 42 | return null; 43 | } 44 | 45 | public function offsetSet($name, $value){ 46 | $name = strtolower($name); 47 | if(!($value instanceof Clip)){ 48 | throw new \InvalidArgumentException("Trying to set clipboard value to non-clip"); 49 | } 50 | $this->caches[$name] = $value; 51 | $this->setClip($name, $value); 52 | } 53 | 54 | public function offsetUnset($name){ 55 | $name = strtolower($name); 56 | if(isset($this->caches[$name])){ 57 | unset($this->caches[$name]); 58 | } 59 | $this->deleteClip($name); 60 | } 61 | 62 | /** 63 | * @param $name 64 | * 65 | * @return Clip|null 66 | */ 67 | public abstract function getClip($name); 68 | 69 | /** 70 | * @param $name 71 | * @param Clip $clip 72 | */ 73 | public abstract function setClip($name, Clip $clip); 74 | 75 | /** 76 | * @param $name 77 | */ 78 | public abstract function deleteClip($name); 79 | 80 | public function collectGarbage($expiryTime){ 81 | foreach($this->caches as $name => $clip){ 82 | if(microtime(true) - $clip->getCreationTime() > $expiryTime){ 83 | unset($this->caches[$name]); 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/clip/ClipboardProvider.php: -------------------------------------------------------------------------------- 1 | main = $main; 13 | } 14 | 15 | /** 16 | * @return WorldEditArt 17 | */ 18 | public function getMain(){ 19 | return $this->main; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/clip/DummyClipboardProvider.php: -------------------------------------------------------------------------------- 1 | query("CREATE TABLE IF NOT EXISTS clipboard_blocks ( 17 | name VARCHAR(64), 18 | x BIGINT SIGNED, 19 | y SMALLINT SIGNED, 20 | z BIGINT SIGNED, 21 | id TINYINT UNSIGNED, 22 | damage TINYINT 23 | );"); 24 | $this->db = $db; 25 | } 26 | 27 | public function getClip($name){ 28 | $result = $this->db->query("SELECT * FROM clipboard_blocks WHERE name = '{$this->db->escape_string($name)}';"); 29 | $blocks = []; 30 | while(is_array($data = $result->fetch_assoc())){ 31 | $blocks[Clip::key(new Vector3($data["x"], $data["y"], $data["z"]))] = Block::get($data["id"], $data["damage"]); 32 | $rname = $data["name"]; // restore the cases 33 | 34 | } 35 | $result->close(); 36 | if(!isset($rname)){ 37 | return null; 38 | } 39 | $clip = new Clip($blocks, null, $rname); 40 | return $clip; 41 | } 42 | 43 | public function setClip($name, Clip $clip){ 44 | if(strlen($name) >= 64){ 45 | throw new \InvalidArgumentException("Clip names must not exceed 64 characters!"); // This exception will be caught at SubcommandMap.php 46 | } 47 | $blocks = $clip->getBlocks(); 48 | $this->deleteClip($name); 49 | foreach($blocks as $keyed => $block){ 50 | $unkeyed = Clip::unkey($keyed); 51 | $this->db->query("INSERT INTO clipboard_blocks VALUES ( 52 | '{$this->db->escape_string($clip->getName())}', 53 | {$unkeyed->x}, 54 | {$unkeyed->y}, 55 | {$unkeyed->z}, 56 | {$block->getID()}, 57 | {$block->getDamage()} 58 | );"); 59 | } 60 | } 61 | 62 | public function deleteClip($name){ 63 | $this->db->query("DELETE FROM clipboard_blocks WHERE name = '{$this->db->escape_string($name)}';"); 64 | } 65 | 66 | public function isAvailable(){ 67 | return $this->db->ping(); 68 | } 69 | 70 | public function close(){ 71 | $this->db->close(); 72 | } 73 | 74 | public function getName(){ 75 | return "MySQLi Clipboard Provider"; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/macro/CachedMacroDataProvider.php: -------------------------------------------------------------------------------- 1 | initGC(); 17 | } 18 | 19 | protected function initGC(){ 20 | $this->getMain()->getServer()->getScheduler()->scheduleDelayedRepeatingTask( 21 | new GarbageCollectionTask($this->getMain(), $this), 1200, 200); 22 | } 23 | 24 | public function offsetExists($name){ 25 | $name = strtolower($name); 26 | if(isset($this->caches[$name])){ 27 | return true; 28 | } 29 | $macro = $this->readMacro($name); 30 | if($macro instanceof Macro){ 31 | $this->caches[$name] = $macro; 32 | return true; 33 | } 34 | return false; 35 | } 36 | 37 | public function offsetGet($name){ 38 | $name = strtolower($name); 39 | if($this->offsetExists($name)){ 40 | return $this->caches[$name]; 41 | } 42 | return null; 43 | } 44 | 45 | public function offsetSet($name, $value){ 46 | $name = strtolower($name); 47 | if(!($value instanceof Macro)){ 48 | throw new \InvalidArgumentException("Trying to set macro data provider value to non-macro"); 49 | } 50 | if(!$value->isAppendable()){ 51 | throw new \BadMethodCallException("Trying to save non-appendable macro '$name' into macro data provider"); 52 | } 53 | $this->caches[$name] = $value; 54 | $this->saveMacro($name, $value); 55 | } 56 | 57 | public function offsetUnset($name){ 58 | $name = strtolower($name); 59 | if(isset($this->caches[$name])){ 60 | unset($this->caches[$name]); 61 | } 62 | $this->deleteMacro($name); 63 | } 64 | 65 | /** 66 | * @param $name 67 | * 68 | * @return Macro|null 69 | */ 70 | public abstract function readMacro($name); 71 | 72 | /** 73 | * @param $name 74 | * @param Macro $macro 75 | */ 76 | public abstract function saveMacro($name, Macro $macro); 77 | 78 | /** 79 | * @param $name 80 | */ 81 | public abstract function deleteMacro($name); 82 | 83 | public function collectGarbage($expiryTime){ 84 | foreach($this->caches as $name => $macro){ 85 | if(microtime(true) - $macro->getCreationTime() > $expiryTime){ 86 | unset($this->caches[$name]); 87 | } 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/macro/DummyMacroDataProvider.php: -------------------------------------------------------------------------------- 1 | main = $main; 13 | } 14 | 15 | /** 16 | * @return WorldEditArt 17 | */ 18 | public function getMain(){ 19 | return $this->main; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/DummyPlayerDataProvider.php: -------------------------------------------------------------------------------- 1 | getMain(), $name); 8 | } 9 | 10 | public function offsetSet($name, $data){ 11 | } 12 | 13 | public function offsetUnset($name){ 14 | } 15 | 16 | public function getName(){ 17 | return "Dummy Player Data Provider"; 18 | } 19 | 20 | public function isAvailable(){ 21 | // return false; 22 | return true; 23 | } 24 | 25 | public function close(){ 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/FilePlayerDataProvider.php: -------------------------------------------------------------------------------- 1 | path = $path; 13 | } 14 | 15 | public function getPath($name){ 16 | $file = str_replace("", strtolower($name), $this->path); 17 | @mkdir(dirname($file), 0777, true); 18 | return $file; 19 | } 20 | 21 | public function isAvailable(){ 22 | return true; 23 | } 24 | 25 | public function close(){ 26 | } 27 | 28 | public function offsetGet($name){ 29 | if(is_file($this->getPath($name))){ 30 | $data = $this->parseFile($this->getPath($name)); 31 | $config = $this->getMain()->getConfig(); 32 | $wand = new SelectedTool($data["wand-id"], $data["wand-damage"], $config->get("wand-id"), $config->get("wand-damage")); 33 | $jump = new SelectedTool($data["jump-id"], $data["jump-damage"], $config->get("jump-id"), $config->get("jump-damage")); 34 | return new PlayerData($name, $name, $wand, $jump); 35 | } 36 | return new PlayerData($this->getMain(), $name); 37 | } 38 | 39 | public function offsetSet($name, $data){ 40 | if(!($data instanceof PlayerData)){ 41 | throw new \InvalidArgumentException("Player data passed to FilePlayerDataProvider must be instance of PlayerData, " . 42 | (is_object($data) ? get_class($data) : gettype($data)) . " given"); 43 | } 44 | $this->emitFile($this->getPath($name), [ 45 | "wand-id" => $data->getWand()->getRawID(), 46 | "wand-damage" => $data->getWand()->getRawDamage(), 47 | "jump-id" => $data->getJump()->getRawID(), 48 | "jump-damage" => $data->getJump()->getRawDamage(), 49 | ]); 50 | } 51 | 52 | public function offsetUnset($name){ 53 | @unlink($this->getPath($name)); 54 | } 55 | 56 | protected abstract function parseFile($file); 57 | 58 | protected abstract function emitFile($file, $data); 59 | } 60 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/JSONFilePlayerDataProvider.php: -------------------------------------------------------------------------------- 1 | getMain()->getConfig()->get("data providers")["player"]["json"]["pretty print"] ? 13 | JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING : JSON_BIGINT_AS_STRING)); 14 | } 15 | 16 | public function parseFile($file){ 17 | return json_decode(file_get_contents($file)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/MysqliPlayerDataProvider.php: -------------------------------------------------------------------------------- 1 | db = $db; 14 | $this->db->query("CREATE TABLE IF NOT EXISTS selected_tools ( 15 | player VARCHAR(32), 16 | tool_id TINYINT, 17 | item_id_type TINYINT, 18 | item_id_value SMALLINT, 19 | item_damage_type TINYINT, 20 | item_damage_value SMALLINT 21 | );"); 22 | } 23 | 24 | protected function deletePlayerName($name){ 25 | $this->db->query("DELETE FROM players WHERE name = '{$this->db->escape_string($name)}';"); 26 | } 27 | 28 | protected function insertTool($name, $id, $it, $iv, $dt, $dv){ 29 | $name = $this->escape($name); 30 | $this->db->query("DELETE FROM selected_tools WHERE player = $name and tool_id = $id;"); 31 | $this->db->query("INSERT INTO selected_tools VALUES ($name, $id, $it, $iv, $dt, $dv);"); 32 | } 33 | 34 | protected function escape($str){ 35 | return "'{$this->db->escape_string($str)}'"; 36 | } 37 | 38 | public function close(){ 39 | $this->db->close(); 40 | } 41 | 42 | public function isAvailable(){ 43 | return $this->db->ping(); 44 | } 45 | 46 | protected function fetchPlayer($name){ 47 | $result = $this->db->query("SELECT * FROM selected_tools WHERE player = {$this->escape($name)};"); 48 | $data = []; 49 | while(is_array($dat = $result->fetch_assoc())){ 50 | $data[] = $dat; 51 | } 52 | return $data; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/PlayerData.php: -------------------------------------------------------------------------------- 1 | getConfig(); 21 | if($wand === null){ 22 | $wand = new SelectedTool(PlayerData::USE_DEFAULT, PlayerData::USE_DEFAULT, $config->get("wand-id"), $config->get("wand-damage")); 23 | } 24 | if($jump === null){ 25 | $jump = new SelectedTool(PlayerData::USE_DEFAULT, PlayerData::USE_DEFAULT, $config->get("jump-id"), $config->get("jump-damage")); 26 | } 27 | $this->main = $main; 28 | $this->name = $name; 29 | $this->tools = [ 30 | self::WAND => $wand, 31 | self::JUMP => $jump, 32 | ]; 33 | } 34 | 35 | public function update(){ 36 | $this->main->getPlayerDataProvider()[$this->name] = $this; 37 | } 38 | 39 | public function __toString(){ 40 | return $this->name; 41 | } 42 | 43 | /** 44 | * @return SelectedTool 45 | */ 46 | public function getWand(){ 47 | return $this->tools[self::WAND]; 48 | } 49 | 50 | /** 51 | * @param SelectedTool $wand 52 | */ 53 | public function setWand($wand){ 54 | $this->tools[self::WAND] = $wand; 55 | $this->update(); 56 | } 57 | 58 | /** 59 | * @return SelectedTool 60 | */ 61 | public function getJump(){ 62 | return $this->tools[self::JUMP]; 63 | } 64 | 65 | /** 66 | * @param $jump 67 | */ 68 | public function setJump($jump){ 69 | $this->tools[self::JUMP] = $jump; 70 | $this->update(); 71 | } 72 | 73 | public function getTool($id){ 74 | return isset($this->tools[$id]) ? $this->tools[$id] : null; 75 | } 76 | 77 | public function setTool($id, SelectedTool $tool){ 78 | $this->tools[$id] = $tool; 79 | $this->update(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/PlayerDataProvider.php: -------------------------------------------------------------------------------- 1 | main = $main; 13 | } 14 | 15 | public function offsetExists($name){ 16 | return true; 17 | } 18 | 19 | /** 20 | * @return WorldEditArt 21 | */ 22 | public function getMain(){ 23 | return $this->main; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/SQLPlayerDataProvider.php: -------------------------------------------------------------------------------- 1 | fetchPlayer($name = strtolower($name)); 26 | $wand = null; 27 | $jump = null; 28 | foreach($arrays as $arr){ 29 | $name = $arr["player"]; 30 | $tool = $arr["tool_id"]; 31 | $typedID = [$arr["item_id_type"], $arr["item_id_value"]]; 32 | $typedDamage = [$arr["item_id_type"], $arr["item_id_value"]]; 33 | $id = self::typedToMixed($typedID); 34 | $damage = self::typedToMixed($typedDamage); 35 | $c = $this->getMain()->getConfig(); 36 | switch($tool){ 37 | case PlayerData::WAND: 38 | $wand = new SelectedTool($id, $damage, $c->get("wand-id"), $c->get("wand-damage")); 39 | break; 40 | case PlayerData::JUMP: 41 | $jump = new SelectedTool($id, $damage, $c->get("jump-id"), $c->get("jump-damage")); 42 | break; 43 | } 44 | } 45 | return new PlayerData($this->getMain(), $name, $wand, $jump); 46 | } 47 | 48 | public function offsetSet($name, $data){ 49 | if(!($data instanceof PlayerData)){ 50 | throw new \InvalidArgumentException("Trying to set a player data provider element to non-PlayerData"); 51 | } 52 | $name = strtolower($name); 53 | $this->insert($name, PlayerData::WAND, $data->getWand()); 54 | $this->insert($name, PlayerData::JUMP, $data->getJump()); 55 | } 56 | 57 | private function insert($name, $id, SelectedTool $tool){ 58 | $typed = self::mixedToTyped($tool->getRawID()); 59 | $it = $typed[0]; 60 | $iv = $typed[1]; 61 | $typed = self::mixedToTyped($tool->getRawDamage()); 62 | $dt = $typed[0]; 63 | $dv = $typed[1]; 64 | $this->insertTool($name, $id, $it, $iv, $dt, $dv); 65 | } 66 | 67 | public function offsetUnset($name){ 68 | $this->deletePlayerName($name); 69 | } 70 | 71 | public function getName(){ 72 | return "SQLite3 Player Data Provider"; 73 | } 74 | 75 | public function isAvailable(){ 76 | return true; 77 | } 78 | 79 | public static function mixedToTyped($mixed){ 80 | return [ 81 | is_bool($mixed) ? ($mixed ? self::TRUE : self::FALSE) : self::INT, 82 | (int) $mixed, 83 | ]; 84 | } 85 | 86 | public static function typedToMixed(array $typed){ 87 | return $typed[0] === self::INT ? $typed[1] : ($typed[0] === self::TRUE); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/SQLite3PlayerDataProvider.php: -------------------------------------------------------------------------------- 1 | db = new \SQLite3($main->getDataFolder() . $path); 14 | $this->db->query("CREATE TABLE IF NOT EXISTS selected_tools ( 15 | player TEXT, 16 | tool_id INTEGER, 17 | item_id_type INTEGER, 18 | item_id_value INTEGER, 19 | item_damage_type INTEGER, 20 | item_damage_value INTEGER 21 | );"); 22 | } 23 | 24 | protected function deletePlayerName($name){ 25 | $op = $this->db->prepare("DELETE FROM players WHERE name = :name;"); 26 | $op->bindValue(":name", strtolower($name)); 27 | $op->execute(); 28 | } 29 | 30 | protected function insertTool($name, $id, $it, $iv, $dt, $dv){ 31 | $name = $this->escape($name); 32 | $this->db->query("DELETE FROM selected_tools WHERE player = $name and tool_id = $id;"); 33 | $this->db->query("INSERT INTO selected_tools VALUES ($name, $id, $it, $iv, $dt, $dv);"); 34 | } 35 | 36 | protected function escape($str){ 37 | return "'{$this->db->escapeString($str)}'"; 38 | } 39 | 40 | protected function fetchPlayer($name){ 41 | $result = $this->db->query("SELECT * FROM selected_tools WHERE player = {$this->escape($name)};"); 42 | $data = []; 43 | while(is_array($dat = $result->fetchArray(SQLITE3_ASSOC))){ 44 | $data[] = $dat; 45 | } 46 | return $data; 47 | } 48 | 49 | public function close(){ 50 | $this->db->close(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/SelectedTool.php: -------------------------------------------------------------------------------- 1 | 1){ 28 | foreach(func_get_args() as $arg){ 29 | if(!is_int($arg) and !is_bool($arg)){ 30 | throw new \InvalidArgumentException("Invalid arguments passed to SelectedTool constructor!"); 31 | } 32 | } 33 | } 34 | $this->id = $id; 35 | $this->damage = $damage; 36 | $this->defaultID = $defaultID; 37 | $this->defaultDamage = $defaultDamage; 38 | } 39 | 40 | public function match(Item $item){ 41 | return $this->matchRaw($this->id, $item->getID(), $this->defaultID) and $this->matchRaw($this->damage, $item->getDamage(), $this->defaultDamage); 42 | } 43 | 44 | public function matchRaw($comparator, $subject, $default){ 45 | if($comparator === PlayerData::USE_DEFAULT){ 46 | $comparator = $default; 47 | } 48 | if($comparator === PlayerData::ALLOW_ANY){ 49 | return true; 50 | } 51 | return $comparator === $subject; 52 | } 53 | 54 | public function getRawID(){ 55 | return $this->id; 56 | } 57 | 58 | public function getRawDamage(){ 59 | return $this->damage; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/provider/player/YAMLFilePlayerDataProvider.php: -------------------------------------------------------------------------------- 1 | pattern = $pattern; 16 | } 17 | 18 | /** 19 | * @return string 20 | */ 21 | public function getPattern(){ 22 | return $this->pattern; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/spaces/SelectionExceedWorldException.php: -------------------------------------------------------------------------------- 1 | block = $block; 12 | } 13 | 14 | public function getRandom(){ 15 | return $this->block; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/spaces/SphereSpace.php: -------------------------------------------------------------------------------- 1 | centre = $centre; 15 | $this->radius = $radius; 16 | $y = $centre->y; 17 | $y = [$y + $radius, $y - $radius]; 18 | $maxY = max($y); 19 | $minY = min($y); 20 | $maxHeight = 127; 21 | if(defined($path = "pemapmodder\\worldeditart\\MAX_WORLD_HEIGHT")){ 22 | $maxHeight = constant($path); // **** PhpStorm 23 | } 24 | if($maxY > $maxHeight or $minY < 0){ 25 | throw new SelectionExceedWorldException("SphereSpace"); 26 | } 27 | parent::__construct(); 28 | } 29 | 30 | public function getPosList(){ 31 | $out = []; 32 | for($x = $this->centre->getX() - $this->radius; $x <= $this->centre->getX() + $this->radius; $x++){ 33 | for($y = $this->centre->getY() - $this->radius; $y <= $this->centre->getY() + $this->radius; $x++){ 34 | for($z = $this->centre->getZ() - $this->radius; $z <= $this->centre->getZ() + $this->radius; $x++){ 35 | $v = new Position($x, $y, $z, $this->centre->getLevel()); 36 | if($v->distance($this->centre) <= $this->radius){ 37 | $out[] = $v; 38 | } 39 | } 40 | } 41 | } 42 | return $out; 43 | } 44 | 45 | public function getBlockList(){ 46 | $out = []; 47 | foreach($this->getPosList() as $pos){ 48 | $out[] = $this->centre->getLevel()->getBlock($pos); 49 | } 50 | return $out; 51 | } 52 | 53 | public function isInside(Vector3 $v){ 54 | $out = true; 55 | $out = ($out and $v->distance($this->centre) <= $this->radius); 56 | if($v instanceof Position){ 57 | $out = ($out and $v->getLevel()->getName() === $this->centre->getLevel()->getName()); 58 | } 59 | return $out; 60 | } 61 | 62 | public function getLevel(){ 63 | return $this->centre->getLevel(); 64 | } 65 | 66 | public function __toString(){ 67 | return "a sphere centered at " . WorldEditArt::posToStr($this->centre) . " of radius {$this->radius}"; 68 | } 69 | 70 | /** 71 | * @return Position 72 | */ 73 | public function getCentre(){ 74 | return $this->centre; 75 | } 76 | 77 | /** 78 | * @return number 79 | */ 80 | public function getRadius(){ 81 | return $this->radius; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/subcommand/Anchor.php: -------------------------------------------------------------------------------- 1 | getPosition(); 31 | while(isset($args[0])){ 32 | $arg = array_shift($args); 33 | switch($arg){ 34 | case "c": 35 | case "crosshair": 36 | $target = WorldEditArt::getCrosshairTarget($player); 37 | if(!($target instanceof Block)){ 38 | return "The block is too far/in the void/sky!"; 39 | } 40 | break; 41 | case "v": 42 | case "view": 43 | $mode = 1; 44 | break; 45 | } 46 | } 47 | switch($mode){ 48 | case 0: 49 | $this->getMain()->setAnchor($player, $target); 50 | return "Your anchor has been set to " . WorldEditArt::posToStr($target) . "."; 51 | case 1: 52 | $anchor = $this->getMain()->getAnchor($player); 53 | if(!($anchor instanceof Position)){ 54 | return "You don't have an anchor selected!"; 55 | } 56 | return "Your anchor is at " . WorldEditArt::posToStr($anchor) . "."; 57 | default: 58 | return null; 59 | } 60 | } 61 | 62 | public function getAliases(){ 63 | return ["anc"]; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/subcommand/Copy.php: -------------------------------------------------------------------------------- 1 | getPosition(); 30 | if(isset($args[0]) and ($args[0] === "-a" or $args[0] === "-anchor")){ 31 | $anchor = $this->getMain()->getAnchor($player); 32 | } 33 | if(!isset($args[0])){ 34 | array_unshift($args, "default"); 35 | } 36 | $clip = new Clip($space, $anchor, array_shift($args)); 37 | if(isset($args[0]) and ($args[0] === "g" or $args[0] === "global")){ 38 | $clipboard = $this->getMain()->getClipboardProvider(); 39 | $clipboard[$clip->getName()] = $clip; 40 | }else{ 41 | $this->getMain()->setClip($player, $clip, $clip->getName()); 42 | } 43 | return "Clip " . $clip->getName() . " copied."; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/subcommand/Cut.php: -------------------------------------------------------------------------------- 1 | clear(); 24 | return $result; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/subcommand/Cylinder.php: -------------------------------------------------------------------------------- 1 | [d ] [a|anchor]"; 21 | } 22 | 23 | public function checkPermission(/** @noinspection PhpUnusedParameterInspection */ 24 | Player $player){ 25 | return true; // TODO 26 | } 27 | 28 | public function onRun(array $args, Player $player){ 29 | if(!isset($args[0])){ 30 | return self::WRONG_USE; 31 | } 32 | $center = $player->floor(); 33 | $level = $player->getLevel(); 34 | $radius = floatval(array_shift($args)); 35 | $height = (int) array_shift($args); 36 | $axis = WorldEditArt::directionNumber2Array($player->getDirection()); 37 | while(count($args) > 0){ 38 | $arg = array_shift($args); 39 | switch($arg){ 40 | case "a": 41 | case "anchor": 42 | $anchor = $this->getMain()->getAnchor($player); 43 | if(!($anchor instanceof Position)){ 44 | return self::NO_ANCHOR; 45 | } 46 | $center = $anchor->floor(); 47 | break; 48 | case "d": 49 | $d = array_shift($args); 50 | switch(strtolower($d)){ 51 | case "m": 52 | case "me": 53 | break; 54 | case "u": 55 | case "up": 56 | $axis = [CylinderSpace::Y, CylinderSpace::PLUS]; 57 | break; 58 | case "d": 59 | case "down": 60 | $axis = [CylinderSpace::Y, CylinderSpace::MINUS]; 61 | break; 62 | case "l": 63 | case "left": 64 | $axis = WorldEditArt::directionNumber2Array(WorldEditArt::rotateDirectionNumberClockwise($player->getDirection(), 3)); 65 | break; 66 | case "r": 67 | case "right": 68 | $axis = WorldEditArt::directionNumber2Array(WorldEditArt::rotateDirectionNumberClockwise($player->getDirection(), 1)); 69 | break; 70 | case "b": 71 | case "back": 72 | $axis = WorldEditArt::directionNumber2Array(WorldEditArt::rotateDirectionNumberClockwise($player->getDirection(), 2)); 73 | break; 74 | } 75 | break; 76 | } 77 | } 78 | $center = Position::fromObject($center, $level); 79 | $space = new CylinderSpace($axis[0], $radius, $center, $height * $axis[1]); 80 | $this->getMain()->setSelection($player, $space); 81 | return "Your selection is now $space."; 82 | } 83 | 84 | public function getAliases(){ 85 | return ["cyl"]; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/subcommand/Desel.php: -------------------------------------------------------------------------------- 1 | getMain()->unsetSelection($player); 27 | } 28 | 29 | public function checkPermission( 30 | /** @noinspection PhpUnusedParameterInspection */ 31 | Space $space, Player $player){ 32 | return $player->hasPermission("wea.desel"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/subcommand/Paste.php: -------------------------------------------------------------------------------- 1 | hasPermission("wea.paste"); 24 | } 25 | 26 | public function onRun(array $args, Player $player){ 27 | $global = false; 28 | $anchor = $player->getPosition(); 29 | $name = isset($args[0]) ? array_shift($args) : "default"; 30 | while(isset($args[0])){ 31 | $arg = array_shift($args); 32 | switch($arg){ 33 | case "g": 34 | $global = $this->getMain()->getClipboardProvider(); 35 | break; 36 | case "a": 37 | case "anchor": 38 | $anchor = $this->getMain()->getAnchor($player); 39 | break; 40 | } 41 | } 42 | if($global instanceof ClipboardProvider){ 43 | $clip = $global[$name]; 44 | }else{ 45 | $clip = $this->getMain()->getClip($player, $name); 46 | } 47 | if(!($clip instanceof Clip)){ 48 | if($global instanceof ClipboardProvider){ 49 | return "There isn't a global clip called $name!"; 50 | }else{ 51 | return "You don't have a clip called $name!"; 52 | } 53 | } 54 | $clip->paste($anchor); 55 | return count($clip->getBlocks()) . " block(s) have been pasted."; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/subcommand/Sphere.php: -------------------------------------------------------------------------------- 1 | [a|anchor]"; 20 | } 21 | 22 | public function checkPermission(Player $player){ 23 | return $player->hasPermission("wea.sphere"); 24 | } 25 | 26 | public function onRun(array $args, Player $player){ 27 | if(!isset($args[0])){ 28 | return false; 29 | } 30 | $radius = floatval(array_shift($args)); 31 | $anchor = $player->getPosition(); 32 | while(isset($args[0])){ 33 | $arg = array_shift($args); 34 | switch($arg){ 35 | case "a": 36 | case "anchor": 37 | $anchor = $this->getMain()->getAnchor($player); 38 | if(!($anchor instanceof Position)){ 39 | return self::NO_ANCHOR; 40 | } 41 | break; 42 | } 43 | } 44 | $sel = new SphereSpace($anchor, $radius); 45 | $this->getMain()->setSelection($player, $sel); 46 | return "You have selected $sel."; 47 | } 48 | 49 | public function getAliases(){ 50 | return ["sph"]; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /WorldEditArt/src/pemapmodder/worldeditart/utils/subcommand/Test.php: -------------------------------------------------------------------------------- 1 | [from] [duration = 15]"; 24 | } 25 | 26 | public function checkPermission(Space $space, Player $player){ 27 | if($space instanceof CuboidSpace){ 28 | return $player->hasPermission("wea.test.cuboid"); 29 | } 30 | if($space instanceof CylinderSpace){ 31 | return $player->hasPermission("wea.test.cylinder"); 32 | } 33 | if($space instanceof SphereSpace){ 34 | return $player->hasPermission("wea.test.sphere"); 35 | } 36 | return $player->hasPermission("wea.test.*"); 37 | } 38 | 39 | public function onRun(array $args, Space $space, Player $player){ 40 | if(!isset($args[0])){ 41 | return self::WRONG_USE; 42 | } 43 | $name = array_shift($args); 44 | $block = BlockList::getBlockFronString($name); 45 | if($block === null){ 46 | return self::NO_BLOCK; 47 | } 48 | $duration = 300; 49 | while(isset($args[0])){ 50 | $arg = array_shift($args); 51 | if(is_numeric($arg)){ 52 | $duration = intval($arg) * 20; 53 | }else{ 54 | $replaces = BlockList::getBlockArrayFromString($arg); 55 | } 56 | } 57 | if(isset($replaces)){ 58 | $space->replaceBlocks($replaces, $block, true, $player); 59 | }else{ 60 | $space->setBlocks($block, $player); 61 | } 62 | $this->getMain()->getServer()->getScheduler()->scheduleDelayedTask(new UndoTestTask($this->getMain(), $space), $duration); 63 | return "Previewing the selection for " . ($duration / 20) . " seconds."; 64 | } 65 | } 66 | // TODO ISSUE timeout reset doesn't work 67 | -------------------------------------------------------------------------------- /compile.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | start "" _bin\mintty.exe -o AllowBlinking=0 -o FontQuality=3 -o Font="Consolas" -o FontHeight=10 -o CursorType=0 -h error -o CursorBlinks=1 -t "Compile" -w max _bin\php\php.exe compile.php -dphar.readonly=0 --enable-ansi %* 3 | --------------------------------------------------------------------------------