mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
WIP
This commit is contained in:
+5
-2
@@ -8,11 +8,14 @@
|
||||
*~
|
||||
*.class
|
||||
*.iml
|
||||
|
||||
.project
|
||||
.classpath
|
||||
**/bin/
|
||||
/game/data/rsa.pem
|
||||
/game/data/savedGames
|
||||
/lib/
|
||||
*/target/
|
||||
*/build/
|
||||
**/build/
|
||||
**/out/
|
||||
**/out/
|
||||
/vendor/
|
||||
@@ -1,6 +1,4 @@
|
||||
plugins {
|
||||
id 'org.asciidoctor.gradle.asciidoctor' version '1.5.1' apply(false)
|
||||
id 'org.asciidoctor.convert' version '1.5.3' apply(false)
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.3.41' apply(false)
|
||||
id 'org.jetbrains.intellij' version '0.4.9' apply(false)
|
||||
id 'org.jmailen.kotlinter' version '1.26.0' apply(false)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
uid: on_button
|
||||
---
|
||||
|
||||
`on_button` allows registering @"handlers"
|
||||
+20
-8
@@ -1,13 +1,25 @@
|
||||
plugins {
|
||||
id 'org.asciidoctor.gradle.asciidoctor'
|
||||
id 'org.asciidoctor.convert'
|
||||
configurations {
|
||||
doclet {
|
||||
transitive(true)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
dependencies {
|
||||
doclet files("vendor/docfx-doclet-1.0-SNAPSHOT-jar-with-dependencies.jar")
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
attributes 'source-highlighter': 'prettify',
|
||||
'toc': 'left'
|
||||
gradle.projectsEvaluated {
|
||||
|
||||
task generateApiDocs(type: Javadoc) {
|
||||
source = project(":game").sourceSets.main.java.sourceDirectories
|
||||
classpath = project(":game").configurations.runtimeClasspath + project(":game").sourceSets.main.output
|
||||
|
||||
options.encoding 'UTF-8'
|
||||
destinationDir = file("build/generated-files")
|
||||
options.addStringOption("doclet", "com.microsoft.doclet.DocFxDoclet")
|
||||
options.docletpath = configurations.doclet.toList()
|
||||
|
||||
dependsOn(project(":game").assemble)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-4
@@ -17,7 +17,7 @@
|
||||
{
|
||||
"files": [
|
||||
"api/**.yml",
|
||||
"api/index.md"
|
||||
"api/**.md"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -50,9 +50,7 @@
|
||||
"dest": "_site",
|
||||
"globalMetadataFiles": [],
|
||||
"fileMetadataFiles": [],
|
||||
"template": [
|
||||
"default"
|
||||
],
|
||||
"template": [ "default", "templates/material" ],
|
||||
"postProcessors": [],
|
||||
"markdownEngineName": "markdig",
|
||||
"noLangKeyword": false,
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
# What is a plugin?
|
||||
# What is a plugin?
|
||||
|
||||
Plugins in Apollo are a mechanism for extending the server with new functionality without having to change any of the core Java code.
|
||||
Every plugin is a straight forward Kotlin project with `.plugin.kts` files containing the plugin extension behaviour and optional Kotlin source files containing generic reusable code.
|
||||
|
||||
## Plugin framework architecture
|
||||
|
||||
Under the hood, the Kotlin compiler transofmrs every `.plugin.kts` file into a class file that extends from @"org.apollo.game.plugin.kotlin.KotlinPluginScript", giving it access to the game @"org.apollo.game.model.World" and @"org.apollo.game.message.handler.MessageHandlerChainSet" the plugin framework is initialized with.
|
||||
@@ -10,17 +10,7 @@ branch prior to the release of the Kotlin plugin system for Apollo.
|
||||
|
||||
## Create a working environment
|
||||
|
||||
The project maintainers strongly recommend
|
||||
[IntelliJ IDEA](https://www.jetbrains.com/idea/).
|
||||
|
||||
After starting IDEA, select *checkout project* with the URL:
|
||||
https://github.com/apollo-rsps/apollo.git and continue. Make sure to
|
||||
*import using gradle* on the next interface.
|
||||
|
||||
Next, checkout the kotlin-experiments branch. To do this via IntelliJ,
|
||||
use the navigation bar at the top and 'VCS > Git > Branches >
|
||||
origin/kotlin-experiments > Checkout as new branch'. Name the new branch
|
||||
something like kotlin-experiments-my-plugin.
|
||||
|
||||
## Create the plugin metadata
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{{!Copyright (c) Oscar Vasquez. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}</title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="title" content="{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}">
|
||||
<meta name="generator" content="docfx {{_docfxVersion}}">
|
||||
{{#_description}}<meta name="description" content="{{_description}}">{{/_description}}
|
||||
<link rel="shortcut icon" href="{{_rel}}{{{_appFaviconPath}}}{{^_appFaviconPath}}favicon.ico{{/_appFaviconPath}}">
|
||||
<link rel="stylesheet" href="{{_rel}}styles/docfx.vendor.css">
|
||||
<link rel="stylesheet" href="{{_rel}}styles/docfx.css">
|
||||
<link rel="stylesheet" href="{{_rel}}styles/main.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||
<meta property="docfx:navrel" content="{{_navRel}}">
|
||||
<meta property="docfx:tocrel" content="{{_tocRel}}">
|
||||
{{#_noindex}}<meta name="searchOption" content="noindex">{{/_noindex}}
|
||||
{{#_enableSearch}}<meta property="docfx:rel" content="{{_rel}}">{{/_enableSearch}}
|
||||
{{#_enableNewTab}}<meta property="docfx:newtab" content="true">{{/_enableNewTab}}
|
||||
</head>
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
body {
|
||||
color: #34393e;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
line-height: 1.5;
|
||||
font-size: 16px;
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
word-wrap: break-word
|
||||
}
|
||||
|
||||
/* HEADINGS */
|
||||
|
||||
h1 {
|
||||
font-weight: 600;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-weight: 600;
|
||||
font-size: 24px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-weight: 600;
|
||||
font-size: 20px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 14px;
|
||||
padding: 10px 0px;
|
||||
}
|
||||
|
||||
article h1,
|
||||
article h2,
|
||||
article h3,
|
||||
article h4 {
|
||||
margin-top: 35px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
article h4 {
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 2px solid #ddd;
|
||||
}
|
||||
|
||||
/* NAVBAR */
|
||||
|
||||
.navbar-brand>img {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
border: none;
|
||||
/* Both navbars use box-shadow */
|
||||
-webkit-box-shadow: 0px 1px 3px 0px rgba(100, 100, 100, 0.5);
|
||||
-moz-box-shadow: 0px 1px 3px 0px rgba(100, 100, 100, 0.5);
|
||||
box-shadow: 0px 1px 3px 0px rgba(100, 100, 100, 0.5);
|
||||
}
|
||||
|
||||
.subnav {
|
||||
border-top: 1px solid #ddd;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.navbar-inverse {
|
||||
background-color: #0d47a1;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.navbar-inverse .navbar-nav>li>a,
|
||||
.navbar-inverse .navbar-text {
|
||||
color: #fff;
|
||||
background-color: #0d47a1;
|
||||
border-bottom: 3px solid transparent;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.navbar-inverse .navbar-nav>li>a:focus,
|
||||
.navbar-inverse .navbar-nav>li>a:hover {
|
||||
color: #fff;
|
||||
background-color: #0d47a1;
|
||||
border-bottom: 3px solid white;
|
||||
}
|
||||
|
||||
.navbar-inverse .navbar-nav>.active>a,
|
||||
.navbar-inverse .navbar-nav>.active>a:focus,
|
||||
.navbar-inverse .navbar-nav>.active>a:hover {
|
||||
color: #fff;
|
||||
background-color: #0d47a1;
|
||||
border-bottom: 3px solid white;
|
||||
}
|
||||
|
||||
.navbar-form .form-control {
|
||||
border: none;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
/* SIDEBAR */
|
||||
|
||||
.toc .level1>li {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.toc .nav>li>a {
|
||||
color: #34393e;
|
||||
}
|
||||
|
||||
.sidefilter {
|
||||
background-color: #fff;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.sidefilter {
|
||||
background-color: #fff;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.toc-filter {
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.toc-filter>input {
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.toc-filter>.filter-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidetoc>.toc {
|
||||
background-color: #fff;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.sidetoc {
|
||||
background-color: #fff;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* ALERTS */
|
||||
|
||||
.alert {
|
||||
padding: 0px 0px 5px 0px;
|
||||
color: inherit;
|
||||
background-color: inherit;
|
||||
border: none;
|
||||
box-shadow: 0px 2px 2px 0px rgba(100, 100, 100, 0.4);
|
||||
}
|
||||
|
||||
.alert>p {
|
||||
margin-bottom: 0;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
.alert>ul {
|
||||
margin-bottom: 0;
|
||||
padding: 5px 40px;
|
||||
}
|
||||
|
||||
.alert>h5 {
|
||||
padding: 10px 15px;
|
||||
margin-top: 0;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
|
||||
.alert-info>h5 {
|
||||
color: #1976d2;
|
||||
border-bottom: 4px solid #1976d2;
|
||||
background-color: #e3f2fd;
|
||||
}
|
||||
|
||||
.alert-warning>h5 {
|
||||
color: #f57f17;
|
||||
border-bottom: 4px solid #f57f17;
|
||||
background-color: #fff3e0;
|
||||
}
|
||||
|
||||
.alert-danger>h5 {
|
||||
color: #d32f2f;
|
||||
border-bottom: 4px solid #d32f2f;
|
||||
background-color: #ffebee;
|
||||
}
|
||||
|
||||
/* CODE HIGHLIGHT */
|
||||
pre {
|
||||
padding: 9.5px;
|
||||
margin: 0 0 10px;
|
||||
font-size: 13px;
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
background-color: #fffaef;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0px 1px 4px 1px rgba(100, 100, 100, 0.4);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
apply plugin: "java"
|
||||
apply plugin: 'kotlin'
|
||||
apply from: "$rootDir/gradle/kotlin.gradle"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8'
|
||||
|
||||
compile 'org.jetbrains.dokka:dokka-fatjar:0.9.18'
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.apollo.tools.dokka2yaml
|
||||
|
||||
import com.google.inject.Binder
|
||||
import org.jetbrains.dokka.FormatService
|
||||
import org.jetbrains.dokka.Formats.FormatDescriptor
|
||||
import org.jetbrains.dokka.Formats.KotlinFormatDescriptorBase
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
class YamlFileFormatDescriptor : KotlinFormatDescriptorBase() {
|
||||
override val formatServiceClass = YamlFileGenerator::class
|
||||
override fun configureAnalysis(binder: Binder) {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun configureOutput(binder: Binder) {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.tools.dokka2yaml
|
||||
|
||||
import org.jetbrains.dokka.DocumentationNode
|
||||
import org.jetbrains.dokka.FormatService
|
||||
import org.jetbrains.dokka.FormattedOutputBuilder
|
||||
import org.jetbrains.dokka.Location
|
||||
|
||||
class YamlFileGenerator(override val extension: String = ".yaml") : FormatService {
|
||||
override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder {
|
||||
return YamlFileOutputBuilder()
|
||||
}
|
||||
}
|
||||
|
||||
class YamlFileOutputBuilder : FormattedOutputBuilder {
|
||||
override fun appendNodes(nodes: Iterable<DocumentationNode>) {
|
||||
for (node in nodes) {
|
||||
appendNode(node)
|
||||
}
|
||||
}
|
||||
|
||||
fun appendNode(node: DocumentationNode) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
class=org.apollo.tools.dokka2yaml.YamlFileFormatDescriptor
|
||||
description=Turns KDoc and Javadoc into the code2yaml format for DocFX.
|
||||
Reference in New Issue
Block a user