├── .gitignore ├── LICENSE.txt ├── README.md ├── doctree.js ├── en └── index.html ├── guide.css ├── highlight.pack.js ├── highlight └── rainbow.css ├── index.html └── resources └── dummy.php.res /.gitignore: -------------------------------------------------------------------------------- 1 | ### JetBrains template 2 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 3 | 4 | *.iml 5 | 6 | ## Directory-based project format: 7 | .idea/ 8 | # if you remove the above rule, at least ignore the following: 9 | 10 | # User-specific stuff: 11 | # .idea/workspace.xml 12 | # .idea/tasks.xml 13 | # .idea/dictionaries 14 | 15 | # Sensitive or high-churn files: 16 | # .idea/dataSources.ids 17 | # .idea/dataSources.xml 18 | # .idea/sqlDataSources.xml 19 | # .idea/dynamic.xml 20 | # .idea/uiDesigner.xml 21 | 22 | # Gradle: 23 | # .idea/gradle.xml 24 | # .idea/libraries 25 | 26 | # Mongo Explorer plugin: 27 | # .idea/mongoSettings.xml 28 | 29 | ## File-based project format: 30 | *.ipr 31 | *.iws 32 | 33 | ## Plugin-specific files: 34 | 35 | # IntelliJ 36 | /out/ 37 | 38 | # mpeltonen/sbt-idea plugin 39 | .idea_modules/ 40 | 41 | # JIRA plugin 42 | atlassian-ide-plugin.xml 43 | 44 | # Crashlytics plugin (for Android Studio and IntelliJ) 45 | com_crashlytics_export_strings.xml 46 | crashlytics.properties 47 | crashlytics-build.properties 48 | 49 | # Created by .ignore support plugin (hsz.mobi) 50 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | pmtut is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PocketMine Plugin Tutorials 2 | === 3 | A tutorial website for knowledge on PocketMine plugin development and on PHP closely related to it 4 | 5 | [Click to visit the webpage.](https://pemapmodder.github.io/PocketMine-Plugin-Tutorials) 6 | 7 | [Click to visit old page.](../../tree/master) 8 | 9 | There is also useful information in the [wiki](../../wiki/). 10 | 11 | Work on this website is licensed under a 12 | [Creative Commons Attribution-NonCommercial 4.0 International License](http://creativecommons.org/licenses/by-nc/4.0/). 13 | 14 | ![](https://i.creativecommons.org/l/by-nc/4.0/88x31.png) 15 | 16 | -------------------------------------------------------------------------------- /doctree.js: -------------------------------------------------------------------------------- 1 | /* 2 | * PocketMine-Plugin-Tutorials 3 | * 4 | * Copyright (C) 2015 PEMapModder 5 | * 6 | * @author PEMapModder 7 | */ 8 | 9 | var runtimeAutoId = 0; 10 | 11 | /** 12 | * Registers a new spoiler. 13 | * @param el 14 | * @returns jQuery $(div of spoiler button) 15 | */ 16 | function registerSpoiler(el){ 17 | el.addClass("spoiler"); 18 | var id = runtimeAutoId++; 19 | var onclick = 'switchSpoiler("' + id + '"); return false;'; 20 | var button = $(""); 21 | var before = $("
"); 22 | button.appendTo(before); 23 | before.append("
"); 24 | button.attr("data-spoiler-name", id); 25 | button.attr("onclick", onclick); 26 | before.insertBefore(el); 27 | el.attr("data-spoiler-name", id); 28 | el.css("display", "none"); 29 | return before; 30 | } 31 | 32 | /** 33 | * Toggles a spoiler. 34 | * @param id 35 | * @returns {boolean} true if spoiler is opened, false if spoiler is closed 36 | */ 37 | var switchSpoiler = function(id){ 38 | var el = $(".spoiler[data-spoiler-name='" + id + "']"); 39 | var opener = $(".spoiler-opener[data-spoiler-name='" + id + "']"); 40 | if(el.css("display") === "none"){ 41 | el.css("display", "block"); 42 | opener.text("Hide"); 43 | return true; 44 | } 45 | el.css("display", "none"); 46 | opener.text("Show"); 47 | return false; 48 | }; 49 | 50 | function Tree(name, id, depthClass){ 51 | this.name = name; 52 | this.id = id; 53 | this.depthClass = depthClass; 54 | this.children = {}; 55 | } 56 | Tree.prototype.addChild = function(child){ 57 | this.children[child.name] = child; 58 | }; 59 | Tree.prototype.toOlJQuery = function(){ 60 | var a = $(""); 61 | a.addClass("branch"); 62 | a.attr("data-target", this.id); 63 | a.attr("href", "#" + this.id); 64 | a.text(this.name); 65 | var out = $("
  • "); 66 | a.appendTo(out); 67 | out.addClass(this.depthClass); 68 | var $ol = $("
      "); 69 | for(var name in this.children){ 70 | if(this.children.hasOwnProperty(name)){ 71 | this.children[name].toOlJQuery().appendTo($ol); 72 | } 73 | } 74 | $ol.appendTo(out); 75 | return out; 76 | }; 77 | 78 | var tree; 79 | var trees = {}; 80 | 81 | function gotoAnchor(anchor){ 82 | var target = $("a[name='" + anchor + "']"); 83 | target.parents(".tree").each(function(){ 84 | var $this = $(this); 85 | if($this.css("display") == "none"){ 86 | switchSpoiler($this.attr("data-spoiler-name")); 87 | } 88 | }); 89 | $("html, body").animate({ 90 | scrollTop: Math.max(0, target.parent().prev().offset().top + window.innerHeight * (-0.1)) 91 | }, 200, "swing", function(){ 92 | var header = target.parent().prev(); 93 | header.css("background-color", "#B11D98"); 94 | header.animate({ 95 | backgroundColor: "#FFFFFF" 96 | }, 600); 97 | }); 98 | } 99 | 100 | var hashBlocker = 0; 101 | 102 | $(document).ready(function(){ 103 | var maxDepth = 12; 104 | var nextAnchorId = 0; 105 | $(".tree").each(function(){ 106 | var $this = $(this); 107 | var name = $this.attr("data-name"); 108 | var parents = $this.parents(".tree"); 109 | var anchorId = "anchor-auto-" + (nextAnchorId++); 110 | $this.prepend(''); 111 | var clazz = "depth-" + parents.length; 112 | if(!$this.hasClass("no-index")){ 113 | if(parents.length == 0){ 114 | var tmpTree = new Tree(name, anchorId, clazz); 115 | trees[name] = tmpTree; 116 | if(this.id === "mainTree"){ 117 | tree = tmpTree; 118 | } 119 | }else{ 120 | var $parent = $(parents[0]); 121 | var parentTree = trees[$parent.attr("data-name")]; 122 | var t; 123 | parentTree.addChild(t = new Tree(name, anchorId, clazz)); 124 | trees[name] = t; 125 | } 126 | } 127 | var depth = parents.length; 128 | maxDepth = Math.max(maxDepth, depth); 129 | var $div = registerSpoiler($this); 130 | var bef = $(""); 131 | bef.text(name + " "); 132 | var id = $div.children("button").attr("data-spoiler-name"); 133 | var onclick = 'switchSpoiler("' + id + '");'; 134 | bef.attr("onclick", onclick); 135 | bef.prependTo($div); 136 | $div.attr("data-depth", depth); 137 | $div.addClass("heading"); 138 | if(depth > 0){ 139 | $div.before("
      "); 140 | } 141 | }); 142 | $(".heading").each(function(){ 143 | var $this = $(this); 144 | var depth = $this.attr("data-depth"); 145 | $this.css("font-size", (32 - Math.floor(depth / maxDepth * 20)) + "px"); 146 | }); 147 | switchSpoiler("0"); 148 | switchSpoiler("1"); 149 | var $contents = $("#index"); 150 | $contents.append("

      Contents

      "); 151 | var ol = tree.toOlJQuery(); 152 | ol.children().each(function(){ 153 | $contents.append(this); 154 | }); 155 | $("a").click(function(){ 156 | var $this = $(this); 157 | if(typeof $this.attr("href") !== typeof undefined){ 158 | if($this.attr("href").charAt(0) === "#"){ 159 | gotoAnchor($this.attr("href").substring(1)); 160 | } 161 | } 162 | }); 163 | // $(".branch").click(function(){ 164 | // var $this = $(this); 165 | // var targetName = $this.attr("data-target"); 166 | // gotoAnchor(targetName); 167 | // }); 168 | $("#body").css("padding-bottom", $(window).height() / 3); 169 | var hasher = function(){ 170 | if(hashBlocker > 0){ 171 | setTimeout(hasher, 100); 172 | return; 173 | } 174 | var hash = window.location.hash; 175 | if(hash.charAt(0) === "#"){ 176 | gotoAnchor(hash.substring(1)); 177 | } 178 | }; 179 | setTimeout(hasher, 100); 180 | }); 181 | 182 | -------------------------------------------------------------------------------- /en/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PocketMine Plugin Tutorials 6 | 7 | 8 | 9 | 10 | 11 | 95 | 96 | 97 | 98 |
      99 |
      100 |
      101 |
      102 |
      103 |

      104 | Well, I guess, this is the 5th or 6th version of PocketMine plugin tutorials from 105 | me?
      106 | I must admit that the versions before had not been very successful, so I guess we should start all over 107 | again.
      108 | This time, I created the tutorials with GitHub sites. Hopefully more customizable pages will help make 109 | the tutorials better. 110 |

      111 | 112 |

      113 | So, first of all, let's get to know clearly what we are planning to do.
      114 | Wait, aren't we going to code PocketMine plugins? Isn't that clear enough?
      115 | Then what exactly does a PocketMine plugin do? The answer could be quite vague.
      116 | Basically, a plugin has unlimited power (including root access if you are running the server with root) 117 | on your server. It is the commander of your server. Plugins instruct PocketMine to get everything done. 118 |

      119 | 120 |

      121 | 122 | So I know that the plugin is the god. But how does knowing that help me? 123 |
      124 | The problem that made most people unable to code is that most people don't know what they want.
      125 | I know very clearly. I want to make a hunger games plugin.
      126 | But then, what is a hunger games plugin?
      127 |

      128 | 129 |
      130 |
      131 |  +-----------------+     +--------------------------+
      132 |  | Player tap sign | ==> | Teleport player to lobby | ---+
      133 |  +-----------------+     +--------------------------+    |
      134 |                                                          |      +-------------------------+
      135 |  +-----------------+     +--------------------------+    |      | Timer reached 0 second  |      +-----------------+      +---------------+      +------------------------+      +------------------------------+
      136 |  | Player tap sign | ==> | Teleport player to lobby |    + ===> +-- WHEN EITHER HAPPENS --+ ===> | Start the match | ===> | Refill chests | ===> | Timer reached 0 second | ===> | Teleport to deathmatch arena |
      137 |  +-----------------+     +--------------------------+    |      |      Enough players     |      +-----------------+      +---------------+      +------------------------+      +------------------------------+
      138 |                                                          |      +-------------------------+                               |                                                                                     |
      139 |  +-----------------+     +--------------------------+    |                                                                +-------------------------------------------------------------------------------------+
      140 |  | Player tap sign | ==> | Teleport player to lobby | ---+ ===> +-------------------+     +---------------------------------------+                              |
      141 |  +-----------------+     +--------------------------+           | When player moves | ==> | Don't let player move (teleport back) |                              |
      142 |                                                                 +-------------------+     +---------------------------------------+                              V                                            +----------------------------------+
      143 |                       。                                                                                                                                 +----------------+     +-----------------------+     | If there is just one player left |
      144 |                       。                                                                                                                                 | If player dies | ==> | Teleport him to spawn | ==> | Let that player win (add coins)  |
      145 |                       。                                                                                                                                 +----------------+     +-----------------------+     +----------------------------------+
      146 | 
      147 |  +--------------+     +------------------------+
      148 |  | Player joins | ==> | Load player statistics |
      149 |  +--------------+     +------------------------+
      150 | 
      151 |  +--------------+     +------------------------+
      152 |  | Player quits | ==> | Save player statistics |
      153 |  +--------------+     +------------------------+
      154 | 
      155 |  +---------------------------+     +------------------------+
      156 |  | Player type command /stat | ==> | Show player statistics |
      157 |  +---------------------------+     +------------------------+
      158 | 				
      159 |
      160 | 161 |

      162 | The outline for a hunger games plugin actually shows three of the most important components of plugins: 163 |

      164 |
        165 |
      1. Commands
      2. 166 |
      3. Events (when something happens)
      4. 167 |
      5. Timer
      6. 168 |
      169 |

      170 | Of course, we are nowhere near the complexity of a good hunger games plugin. But at least now we know 171 | better what we are going to do. 172 |

      173 | 174 |

      175 | In Chapters 3-5 of this website, we will go through the principles of these three 176 | components, as well as some fundamental ways of doing various actions on the server.
      177 | But before that, we would start by creating a useless plugin that works. 178 |

      179 |
      180 | 181 |
      182 |
      183 | It is hilarious for many times someone asks me to teach him/her plugin development, and after half an 184 | hour 185 | long talk of theory we decided to get our hands on getting something produced and realized that he/she 186 | did 187 | not have the necessary tools ready. Make sure you have everything in this basic checklist: 188 |
        189 |
      • A PocketMine server that you can directly change its plugin files.
        190 | For testing plugins, obviously. 191 |
      • 192 |
      • 193 | A virtual/hard keyboard that can let you type symbols like 194 | ,.;!?$/\|()[]{}. 195 |
      • 196 |
      197 | Yes, that's all. If that's all the resources you got, you could still code plugins, but with very hard 198 | time.
      199 | Here is a list of recommended tools: 200 |
        201 |
      • Text editor
        202 |
          203 |
        • Windows 204 |
            205 |
          • 206 | If you are thinking about Microsoft Word, get rid of that thought 207 | immediately. Microsoft Word is a rich text editor, and it simply cannot open nor 208 | output any text files. Same applies to WordPad that came in Windows' 209 | Accessories.
            210 |
          • 211 |
          • 212 | You may be thinking about NotePad that came in the Accessories 213 | with Windows. Well, it is the best option if you can't install anything on your 214 | computer. (But then how did you install PocketMine?) 215 |
          • 216 |
          • 217 | The recommended tool is Notepad++. It is a powerful 219 | text editor for many types of files and for different programming languages. 220 |
          • 221 |
          • 222 | Some would recommend NetBeans, but I wouldn't want you to waste time doing all 223 | the setup stuff. Believe me, setup for a program always makes anything 224 | interesting into boring. 225 |
          • 226 |
          • 227 | If you have heard of PhpStorm, again, same with NetBeans, setup trouble 228 | (although there isn't a lot). Moreover, it is paid software, although there are 229 | some ways to legitimately get it for free. Nevertheless, it is an all-powerful 230 | IDE that completes the code for you when you have provided a little hint, and 231 | can also be used for other things like coding websites, etc. Actually, this 232 | website was written using PhpStorm (although there is no PHP here). 233 |
          • 234 |
          • Browser + GitHub 235 | The GitHub editor for code is not bad, at least better than Windows Notepad, but 236 | it is far not as good as PhpStorm. If you don't like installing anything, this 237 | is a good alternative to Notepad++. 238 |
          • 239 |
          240 |
        • 241 |
        • OS X 242 |
            243 |
          • 244 | Some would recommend NetBeans, but I wouldn't want you to waste time doing all 245 | the setup stuff. Believe me, setup for a program always makes anything 246 | interesting into boring. 247 |
          • 248 |
          • 249 | If you have heard of PhpStorm, again, same with NetBeans, setup trouble 250 | (although there isn't a lot). Moreover, it is paid software, although there are 251 | some ways to legitimately get it for free. Nevertheless, it is an all-powerful 252 | IDE that completes the code for you when you have provided a little hint, and 253 | can also be used for other things like coding websites, etc. Actually, this 254 | website was written using PhpStorm (although there is no PHP here). 255 |
          • 256 |
          • Browser + GitHub 257 | The GitHub editor for code is not bad, at least better than Windows Notepad, but 258 | it is far not as good as PhpStorm. If you don't like installing anything, this 259 | is a good alternative to Notepad++. 260 |
          • 261 |
          • TextMate 262 | TextMate (Use the beta!) is an powerful free Editor, 263 | with Syntnax highlighing. It has some realy neat functions, and works perfectly with git. 264 | It is a powerful text editor for many types of files and for different programming languages. 265 |
          • 266 |
          267 |
        • 268 |
        • iOS 269 |
            270 |
          • I have never used iOS, so don't ask me :(
          • 271 |
          272 |
        • 273 |
        • Android
          274 | I would not advise coding on phones or tablets, but if you don't have an alternative, 275 | well... 276 |
            277 |
          • Normal text editors
            278 | Whatever editor you like, as long as it disables autocorrect. You can try Text 279 | Editor embedded in the File Manager app.
            280 | BTW, you need a file explorer since plugins consist of more than one file when 281 | you are developing. 282 |
          • 283 |
          • Vim Touch
            284 | It is an imitation of Vim for Linux. It is an odd choice, but it has 285 | good things if you 286 |
          • 287 |
          • Chrome + GitHub 288 | Many mobile users found GitHub's direct edit interface good, although it isn't 289 | at all. 290 |
          • 291 |
          292 |
        • 293 |
        294 |
      • 295 |
      • A browser
        296 | For you to look for documentation (and this website) anytime you have trouble. Believe me, 297 | nobody memorizes all the functions in PHP. 298 |
      • 299 |
      300 |

      301 | Yes, this simple. That's all you need. But again, I strongly encourage you to get a computer and a 302 | hard keyboard, or you can hardly develop anything big without finding all your $this 303 | becoming $thos. 304 |

      305 |
      306 |
      307 |

      308 | I would assume that you have PocketMine setup already. I hope I don't need to teach you how to find 309 | that directory.
      310 | Fine. For Android it is ~/PocketMine, where ~ is something 312 | like /mnt/sdcard, etc.
      313 | Navigate to the plugins directory (a.k.a. folder) in the server directory 314 | and install the DevTools plugin.
      316 | For our first plugin, we are going to call it FirstPlugin. Now, create a 317 | directory in 318 | the plugins directory called FirstPlugin. So now 319 | we have /plugins/FirstPlugin. 320 | For convenience, in the future we are going to call this path ~. E.g. 321 | ~/plugin.yml 322 | refers to /plugins/FirstPlugin/plugin.yml.
      323 |

      324 | 325 |

      326 | Now, it is time to create the very first file of our plugin. But it is not PHP code. It is a YAML 327 | file that describes your plugin, located at ~/plugin.yml.
      328 |

      329 |
      
      330 | 					name: FirstPlugin
      331 | 					author: PEMapModder
      332 | 					version: 1.0.0
      333 | 					api: 1.13.0
      334 | 					main: FirstPlugin\FirstPlugin
      335 | 				
      336 |

      Before you try to copy, please read my explanation for them, line by line.

      337 |
      name: FirstPlugin
      338 |

      This line, apparently, defines your plugin name. Replace FirstPlugin with 339 | your plugin name, and you will see it showing up in the startup messages when the server starts.

      340 |
      author: PEMapModder
      341 |

      This line, apparent as well, tells the server who wrote this plugin. Of course, replace 342 | PEMapModder with your own name. It can contain spaces. However, if you 343 | have 344 | more than one author, change author to authors 345 | and 346 | put down all the author names, separated by commas ,, and put square 347 | brackets 348 | [ ] around them.

      349 |
      version: 1.0.0
      350 |

      This line defines the plugin's version. It is purely internal with no rules, and the server will not 351 | try to understand what you are trying to say in the version. Just type whatever you like here as 352 | long as 353 | users and yourself can understand it.

      354 |
      api: 1.13.0
      355 |

      356 | API means "application program interface". It is basically the things from PocketMine that 357 | lets plugins interact with it. It is like how a microwave oven has buttons to let people adjust 358 | it.
      359 | This refers to the minimum API version your plugin supports. You can find the current API version 360 | of your server from the startup messages:
      361 |
      362 | The first number refers to a complete change in API (major version). The plugin and the server must 363 | have the same number here to be loaded.
      364 | The second number refers to additions in the API (minor version). The plugin must have the same or 365 | smaller number here to be loaded.
      366 | The third number refers to minor API changes (patches). Any numbers work here, but you should use 367 | the number you tested for.
      368 | All these information aside, what you have to know is, you'd better use the number you see in 369 | your server's startup. 370 |

      371 |
      main: FirstPlugin\FirstPlugin
      372 |

      373 | Here finally comes the part related to the plugin code.
      374 | Short and unclear explanation:
      375 | This is the fully-qualified name of your plugin's 376 | main class.
      377 | This obviously explains nothing to someone who doesn't know what a class is. Let's 378 | just go through step-by-step.
      379 |

      380 |

      381 | In PHP (especially in PocketMine-related PHP), code is contained in units called "classes". You can 382 | think a class as a "file" (and it is indeed true that we would normally put only one class in one 383 | file).
      384 | And what's even more exciting, since we have files, we have directories (folders) that contain the 385 | files. They are called "namespaces". Actually, we normally put a PHP file with the proper filename 386 | in the proper directory according to their namespace and class name. I said "normally" because it 387 | sometimes works if you don't, but just forget it and assume that it doesn't.
      388 | Usually, just like you put similar files in the same directory, we put classes of the same plugin in 389 | the same namespace. We can also have "sub-namespaces" just like we have sub-directories, 390 | but that isn't important; just forget about it. 391 |

      392 |

      393 | By convention, we use Pascal-case for class names. That is, we would 394 | WriteLikeThis if we all write in Pascal-Case.
      395 | Note that you can only use alphabets, the 10 numbers (0-9) and the underscore (_) in 397 | class names. Also, class names cannot start with numbers.
      398 | For namespaces, the same rule applies. However, to create "sub-namespaces", just like file paths 399 | in Windows, we separate two parts by a backslash \.
      400 | Now, to get a fully-qualified name of the class, which is like the full file path 401 | on Windows, we use NamespaceName\ClassName. In our example, 402 | FirstPlugin\FirstPlugin is the fully-qualified name of the namespace 403 | FirstPlugin and the class name also FirstPlugin. 404 |

      405 |

      406 | So what is a class? We will get it discussed in the next chapter. 407 |

      408 |
      409 |
      410 | 411 |
      412 |

      413 | I have already explained about the meaning of namespaces and classes in the previous chapter - 414 | namespaces are like directories, and classes are like files. But to what extent are they alike?
      415 | Files that contain PHP code (source code) are called "source files". In your plugin, source files should 416 | be located inside a directory called "sources root", which should be at ~/src.
      417 | A source file ends with .php. In front of that, it is the fully-qualified name 418 | of the class inside the source file.
      419 | Now we have the fully-qualified name FirstPlugin\FirstPlugin, we should create 420 | our source file at ~/src/FirstPlugin/FirstPlugin.php. Simple. What's not so 421 | simple that gave the magical power to plugins is the things inside the file. 422 |

      423 |
      424 |

      Hold your breath and scroll through all these.

      425 |
      426 |

      427 | STOP. Don't copy it into your file. Oh, did I say "just copy"? Forget that. 428 | Instead, try to understand it and write it yourself when you know what you are writing. 429 |

      430 |
      431 |

      432 | This line, <?php, seriously does nothing at all. It doesn't help 433 | you in any ways. It is only here to tell people that this is a PHP file. 434 |

      435 |

      436 | Sadly, the human race is the best species at finding trouble for themselves. We must 437 | put this line at the very beginning of every PHP file, and better on an 438 | independent line. 439 |

      440 |
      441 |
      442 |

      443 | Yes. Honestly. These lines are purely decorative. You can add spaces and tabs and break code 444 | into new lines literally anywhere in your PHP file (but after the 445 | <?php line!), as long as they don't cut one word into two. 446 | (But it is not reasonable to change function into 447 | fun ct ion, is it?) 448 |

      449 |

      450 | Nevertheless, programmers have a general habit of talking things in terms of "lines", but when 451 | we talk about a "line" of code, we generally refer to a statement. I will explain more 452 | about what a statement is later. 453 |

      454 |
      455 |
      456 |

      457 | This is pretty obvious. When discussing the main attribute in our 458 | plugin.yml, we have already mentioned that the namespace of this 459 | class is FirstPlugin. 460 |

      461 |

      462 | We have to declare the namespace in every PHP file, unless it doesn't have a namespace 463 | (but this SHOULD NOT happen in a plugin!). As you can observe, the syntax to declare a namespace 464 | is: 465 |

      466 |
      namespace namespace_for_this_file;
      467 |

      468 | namespace_for_this_file should be the whole namespace, including the 469 | backslashes (\) and the subnamespaces. 470 |

      471 |

      472 | Don't forget the semicolon at the end. A rule for PHP is that all statements would end with 473 | ; (semicolons), unless they end with a {, 474 | then enclose other lines of code, and finally a }. (Of course, except 475 | <?php, which is not code at all) 476 |

      477 |

      ' 478 | Keep in mind that the namespace statement must be the very first statement in 479 | every PHP file (of course after <?php) 480 |

      481 |
      482 |
      483 |

      484 | There are two types of use statements: 485 |

      486 |
      use Fully\Qualified\ClassName;
      487 |
      use Fully\Qualified\ClassName as AnAlias;
      489 |

      Quite self-expanatory, isn't it? Actually, the first type is just a simplified form of the second 490 | type. We can change the first line into:

      491 |
      use Fully\Qualified\ClassName as ClassName;
      493 |

      They basically mean the same thing.

      494 |

      OK. But what are use statements for?

      495 |

      496 | use statements tells the PHP compiler that when you later say 499 | AnAlias in this file, you are talking about 500 | Fully\Qualified\ClassName. In this way, even though the namespace is 501 | very long, we can use the class as a short alias. If you don't say 502 | as what, as in the first type, the PHP compiler will use the 503 | simple class name as the alias. In fact, programmers usually only use the first type to 504 | avoid confusion, unless they are coding something real quickly and short and use 506 | aliases to shorten the class 507 | name (but don't do this in code where you expect other people to read, or yourself to 508 | read after a few months - people will have a hard time understanding it). 509 |

      510 |

      In the dummy class above, we used:

      511 |
      use pocketmine\plugin\PluginBase;
      512 |

      513 | On line 7, we mentioned PluginBase, but because of the 514 | use statement from line 5, it actually means 515 | pocketmine\plugin\PluginBase rather than merely 516 | PluginBase. 517 |

      518 |

      519 | Remember that use statements must be directly after the 520 | namespace statement. 521 |

      522 |

      523 | Pro tip: apart from class names, use statements can also register aliases for namespaces. This 524 | is handy when you are using a lot of classes from that namespace. 525 |

      526 |

      527 | For convenience, I am going to refer use statements as "imports" in the future. 529 |

      530 |
      531 |
      532 |

      533 | Now, we have finally come to the most important part of our code. (Actually, the only part that 534 | does something meaningful). 535 |

      536 |

      537 | Before I start explaining what this line (line 7) does, let's have an overview on the syntax of 538 | the PHP language. Yes, an overview, a very brief and general one. Really general one, you'd 539 | probably think that this is useless, but it lets you automatically understand a lot of things 540 | in the future. 541 |

      542 |

      Let's look at this text. Don't worry, it is written in English :)

      543 |

      544 | When a player moves, if he is not an op, teleport him to jail. Take money from him. Send him a 545 | message. When the server stops, if the server owner is not online, notify him. Delete all 546 | worlds. 547 |

      548 |

      549 | This describes what happens in the plugin in English. I hope that you notice the 551 | ambiguity in this text
      552 | I said "Take money from him.", but does this mean take money from him if he is not an op? Or 553 | whenever he moves?
      554 | "Delete all worlds.", does this happen only if the server owner is not online, or whenever the 555 | server stops?
      556 | To clarify my meaning, let's format my text into this: 557 |

      558 |
      559 | When a player moves:
      560 | {
      561 | 	If the player is an op:
      562 | 	{
      563 | 		Teleport him to jail.
      564 | 		Take money from him.
      565 | 	}
      566 | 	Send him a message.
      567 | }
      568 | When the server stops:
      569 | {
      570 | 	If the server owner is not online:
      571 | 	{
      572 | 		Notify him.
      573 | 	}
      574 | 	Delete all worlds.
      575 | }
      576 | 					
      577 |

      Now, it is crystal clear that I am referring to the things inside the curly braces ({}) when I say "if the player is an op". And as a matter of fact, 579 | this is how PHP understands what you say. 580 |

      581 |
      582 |

      583 | In the PHP syntax, it main consists of two compoenents - statements and statement 584 | groups.

      585 |

      586 | A statement is like a sentence saying what to do, like "Teleport him to jail". Just like how 587 | we end every sentence in English with a full stop ., we end every 588 | PHP statement with a semicolon ;. 589 |

      590 |

      591 | A statement group consists of a line that explains what this statement group is about, then 592 | followed by a group of statements. For example, in the text above, "When the server stops" 593 | explains what the following group of statements is about.
      594 | Yes, a statement group is a statement too. Therefore, we can have a statement group inside a 595 | statement group.
      596 | Usually, a statement group looks like this: 597 |

      598 |
      599 | group_type{
      600 | 	many statements;
      601 | 	and nested statement groups{
      602 | 		here;
      603 | 	}
      604 | }
      605 | 						
      606 |

      607 | Sometimes, group_type can contain more information than merely the 608 | group type. Let's go back to our dummy class for an example. 609 |

      610 |
      611 |

      This was our class statement group:

      612 |
      613 | class FirstPlugin extends PluginBase{
      614 | 	# some code was here
      615 | }
      616 | 					
      617 |

      618 | This declares a class called FirstPlugin. we have 619 | previously decided that our fully-qualified class name should be FirstPlugin\FirstPlugin, where the first FirstPlugin is the namespace and the second FirstPlugin 623 | is the simple class name. We have already declared the namespace for this file on line 3, so we 624 | don't need to mention it again. 625 |

      626 |

      627 | The next part of this line says that the class FirstPlugin 628 | extends PluginBase. What does that mean?
      629 | Remember what we did on line 5? PluginBase actually means 630 | pocketmine\plugin\PluginBase, which is a class provided by PocketMine 631 | itself. 632 |

      633 |

      634 | So what? What does this class do? What is meant by extends? 635 |

      636 |

      637 | The concept of "extend" is more complicated. But for the moment, you can assume that it means 638 | that this class is the main class of a plugin.

      639 |

      640 | There are two types of statements inside a class. They are class properties and 641 | functions. Class properties are the "memory" of a class, but you can ignore that for 642 | the moment. We are going to talk about functions first. 643 |

      644 |
      645 |
      646 |

      647 | function is another kind of statement group. It declares a 648 | function. 649 |

      650 |
      651 |

      Have you ever learnt functions from mathematics? OK, if you haven't, learn it now.

      652 |

      653 | A function is like a crafting table. You add ingredients (parameters/arguments) 654 | into it, and it will give you some product (return value). Furthermore, the 655 | order of how you put the input matters.
      656 | For example, you have three diamonds and two sticks. If you put the three diamonds on the 657 | top, you get a diamond pickaxe. But if you put one diamond on the side of the middle, you 658 | get a diamond axe.
      659 | The same thing goes to functions. A function accepts some arguments (sometimes none, 660 | though). It expects each argument to be something. For example, a function that sets a block 661 | in a world would accept two arguments, the first argument being the position to change, and 662 | the second argument being the type of block to change into.
      663 | Functions are also like commands. Say, the /effect command. You 664 | have to provide a player in the first argument. The second argument is the effect type. You 665 | can optionally also provide the third and fourth argument for duration and amplitude, but 666 | the command will assume default values for you if you didn't provide them.
      667 |

      668 |
      669 |

      670 | Just like commands, apart from arguments and return values, a function also has a name, 671 | description and permission, although we instead call description 672 | documentation and permission visibility.
      673 | The function's name has the same rules as classes, except that it starts with a 674 | small letter 675 | instead of a capital letter. That is, we use camelCase rather than 676 | PascalCase.
      677 | There are three types of visibility for a function, namely public, 678 | protected and private. Public functions can be used from anywhere. Private functions 681 | can only be used when you are writing code from that class. As for protected functions, they are 682 | like private functions, but also accessible by subclasses. What are subclasses? You 683 | won't need to know that until you are making really complicated or high-quality plugins (e.g. 684 | SimpleAuth).
      685 |

      686 |

      687 | When a function is inside a class, we also call it a "class method". 689 | But let's call it "function" to avoid confusion. 690 |

      691 |

      As you may have already noticed, this is the syntax of declaring a function:

      692 |
      693 | 						function_visibility function function_name(arguments){
      694 | 							code_inside_the_function
      695 | 						}
      696 | 					
      697 |

      For instance:

      698 |
      699 | 						public function myFunction($arg1, $arg2){
      700 | 							// some code here
      701 | 						}
      702 | 					
      703 |

      704 | You might be asking what the // means. It is the line comment 705 | symbol. This means that everything on that line after the // will 706 | be ignored. This is useful when you want other people, or yourself a few months (or a few days) 707 | later to easily understand what you are writing. 708 |

      709 |
      710 |
      711 |
      712 | 713 |
      714 |

      715 | Server: chat.freenode.net:6667
      716 | Private message: PEMapModder
      717 | Channel: #pmplugins 718 |

      719 |
      720 | 721 | Join the chat at https://gitter.im/PEMapModder/PocketMine-Plugin-Tutorials 723 | 724 |
      725 |
      726 |

      Please create a pull request on GitHub if you found mistakes in this webpage.

      727 | 728 |
      729 |
      730 | 731 |
      732 |

      This page is mainly authored by PEMapModder,

      733 |

      734 | This webpage uses the highlight.js 735 | library (and its rainbow theme) for syntax highlighting. 736 |

      737 |
      738 |
      739 |
      740 |
      741 | 742 |
      743 |
      744 | 745 | 746 | -------------------------------------------------------------------------------- /guide.css: -------------------------------------------------------------------------------- 1 | #body{ 2 | font-family: Helvetica, arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"; 3 | width: 1000px; 4 | margin: auto; 5 | line-height: 160%; 6 | font-size: 16px; 7 | background-color: #FFFFFF; 8 | padding: 10px; 9 | border-radius: 10px; 10 | } 11 | .heading{ 12 | font-weight: bold; 13 | border-radius: 5px; 14 | } 15 | .spoiler{ 16 | border-left: groove; 17 | border-radius: 10px; 18 | padding: 5px; 19 | } 20 | .note{ 21 | font-style: italic; 22 | color: #606060; 23 | border-left: 4px solid #A0A0A0; 24 | padding-left: 16px; 25 | } 26 | p, .note{ 27 | line-height: 160%; 28 | } 29 | p br{ 30 | margin: 30px; 31 | } 32 | #index{ 33 | border: ridge; 34 | border-radius: 5px; 35 | width: 500px; 36 | } 37 | .code{ 38 | background-color: #404040; 39 | color: #FFFFFF; 40 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; 41 | border-radius: 5px; 42 | padding: 1px; 43 | display: inline; 44 | /* This font family set is what GitHub uses, and I like it :D */ 45 | } 46 | .note .code{ 47 | background-color: #A0A0A0; 48 | color: #000000; 49 | } 50 | .codefence{ 51 | border-radius: 5px; 52 | } 53 | .u{ 54 | text-decoration: underline; 55 | } 56 | .hinted{ 57 | border-bottom: 1px dotted #000000; 58 | cursor: help; 59 | } 60 | li.depth-1{ 61 | list-style-type: upper-alpha; 62 | } 63 | li.depth-2{ 64 | list-style-type: decimal; 65 | } 66 | li.depth-3{ 67 | list-style-type: lower-alpha; 68 | } 69 | li.depth-4{ 70 | list-style-type: upper-roman; 71 | } 72 | li.depth-5{ 73 | list-style-type: lower-roman; 74 | } 75 | -------------------------------------------------------------------------------- /highlight.pack.js: -------------------------------------------------------------------------------- 1 | /*! highlight.js v9.0.0 | BSD3 License | git.io/hljslicense */ 2 | !function(e){"undefined"!=typeof exports?e(exports):(self.hljs=e({}),"function"==typeof define&&define.amd&&define("hljs",[],function(){return self.hljs}))}(function(e){function n(e){return e.replace(/&/gm,"&").replace(//gm,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0==t.index}function a(e){return/^(no-?highlight|plain|text)$/i.test(e)}function i(e){var n,t,r,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=/\blang(?:uage)?-([\w-]+)\b/i.exec(i))return E(t[1])?t[1]:"no-highlight";for(i=i.split(/\s+/),n=0,r=i.length;r>n;n++)if(E(i[n])||a(i[n]))return i[n]}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!=r[0].offset?e[0].offset"}function u(e){l+=""}function c(e){("start"==e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=i();if(l+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g==e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g==e&&g.length&&g[0].offset==s);f.reverse().forEach(o)}else"start"==g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(a.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):Object.keys(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\b\w+\b/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"==e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var l=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,a,i){function o(e,n){for(var t=0;t";return i+=e+'">',i+n+o}function p(){if(!L.k)return n(M);var e="",t=0;L.lR.lastIndex=0;for(var r=L.lR.exec(M);r;){e+=n(M.substr(t,r.index-t));var a=g(L,r);a?(B+=a[1],e+=h(a[0],n(r[0]))):e+=n(r[0]),t=L.lR.lastIndex,r=L.lR.exec(M)}return e+n(M.substr(t))}function d(){var e="string"==typeof L.sL;if(e&&!R[L.sL])return n(M);var t=e?l(L.sL,M,!0,y[L.sL]):f(M,L.sL.length?L.sL:void 0);return L.r>0&&(B+=t.r),e&&(y[L.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){return void 0!==L.sL?d():p()}function v(e,t){var r=e.cN?h(e.cN,"",!0):"";e.rB?(k+=r,M=""):e.eB?(k+=n(t)+r,M=""):(k+=r,M=t),L=Object.create(e,{parent:{value:L}})}function m(e,t){if(M+=e,void 0===t)return k+=b(),0;var r=o(t,L);if(r)return k+=b(),v(r,t),r.rB?0:t.length;var a=u(L,t);if(a){var i=L;i.rE||i.eE||(M+=t),k+=b();do L.cN&&(k+=""),B+=L.r,L=L.parent;while(L!=a.parent);return i.eE&&(k+=n(t)),M="",a.starts&&v(a.starts,""),i.rE?0:t.length}if(c(t,L))throw new Error('Illegal lexeme "'+t+'" for mode "'+(L.cN||"")+'"');return M+=t,t.length||1}var N=E(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,L=i||N,y={},k="";for(w=L;w!=N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var M="",B=0;try{for(var C,j,I=0;;){if(L.t.lastIndex=I,C=L.t.exec(t),!C)break;j=m(t.substr(I,C.index-I),C[0]),I=C.index+j}for(m(t.substr(I)),w=L;w.parent;w=w.parent)w.cN&&(k+="");return{r:B,value:k,language:e,top:L}}catch(O){if(-1!=O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function f(e,t){t=t||x.languages||Object.keys(R);var r={r:0,value:n(e)},a=r;return t.forEach(function(n){if(E(n)){var t=l(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}}),a.language&&(r.second_best=a),r}function g(e){return x.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,n){return n.replace(/\t/g,x.tabReplace)})),x.useBR&&(e=e.replace(/\n/g,"
      ")),e}function h(e,n,t){var r=n?w[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function p(e){var n=i(e);if(!a(n)){var t;x.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):t=e;var r=t.textContent,o=n?l(n,r,!0):f(r),s=u(t);if(s.length){var p=document.createElementNS("http://www.w3.org/1999/xhtml","div");p.innerHTML=o.value,o.value=c(s,u(p),r)}o.value=g(o.value),e.innerHTML=o.value,e.className=h(e.className,n,o.language),e.result={language:o.language,re:o.r},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.r})}}function d(e){x=o(x,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=R[n]=t(e);r.aliases&&r.aliases.forEach(function(e){w[e]=n})}function N(){return Object.keys(R)}function E(e){return e=(e||"").toLowerCase(),R[e]||R[w[e]]}var x={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},R={},w={};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=E,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e});hljs.registerLanguage("python",function(e){var r={cN:"meta",b:/^(>>>|\.\.\.) /},b={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[r],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[r],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},l={cN:"params",b:/\(/,e:/\)/,c:["self",r,a,b]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:[r,a,b,e.HCM,{v:[{cN:"function",bK:"def",r:10},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,l]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("yaml",function(e){var a={literal:"{ } true false yes no Yes No True False null"},b="^[ \\-]*",r="[a-zA-Z_][\\w\\-]*",t={cN:"attr",v:[{b:b+r+":"},{b:b+'"'+r+'":'},{b:b+"'"+r+"':"}]},c={cN:"template-variable",v:[{b:"{{",e:"}}"},{b:"%{",e:"}"}]},l={cN:"string",r:0,v:[{b:/'/,e:/'/},{b:/"/,e:/"/}],c:[e.BE,c]};return{cI:!0,aliases:["yml","YAML","yaml"],c:[t,{cN:"meta",b:"^---s*$",r:10},{cN:"string",b:"[\\|>] *$",rE:!0,c:l.c,e:t.v[0].b},{b:"<%[%=-]?",e:"[%-]?%>",sL:"ruby",eB:!0,eE:!0,r:0},{cN:"type",b:"!!"+e.UIR},{cN:"meta",b:"&"+e.UIR+"$"},{cN:"meta",b:"\\*"+e.UIR+"$"},{cN:"bullet",b:"^ *-",r:0},l,e.HCM,e.CNM],k:a}});hljs.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,a,t]}});hljs.registerLanguage("cpp",function(t){var e={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[t.inherit(t.QSM,{b:'((u8?|U)|L)?"'}),{b:'(u8?|U)?R"',e:'"',c:[t.BE]},{b:"'\\\\?.",e:"'",i:"."}]},i={cN:"number",v:[{b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},{b:t.CNR}],r:0},s={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef"},c:[{b:/\\\n/,r:0},{bK:"include",e:"$",k:{"meta-keyword":"include"},c:[t.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"}]},r,t.CLCM,t.CBCM]},a=t.IR+"\\s*\\(",c={keyword:"int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"};return{aliases:["c","cc","h","c++","h++","hpp"],k:c,i:"",k:c,c:["self",e]},{b:t.IR+"::",k:c},{bK:"new throw return else",r:0},{cN:"function",b:"("+t.IR+"[\\*&\\s]+)+"+a,rB:!0,e:/[{;=]/,eE:!0,k:c,i:/[^\w\s\*&]/,c:[{b:a,rB:!0,c:[t.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:c,r:0,c:[t.CLCM,t.CBCM,r,i]},t.CLCM,t.CBCM,s]}]}});hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},s={b:"->{",e:"}"},n={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,n],o=[n,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),s,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=o,s.c=o,{aliases:["pl"],k:t,c:o}});hljs.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"(AV|CA|CF|CG|CI|MK|MP|NS|UI|XC)\\w+"},i={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,o="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:i,l:n,i:""}]}]},{cN:"class",b:"("+o.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:o,l:n,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}});hljs.registerLanguage("xml",function(s){var t="[A-Za-z0-9\\._:-]+",e={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php"},r={eW:!0,i:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[r],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[r],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},e,{cN:"meta",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},r]}]}});hljs.registerLanguage("ini",function(e){var b={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},b,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}});hljs.registerLanguage("nginx",function(e){var r={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},b={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,r],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[r]},{cN:"regexp",c:[e.BE,r],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},r]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:b}],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("json",function(e){var t={literal:"true false null"},i=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:i,k:t},s={b:"{",e:"}",c:[{cN:"attr",b:'\\s*"',e:'"\\s*:\\s*',eB:!0,eE:!0,c:[e.BE],i:"\\n",starts:r}],i:"\\S"},n={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return i.splice(i.length,0,s,n),{c:i,k:t,i:"\\S"}});hljs.registerLanguage("apache",function(e){var r={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",r]},r,e.QSM]}}],i:/\S/}});hljs.registerLanguage("java",function(e){var a=e.UIR+"(<("+e.UIR+"|\\s*,\\s*)+>)?",t="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",r="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:r,r:0};return{aliases:["jsp"],k:t,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+a+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("cs",function(e){var t="abstract as base bool break byte case catch char checked const continue decimal dynamic default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long null when object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async protected public private internal ascending descending from get group into join let orderby partial select set value var where yield",r=e.IR+"(<"+e.IR+">)?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},e.ASM,e.QSM,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+r+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:"^\\[.+\\]:",rB:!0,c:[{cN:"symbol",b:"\\[",e:"\\]:",eB:!0,eE:!0,starts:{cN:"link",e:"$"}}]}]}});hljs.registerLanguage("css",function(e){var c="[a-zA-Z-][a-zA-Z0-9_-]*",t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\s*\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"']+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:c,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}});hljs.registerLanguage("javascript",function(e){return{aliases:["js"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/\s*[);\]]/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[e.CLCM,e.CBCM]}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+e.IR,r:0},{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#/}});hljs.registerLanguage("php",function(e){var c={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},a={cN:"meta",b:/<\?(php)?|\?>/},i={cN:"string",c:[e.BE,a],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},t={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.CLCM,e.HCM,e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"},a]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},a,c,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",c,e.CBCM,i,t]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},i,t]}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke",e:/;/,eW:!0,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes c cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle d data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration e each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract f failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function g general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http i id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists k keep keep_duplicates key keys kill l language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim m main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex n name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding p package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime t table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}}); -------------------------------------------------------------------------------- /highlight/rainbow.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Style with support for rainbow parens 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | background: #474949; 12 | color: #d1d9e1; 13 | } 14 | 15 | 16 | .hljs-comment, 17 | .hljs-quote { 18 | color: #969896; 19 | font-style: italic; 20 | } 21 | 22 | .hljs-keyword, 23 | .hljs-selector-tag, 24 | .hljs-literal, 25 | .hljs-type, 26 | .hljs-addition { 27 | color: #cc99cc; 28 | } 29 | 30 | .hljs-number, 31 | .hljs-selector-attr, 32 | .hljs-selector-pseudo { 33 | color: #f99157; 34 | } 35 | 36 | .hljs-string, 37 | .hljs-doctag, 38 | .hljs-regexp { 39 | color: #8abeb7; 40 | } 41 | 42 | .hljs-title, 43 | .hljs-name, 44 | .hljs-section, 45 | .hljs-built_in { 46 | color: #b5bd68; 47 | } 48 | 49 | .hljs-variable, 50 | .hljs-template-variable, 51 | .hljs-selector-id, 52 | .hljs-class .hljs-title { 53 | color: #ffcc66; 54 | } 55 | 56 | .hljs-section, 57 | .hljs-name, 58 | .hljs-strong { 59 | font-weight: bold; 60 | } 61 | 62 | .hljs-symbol, 63 | .hljs-bullet, 64 | .hljs-subst, 65 | .hljs-meta, 66 | .hljs-link { 67 | color: #f99157; 68 | } 69 | 70 | .hljs-deletion { 71 | color: #dc322f; 72 | } 73 | 74 | .hljs-formula { 75 | background: #eee8d5; 76 | } 77 | 78 | .hljs-attr, 79 | .hljs-attribute { 80 | color: #81a2be; 81 | } 82 | 83 | .hljs-emphasis { 84 | font-style: italic; 85 | } 86 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PocketMine Plugin TUtorials 6 | 16 | 17 | 18 |

      PocketMine Plugin Tutorials

      19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /resources/dummy.php.res: -------------------------------------------------------------------------------- 1 |