diff --git a/.gitignore b/.gitignore index b2d6de3..0b03eae 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +.idea/ +*.iml diff --git a/docs/api/api-creating-a-first-plugin.md b/docs/api/api-creating-a-first-plugin.md deleted file mode 100644 index bfa01fb..0000000 --- a/docs/api/api-creating-a-first-plugin.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: api-creating-first-plugin -title: Creating Your First Plugin -sidebar_label: Creating Your First Plugin ---- - -## Prerequisites - -1. Follow the ["API Getting Started" guide](/docs/api/api-getting-started) and -install the API into your classpath. -2. An understanding of the Java programming language is necessary. diff --git a/docs/api/api-getting-started.md b/docs/api/api-getting-started.md deleted file mode 100644 index be96f5e..0000000 --- a/docs/api/api-getting-started.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -id: api-getting-started -title: Introduction to the GoMint API -sidebar_label: Introduction to GoMint API ---- - -## Downloading the API JARs - -## Adding JARs to Eclipse - -### Mac OS Instructions - -Before adding the JAR files to your build path in Eclipse, it's best to place them -in the workspace folder that you are working with, in a designated folder for -dependencies, or somewhere it will not be moved or accidentally deleted. - -1. To begin, create a new Java Project in Eclipse, or click the name of the project -in the project explorer if you have already created it. -2. Click ```File->Properties``` -3. Select "Java Build Path" from the list on the left. -4. Select "Classpath" from the list in the panel. -5. Select the button titled "Add External Jars" -6. Navigate to the JAR using Finder and select it. - -Once you have completed these steps, the API should be installed into your -classpath in Eclipse and ready to use for creating plugins. - -## Accessing the Javadoc - -The GoMint API Javadoc can be found [here](https://s.janmm14.de/gomint-javadoc). -While not every method and class has been documented, the majority have been with -brief explanations as to their functionality. diff --git a/docs/development/creating-a-first-plugin.md b/docs/development/creating-a-first-plugin.md index 1f1323f..23254fb 100644 --- a/docs/development/creating-a-first-plugin.md +++ b/docs/development/creating-a-first-plugin.md @@ -6,126 +6,28 @@ sidebar_label: Creating Your First Plugin ## Prerequisites -1. Follow the ["API Getting Started" guide](/docs/api/api-getting-started) and -install the API into your classpath. -2. An understanding of the Java programming language is necessary. -3. A test plugin has been created in the GoMint repository and can be browsed [here](https://github.com/gomint/GoMint/tree/master/gomint-test-plugin/src/main/java/io/gomint/testplugin) for another example of what we will be creating. - -### pom.xml Setup - -Before you begin writing a plugin, you will need a ```pom.xml``` for the plugin. It is pertinent that this file be included. - -```xml - - - 4.0.0 - - - io.gomint.testplugin - gomint-testplugin - 1.0-SNAPSHOT - - - GoMint Test Plugin - A plugin to test and see GoMint's API design - - - - - io.gomint - gomint-api - 1.0.0-SNAPSHOT - provided - - - - - - - ${pom.basedir}/src/main/resources - true - - *.* - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 3.1.2 - - - copy-dependencies-netty-codecs - prepare-package - - copy-dependencies - - - netty-codec-http,netty-codec-http2,netty-handler-proxy - ${project.build.directory}/classes/dependency - - - - copy-dependencies-discord - prepare-package - - copy-dependencies - - - provided - io.netty - ${project.build.directory}/classes/dependency - - - - - - - - - - - central - https://repo1.maven.org/maven2 - - true - - - true - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - true - - - true - - - - -``` +1. An understanding of the Java programming language is necessary. +2. Follow the [Getting Started guide](getting-started.md) to set up the project in your Java IDE (like IntelliJ IDEA or Eclipse). + +A test plugin has been created in the GoMint repository and can be browsed [here](https://github.com/gomint/GoMint/tree/master/gomint-test-plugin/src/main/java/io/gomint/testplugin) for another example of what we will be creating. ## Step One - The ```Plugin``` Type -All plugins for the GoMint server contain a class extending ```io.gomint.plugin.Plugin``` +All plugins for the GoMint server contain a class extending [```io.gomint.plugin.Plugin```](https://janmm14.de/static/gomint/index.html?gomint.api/io/gomint/plugin/Plugin.html) where the initialization and cleanup of the plugin will take place, as well as the registration of event handlers, new logic, etc. In lieu of a ```main()``` method, the plugin management system handles the initialization of plugins, so it is important that the annotations and types are setup correctly. +:::info +The class in your plugin extending `Plugin` is often also referred to as *main class* of your plugin. +::: + ```java package me.plugincrafter.demo; import io.gomint.plugin.Plugin; // The class MUST extend Plugin. It is common for new users to write -// 'JavaPlugin', as they are coming from Bukkit/Spigot. +// 'JavaPlugin', as they are coming from Bukkit/Spigot, but here it is just 'Plugin'. public class TestPlugin extends Plugin {} ``` @@ -135,11 +37,11 @@ Rather than use a configuration file that is packed into the JAR file to describ Annotations: -| Annotation | Type | Value | See Also | -|------------|-----------------|---------------------------|---------------------------------------------------------------------------------------| -| PluginName | String | Your plugin's name | | -| Version | int, int | ```major```, ```minor``` | | -| Startup | StartupPriority | See Enums | [JavaDoc](https://janmm14.de/static/gomint/index.html?gomint.api/module-summary.html) | +| Annotation | Type | Value | +|------------|-----------------|---------------------------------------------------------------------------------------------------------------------| +| PluginName | String | Your plugin's name | +| Version | int, int | ```major```, ```minor``` | +| Startup | StartupPriority | See Enum in [JavaDoc](https://janmm14.de/static/gomint/index.html?gomint.api/io/gomint/plugin/StartupPriority.html) | ```java package me.plugincrafter.demo; @@ -156,17 +58,31 @@ import io.gomint.plugin.Version; public class TestPlugin extends Plugin {} ``` +## Step Three - GoMint API philosophies and differences to other server software + +GoMint is one of the first Minecraft server softwares which have built in world multithreading - each world has its own main thread. +This means that many actions to worlds and entites need to run in the world's thread. + +Additionally GoMint provides easy-to-use API for plugins to handle the world multithreading and [restrict plugins to certain worlds](../get-started/plugin-world-restriction.md), which **every** plugin should obey to. + ## ```Plugin``` Available Methods -The following methods are inherited from ```Plugin``` and can be used to install event handlers, listeners, and setup your plugin: +The following methods are inherited from [```Plugin```](https://janmm14.de/static/gomint/index.html?gomint.api/io/gomint/plugin/Plugin.html) and can be used to install event handlers, listeners, and setup your plugin: -* ```onInstall()``` - Invoked when the plugin enters the runtime stage. -* ```onStartup()``` - Invoked when the plugin has been installed. -* ```onUninstall()``` - Invoked when the plugin has been uninstalled. +* ```onInstall()``` - Invoked when the plugin enters the runtime stage. Meant to be overriden. +* ```onUninstall()``` - Invoked when the plugin has been uninstalled. Meant to be overriden. +* ```onStartup()``` - Invoked when the plugin has been installed. Can be overridden if needed. * ```isInstalled()``` - Can be invoked to determine if the plugin has been installed yet. * ```registerCommand(io.gomint.command.Command)``` - Invoke to register your own commands. -* ```registerListener(io.gomint.event.EventListener)``` - Invoke to register your own event listeners. +* ```registerActiveWorldsListener(io.gomint.event.EventListener)``` - Invoke to register your own event listeners, limited to the [worlds your plugin should be active in](../get-started/plugin-world-restriction.md). +* ```registerListener(io.gomint.event.EventListener)``` - Invoke to register your own global event listeners. +* ```registerListener(io.gomint.event.EventListener, Predicate)``` - Invoke to register your own custom-limited event listeners. * ```unregisterListener(io.gomint.event.EventListener)``` - Invoke to remove an event listener. +* ```activeInWorld(io.gomint.world.World)``` - Returns whether the plugin should be active in the given world. +* ```eventInActiveWorlds(io.gomint.event.Event)``` - Returns whether the plugin should be active in the given world. +* ```activeWorldsSnapshot()``` - Returns a set of _currently_ loaded worlds where the plugin should be active in. Do **not** save it for later use. +* ```activeWorldsPlayers()``` - Returns a set of players in your plugin's active worlds +* ```activeWorldsPlayers(Consumer)``` - Calls the given consumer for every player in your plugin's active worlds on the world's thread * ```dataFolder()``` - Returns the data folder for this plugin as a File object. * ```pluginManager()``` - Returns the plugin manager of the GoMint server. * ```name() ``` - Returns the name of this plugin. @@ -174,3 +90,8 @@ The following methods are inherited from ```Plugin``` and can be used to install * ```logger()``` - Returns the Logger of this plugin. * ```scheduler()``` - Returns the plugin scheduler. * ```server()``` - Returns an instance of the GoMint server. + +## Next up + +[Create your first command](creating-your-first-command.md) +[Create your first event listener](creating-your-first-event-listener.md) diff --git a/docs/development/creating-your-first-command.md b/docs/development/creating-your-first-command.md index fe4e484..01da687 100644 --- a/docs/development/creating-your-first-command.md +++ b/docs/development/creating-your-first-command.md @@ -5,7 +5,7 @@ sidebar_label: Creating Your First Command --- ## Prerequisites -This guide assumes that you have a [plugin environment](/docs/development/creating-first-plugin) setup. +This guide assumes that you have a [plugin environment](creating-a-first-plugin.md) setup. If you have not already, follow that guide first. ## Writing a ```Command``` type @@ -20,13 +20,13 @@ public class CommandVelocity extends Command {} Commands in GoMint are based on annotations and injection. There are two required annotations that each command must have, but the full list of annotations for commands are below. GoMint will detect all classes in your plugin which extend `Command` and have at least the required annotations and will automatically create an instance and register it. For custom conditions on command registration you need to use [methods for describing your command](#commandmethod) instead. -| Annotation | Type | Value | Required? | Repeatable? | -|-------------|-----------------|----------------------------------------------------|-----------|-------------| -| Name | String | The command's name | Yes | No | -| Description | String | A description of the command | Yes | No | -| Alias | String | An alias for the command that will also execute it | No | Yes | -| Permission | String | The permission required for the command to execute | No | No | -| Overload | ... | See [overload annotation](#overload) information | No | Yes | +| Annotation | Type | Value | Required? | Repeatable? | +|-----------------------|-----------------|----------------------------------------------------------------------------------------|-----------|-------------| +| Name | String | The command's name | Yes | No | +| Description | String | A description of the command | Yes | No | +| Alias | String | An alias for the command that will also execute it | No | Yes | +| Permission | String | The permission required for the command to execute | No | No | +| Overload | ... | See [overload annotation](#overload) information | No | Yes | The next step to writing your command is to add the necessary annotations to the class: @@ -47,10 +47,7 @@ which must be overridden from ```io.gomint.command.Command``` type. Our ```Comma public class CommandVelocity extends Command { @Override - public CommandOutput execute(CommandSender commandSender, String alias, Map arguments) { - CommandOutput output = new CommandOutput(); - - return output; + public void execute(CommandSender commandSender, String alias, Map arguments, CommandOutput output) { } } ``` @@ -65,9 +62,7 @@ It is important to verify that the sender was the correct type before performing public class CommandVelocity extends Command { @Override - public CommandOutput execute(CommandSender commandSender, String alias, Map arguments) { - CommandOutput output = new CommandOutput(); - + public void execute(CommandSender commandSender, String alias, Map arguments, CommandOutput output) { if (commandSender instanceof PlayerCommandSender) { EntityPlayer player = (EntityPlayer) commandSender; @@ -76,12 +71,28 @@ public class CommandVelocity extends Command { } else if (commandSender instanceof ConsoleCommandSender) { // TODO: Let's add arguments in a moment! } - - return output; } } ``` +:::note +Commands from players are executed on player's current world thread. This means manipulating the player and its world is ok to do. +::: + +## Get Plugin class +If we need the Plugin class, we can use the [```@InjectPlugin```](https://janmm14.de/static/gomint/index.html?gomint.api/io/gomint/plugin/injection/InjectPlugin.html) annotation on a field with the type of our Plugin class; this only works in annotation-defined commands. + +```java +@Name("velocity") +@Description("Give custom velocity to the player who runs it") +public class CommandVelocity extends Command { + + @InjectPlugin + private TestPlugin plugin; +} +``` + + ## Adding Permissions Adding permissions to a command is as simple as adding the permission annotation. Supposing that we want to only allow players to use the velocity command if they have the ```velocityplugin.command.velocity```, we can append the annotation to the class declaration: @@ -101,7 +112,9 @@ When using arguments, we can validate their type as well as assign them names. T For arguments, the ```Overload``` annotation is used. Within this annotation, ```Parameter``` annotations can be used to define a name for the arguments passed, a validator to use, and specify whether or not the parameter is optional. -__Note:__ _For each ```Overload``` annotation, your command will have a different way to organize parameters. Multiple ```Overload``` annotations can be summarized by using the ```Overloads``` annotation._ +:::note +For each ```Overload``` annotation, your command will have a different way to organize parameters. Multiple ```Overload``` annotations can (but don't have to) be summarized by using the ```Overloads``` annotation. +::: The parameter annotation accepts the following fields: * ```name``` - String: The name of the parameter (stored as a key in the ```arguments``` map) @@ -112,15 +125,15 @@ The parameter annotation accepts the following fields: ```java // Our velocity command should be able to accept a parameter for a player name and the specified velocity they should receive. @Overload({ - @Parameter(name = "player", validator = TargetValidator.class, optional = true) - @Parameter(name = "velocity_x", validator = FloatValidator.class, optional = true) - @Parameter(name = "velocity_y", validator = FloatValidator.class, optional = true) + @Parameter(name = "player", validator = TargetValidator.class, optional = true), + @Parameter(name = "velocity_x", validator = FloatValidator.class, optional = true), + @Parameter(name = "velocity_y", validator = FloatValidator.class, optional = true), @Parameter(name = "velocity_z", validator = FloatValidator.class, optional = true) }) ``` ### Arguments Passed -The arguments passed when a command is executed by the player/console are passed to ```execute``` in the Map object ```arguments```. For our velocity command example, we will allow a ```ConsoleCommandSender``` to specify a player's name to apply the velocity to. +The arguments passed when a command is executed by the player/console are passed to ```execute``` in the Map object ```arguments```. For our velocity command example, we will allow a ```ConsoleCommandSender``` to specify a player's name to apply the velocity to. We also have to schedule our work to the target player's world here, as console commands are running in a different thread. ```java // Continued from above @@ -130,15 +143,26 @@ The arguments passed when a command is executed by the player/console are passed Float velocity_y = (Float) arguments.getOrDefault("velocity_y", 2f); Float velocity_z = (Float) arguments.getOrDefault("velocity_z", 0f); - // If all the parameters were passed, the player will receive the specified velocity. - // Otherwise, they will receive a velocity of (x: 0, y: 2, z: 0). - player.setVelocity(new Vector(velocity_x, velocity_y, velocity_z)); + // As we are scheduling the command's world to another thread, command execution ends asynchroniously + // We have to mark this and later call markFinished() when our command execution is over. + output.markAsync(); + + // Cannot not edit player's velocity asynchroniously - we schedule to player's world thread + player.world().scheduler().execute(() -> { + // If all the parameters were passed, the player will receive the specified velocity. + // Otherwise, they will receive a velocity of (x: 0, y: 2, z: 0). + player.setVelocity(new Vector(velocity_x, velocity_y, velocity_z)); - // When the velocity was successfully applied to the given player, a messagae will be sent to the ConsoleCommandSender. - output.success("Applied velocity to " + player.getNameTag()); + // When the velocity was successfully applied to the given player, a message will be sent to the ConsoleCommandSender. + output.success("Applied velocity to " + player.getNameTag()).markFinished(); // markFinished() is required after calling markAsync() + }); } ``` +:::danger +Commands issued by the console are not ran in any world's thread. Most player and world access and editing methods require that you call them from the (player's) world's thread. Not doing so will throw an exception in runtime. +::: + ## Additional Information ### Adding Commands Using Methods @@ -157,10 +181,7 @@ public class CommandVelocity extends Command { } @Override - public CommandOutput execute(CommandSender commandSender, String alias, Map arguments) { - CommandOutput output = new CommandOutput(); - - return output; + public CommandOutput execute(CommandSender commandSender, String alias, Map arguments, CommandOutput output) { } } ``` @@ -181,17 +202,17 @@ Calling not repeatable methods again will overwrite the existing value. Each call to `overload()` will add a new overload to your method. By default the overload is empty. To add a parameter you have to call the `param(...)` functions on the return `ComandOverload` object. -The param function takes the name of parameter first, next up is the ParamValidator. The third argument is the optional boolean, which is itself optional and defaults to false as well. -The ParamValidator needs to be instantiated here instead of it's class. +The param function takes the name of parameter first, next up is the ParamValidator. The third argument is the optional boolean, which is itself optional and defaults to false. +The ParamValidator needs to be instantiated here instead of it's class given. ```java -public CommandVelocity() { - super("velocity"); - description("Give custom velocity to the player who runs it"); - permission("velocityplugin.command.velocity"); - overload().param("player", new TargetValidator(), true) - .param("velocity_x", new FloatValidator(), true) - .param("velocity_y", new FloatValidator(), true) - .param("velocity_z", new FloatValidator(), true); + public CommandVelocity() { + super("velocity"); + description("Give custom velocity to the player who runs it"); + permission("velocityplugin.command.velocity"); + overload().param("player", new TargetValidator(), true) + .param("velocity_x", new FloatValidator(), true) + .param("velocity_y", new FloatValidator(), true) + .param("velocity_z", new FloatValidator(), true); } ``` diff --git a/docs/development/creating-your-first-event-listener.md b/docs/development/creating-your-first-event-listener.md new file mode 100644 index 0000000..be3a835 --- /dev/null +++ b/docs/development/creating-your-first-event-listener.md @@ -0,0 +1,90 @@ +--- +id: creating-your-first-event-listener +title: Creating Your First Event Listener +sidebar_label: Creating Your First Event Listener +--- + +## Prerequisites + +This guide assumes that you have a [plugin environment](creating-a-first-plugin.md) setup. +If you have not already, follow that guide first. + +## Event Concept + +Many actions done by players, blocks or mobs trigger an event. Technically: a class extending `Event`. Events allow you to know, edit or cancel default behaviour. + +:::note +If not otherwise noted in the specifics event javadoc, events are called on the source world thread if they implement [`WorldEvent`](https://janmm14.de/static/gomint/index.html?gomint.api/io/gomint/event/interfaces/WorldEvent.html). +::: + +For your plugin to get informed when an event happens, you need to create a class implementing `EventListener` (a marker interface): + +```java +public class MyFirstEventListener implements EventListener {} +``` + +Now we marked the class for us and the api as event listener. Then we have to register our class to the API. We do that for example in the `onInstall` method in our `TestPlugin` class. Events implementing `WorldEvent` are filtered by gomint so we only get events taking place in any of our [plugin's active worlds](../get-started/plugin-world-restriction.md). + +```java + @Override + public void onInstall() { + registerListener(new MyFirstEventListener()); + } +``` + +Next up we need to define which event(s) we want to listen to in this event listener. +This is done simply by creating a method annotated with `@EventHandler` which takes one argument (the event we want to listen to): + +:::note +Event handling methods need to return `void`. Their visibility must be `public` or package-private. +::: + +```java +public class MyFirstEventListener implements EventListener { + @EventHandler + public void onExplode(EntityExplodeEvent event) { + // this method gets called every time an entity explodes + } +} +``` + +Now we just need to implement some logic. We can praise explosions for example with a chat message sent to every player: + +```java +public class MyFirstEventListener implements EventListener { + @EventHandler + public void onExplode(EntityExplodeEvent event) { + GoMint.instance().onlinePlayers().forEach(p -> p.sendMessage("Hooray, " + event.affectedBlocks().size() + " are gone!")); + } +} +``` + +## Cancellable events + +We changed our minds now and want to prevent explosions from happening. Great that [EntityExplodeEvent](https://janmm14.de/static/gomint/index.html?gomint.api/io/gomint/event/entity/EntityExplodeEvent.html) extends [CancellableEvent](https://janmm14.de/static/gomint/index.html?gomint.api/io/gomint/event/CancellableEvent.html). To cancel events we write this method in our event listener: + +```java + @EventHandler + public void preventExplosions(EntityExplodeEvent event) { + event.cancelled(true); + } +``` + +## ```@EventHandler``` options + +| option | possible values | +|-----------------|-----------------| +| priority | [EventPriority](https://janmm14.de/static/gomint/index.html?gomint.api/io/gomint/event/EventPriority.html) enum: `LOWEST`, `LOW`, `NORMAL` (default), `HIGH`, `HIGHEST` | +| ignoreCancelled |
  • `true` - method will not be called for cancelled events
  • `false` - (default) method will be called regardless of event cancelled state
| + +### Details on priority option + +We have two event listeners for the same event. So how do we define the order in which they will execute? + +This is possible with the priority option of the `@EventHandler` annotation. + +```java + @EventHandler(priority = EventPriority.HIGHEST) +``` + +Priority `LOWEST` is called first, `HIGHEST` will be called last. So you should choose `HIGHEST` if you want to monitor the result of an event, use `HIGH` to override other plugins and use `LOWEST` or `LOW` for changes other plugins who listen on a higher priority should be able to react to. diff --git a/docs/development/getting-started.md b/docs/development/getting-started.md index 4a47d3d..ad89701 100644 --- a/docs/development/getting-started.md +++ b/docs/development/getting-started.md @@ -1,26 +1,135 @@ --- id: getting-started -title: Introduction to the GoMint API -sidebar_label: Introduction to GoMint API +title: IDE setup for GoMint plugin development +sidebar_label: IDE setup for GoMint plugin development --- -## Downloading the API JARs +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; -## Adding JARs to Eclipse +This is a brief explanation to show you how to add gomint-api to your classpath to start writing gomint plugins. -### Mac OS Instructions +There are multiple options available for this: -Before adding the JAR files to your build path in Eclipse, it's best to place them -in the workspace folder that you are working with, in a designated folder for -dependencies, or somewhere it will not be moved or accidentally deleted. +## Using a dependency management system -1. To begin, create a new Java Project in Eclipse, or click the name of the project +### Maven + +This is the recommended way. Maven is not hard to learn and it makes dependency management really easy. + +Before you begin writing a plugin, you will need a ```pom.xml``` for the plugin. It is pertinent that this file be included. + +Example pom.xml file for maven: + +```xml + + + 4.0.0 + + + io.gomint.demo.testplugin + myfirstplugin + 1.0-SNAPSHOT + + + My first Plugin + A demonstration and tutorial plugin for gomint's api + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + + + + io.gomint + gomint-api + 1.0.0-SNAPSHOT + provided + + + +``` + +### Gradle + +Here is the repository snippet: + + + + +```groovy + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } +``` + + + + +```kotlin + maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } +``` + + + + +and here is the dependencies snippet: + + + + +```groovy + compile "io.gomint:gomint-api:1.0.0-SNAPSHOT" +``` + + + + +```kotlin + compile("io.gomint:gomint-api:1.0.0-SNAPSHOT") +``` + + + + +## Downloading the API JARs manually + +You can download the latest API jar here: https://ci.janmm14.de/job/public%7Emcbe%7Egomint/lastSuccessfulBuild/artifact/gomint-api/target/ +Place this jar somewhere where you will not accidentally move or delete it, at best create a dedicated java dependencies folder. +You can additionally download sources or javadoc jar IF you are a little more experienced to also add them to to your IDE. + +### Adding JARs to IntelliJ IDEA + +Create a new java project in [IntelliJ IDEA](https://www.jetbrains.com/idea/download/#section=windows). See [here](https://www.jetbrains.com/help/idea/working-with-module-dependencies.html) for how to add a jar dependency to your project. + +### Adding JARs to Eclipse + +1. To begin, create a new Java Project in [Eclipse](https://www.eclipse.org/downloads/packages/), or click the name of the project in the project explorer if you have already created it. 2. Click ```File->Properties``` 3. Select "Java Build Path" from the list on the left. 4. Select "Classpath" from the list in the panel. 5. Select the button titled "Add External Jars" -6. Navigate to the JAR using Finder and select it. +6. Navigate to the JAR and select it. Once you have completed these steps, the API should be installed into your classpath in Eclipse and ready to use for creating plugins. @@ -28,5 +137,8 @@ classpath in Eclipse and ready to use for creating plugins. ## Accessing the Javadoc The GoMint API Javadoc can be found [here](https://s.janmm14.de/gomint-javadoc). -While not every method and class has been documented, the majority have been with -brief explanations as to their functionality. +While not every method and class has been documented, the majority is. + +## Next up + +[Create your first plugin](creating-a-first-plugin.md) diff --git a/docs/get-started/getting-started.md b/docs/get-started/getting-started.md index 2eddd17..35b3179 100644 --- a/docs/get-started/getting-started.md +++ b/docs/get-started/getting-started.md @@ -13,7 +13,10 @@ sidebar_label: Getting Started ## Basic Configuration +You may want to visit the next tutorial about [configuring](general-configuration.md) your new server. + ## Concluding Thoughts -You may want to visit the next tutorial about [configuring](/docs/get-started/general-configuration) your new server. +If you want to know more about gomint's unique world system, visit the [Plugin World Restrictions](plugin-world-restriction.md) information page. + Or, if you want to dive into writing custom plugins, visit the [first plugin](/docs/development/creating-first-plugin) tutorial. diff --git a/docs/get-started/plugin-world-restriction.md b/docs/get-started/plugin-world-restriction.md new file mode 100644 index 0000000..1612669 --- /dev/null +++ b/docs/get-started/plugin-world-restriction.md @@ -0,0 +1,15 @@ +--- +id: plugin-world-restriction +title: Plugin World Restriction +sidebar_label: Plugin World Restriction +--- + +GoMint worlds are running mostly independent of each other. Every GoMint world has its own thread. +This allows Gomint to scale better than many other minecraft server softwares and you can build a little "server network" just with one GoMint running many worlds. + +To not make plugin development unneccessary complex, we created an API that allows plugins to only run in certain worlds. +You can set up the worlds of a plugin within the `worlds.yml` file you can find in the folder `plugins/ThePluginName`. + +:::caution +While plugins are not completely forced by the server to follow this setting, it is strongly adviced that every plugin uses the easy provided API to follow the `worlds.yml` setting. +::: diff --git a/docs/guides.md b/docs/guides.md index 6bb5ee6..a172efc 100644 --- a/docs/guides.md +++ b/docs/guides.md @@ -6,14 +6,14 @@ sidebar_label: Index of Guides ## Introductory Guides -* [Getting Started](/docs/get-started/getting-started) -* [Configuring Server](/docs/get-started/general-configuration) +* [Getting Started](get-started/getting-started.md) +* [Configuring Server](get-started/general-configuration.md) ## API Guides -* [API Introduction](/docs/development/getting-started) -* [Writing Your First Plugin](/docs/development/creating-first-plugin) -* [Writing Your First Command](/docs/development/creating-your-first-command) +* [Set up your work space](development/getting-started.md) +* [Writing Your First Plugin](development/creating-a-first-plugin.md) +* [Writing Your First Command](development/creating-your-first-command.md) ### Resources * [Javadoc](https://s.janmm14.de/gomint-javadoc)