Smile! I hate doing the same stuff again and again for a long period of time, so do you. It would be awesome if we could share the snippets to boost our productivity a lot. Valid snippets are Gist(s) Sublime Text editor snippet file PHP classes, interfaces, traits and functions or anything that is reusable and not adjusted for individual use The format for posting snippets. Localizer (PHP Class) Easy to use language handler. (TODO: More descriptive). Instructions: Place this class anywhere inside your project. Correct the namespaces. Setup language directory. Spoiler: folder structure Code: /* * Instructions. * * Set your language folder structure like this * * languages * | * `en (language code - ru, lv, ro, sv) * | * `foo.php (the language file) * | * `bar.php (another. these will be loaded automatically) * * language files (foo & bar .php, .yaml, .json) if php, must have only one statement * which returns assoc array (key => text) */ [/SIZE] Example: Spoiler: Example PHP: /** @var Localizer */public $localizer;public function onEnable() { // Load english data files from ~/plugins/pluginName/languages/en $this->localizer = new Localizer("en", $this->getDataFolder() . "languages"); $this->getLogger()->info($this->localizer->translate('plugin.enabled'));} Spoiler: plugin.json must be placed inside ~/plugins/pluginName/languages/en Code: { "enabled": "Enabled" } Localizer.php: Spoiler: Gist Snippets can be as useful as plugins and can be anything like plugin.yml template, data providers, custom entities or custom/unimplemented packets.
However I still see snippets very useful. Obviously library won't be library with one function. Sometimes using library is redundant if you need one of many its functionalities.
Idea about library hit me hard and for about two weeks I've been creating a libraries. So far so good These are the libraries I've made so far: Dominate: PocketMine-MP Library for advanced command handling Localizer: Simple to use locale manager for PocketMine-MP I use Simple-LibLoader to load them. However it's stupid. All it does is it loads all classes from folder or phar file. Can anyone make a (not plugin) similar thing, but bit more advanced?
Exactly what I'm looking for. But I wonder if there won't be namespace conflicts if other plugin requires same library, but different version of it?