diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce81115 --- /dev/null +++ b/.gitignore @@ -0,0 +1,139 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/gradle,intellij+all +# Edit at https://www.toptal.com/developers/gitignore?templates=gradle,intellij+all + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Gradle ### +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +### Gradle Patch ### +**/build/ + +# Eclipse Gradle plugin generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# End of https://www.toptal.com/developers/gitignore/api/gradle,intellij+all + +.kotlin/ +data/ +test-module/ + +backend/src/main/resources/static/scripts/script.js + +backend/src/main/resources/static/scripts/script.js.map + +kotlin-js-store/ + +tailwind/ + +backend/src/main/resources/static/css/tailwind.css + +output/ + +projects.zip diff --git a/README.md b/README.md index 1dc6372..7fa7d74 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# docs \ No newline at end of file +# Docs +Home to all our documentation files used on https://triumphteam.dev/. diff --git a/libraries/triumph-cmds/ICON.png b/libraries/triumph-cmds/ICON.png deleted file mode 100644 index efa3b07..0000000 Binary files a/libraries/triumph-cmds/ICON.png and /dev/null differ diff --git a/libraries/triumph-cmds/PROJECT.json b/libraries/triumph-cmds/PROJECT.json deleted file mode 100644 index 8b141d2..0000000 --- a/libraries/triumph-cmds/PROJECT.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "options": { - "name": "Triumph CMDs", - "color": [ - "#FC5C7D", - "#6A82FB" - ], - "github": "TriumphTeam/triumph-cmds" - }, - "summary": [ - { - "type": "HEADER", - "literal": "Welcome" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Introduction", - "destination": "introduction" - } - ] - }, - { - "type": "HEADER", - "literal": "Getting Started" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Setup", - "destination": "setup" - }, - { - "type": "ITEM", - "literal": "Command Manager", - "destination": "command-manager" - }, - { - "type": "ITEM", - "literal": "Commands", - "destination": "commands" - }, - { - "type": "ITEM", - "literal": "Custom Senders", - "destination": "custom-senders" - } - ] - }, - { - "type": "HEADER", - "literal": "Arguments" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Arguments", - "destination": "arguments" - }, - { - "type": "ITEM", - "literal": "Simple Arguments", - "destination": "simple-arguments" - }, - { - "type": "ITEM", - "literal": "Complex Arguments", - "destination": "complex-arguments" - }, - { - "type": "ITEM", - "literal": "Named Arguments", - "destination": "named-arguments" - }, - { - "type": "ITEM", - "literal": "Custom Arguments", - "destination": "custom-arguments" - }, - { - "type": "ITEM", - "literal": "Flags", - "destination": "flags" - }, - { - "type": "ITEM", - "literal": "Suggestions", - "destination": "suggestions" - } - ] - }, - { - "type": "HEADER", - "literal": "Customization" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Messages", - "destination": "messages" - }, - { - "type": "ITEM", - "literal": "Requirements", - "destination": "requirements" - }, - { - "type": "ITEM", - "literal": " ", - "destination": " " - }, - { - "type": "ITEM", - "literal": " ", - "destination": " " - }, - { - "type": "ITEM", - "literal": " ", - "destination": " " - }, - { - "type": "ITEM", - "literal": " ", - "destination": " " - } - ] - } - ] -} diff --git a/libraries/triumph-cmds/arguments.md b/libraries/triumph-cmds/arguments.md deleted file mode 100644 index c4d4ef8..0000000 --- a/libraries/triumph-cmds/arguments.md +++ /dev/null @@ -1,41 +0,0 @@ -

Arguments

-
-

Command argument declaration and options.

-
- ---- - -# Concept -The concept of arguments in the library are based on parameters, each parameter declared in the method will be a command argument. - -# Sender -The first parameter of the command method **must** always be a sender. You can read more about the sender [here](/library/triumph-cmds/custom-senders). - -# Creating a command with arguments -Let's create the following command `/give item diamond 5`. Where `give` is the command, `item` is the sub command, `diamond` is an argument of type `Material` and `5` is the amount or an `int`. -```java -@Command("give") -class MyClass extends BaseCommand { - - @SubCommand("item") - public void execute(Sender sender, Material material, int amount) { - sender.sendMessage("The selected material was: " + material); // Will send "DIAMOND" - sender.sendMessage("The amount was: " + amount); // Will send "5" - } -} -``` -It is as simple as that to have arguments for your command. - -## Argument Names -By default, argument names will be defined as the name of the parameter. - -The `@ArgName` annotation is used to define the name of the argument should you not want the name of the argument -to be the same as the name of the parameter. If you would like to use the parameter name as the -argument name, you can use the `-parameters` compiler flag when compiling your plugin. -```java -@SubCommand("id") -public void execute(Sender sender, @ArgName("username") Player target) { - sender.sendMessage(target.getName() + " has the id: " + target.getUniqueId()); -} -``` -In this case, the argument will be called `username` instead of the parameter name, `target`. \ No newline at end of file diff --git a/libraries/triumph-cmds/command-manager.md b/libraries/triumph-cmds/command-manager.md deleted file mode 100644 index 49da0f9..0000000 --- a/libraries/triumph-cmds/command-manager.md +++ /dev/null @@ -1,23 +0,0 @@ -

Command Manager

-
-

The basic entry for everything related to your commands.

-
- ---- - -# Creating a command manager -Each platform has its own command manager and each manager has its own sender type. -```java -// Bukkit -BukkitCommandManager manager = BukkitCommandManager.create(plugin); - -// JDA Prefixed -PrefixedCommandManager manager = PrefixedCommandManager.create(jda); - -// JDA slash -SlashCommandManager manager = SlashCommandManager.create(jda); -``` -The type parameter for the sender is necessary because you can also specify your own sender type by passing a custom `SenderMapper`. You can read more about it [here](/library/triumph-cmds/custom-senders). - -# Usage -The command manager is used for doing everything for the commands, registering commands, messages, arguments, etc. \ No newline at end of file diff --git a/libraries/triumph-cmds/commands.md b/libraries/triumph-cmds/commands.md deleted file mode 100644 index 6de16a0..0000000 --- a/libraries/triumph-cmds/commands.md +++ /dev/null @@ -1,73 +0,0 @@ -

Commands

-
-

The basic structure of a command, and its sub commands.

-
- ---- - -# Creating a simple command -Every command must extend `BaseCommand`. -You can use the `@Command` annotation to declare the command name and alias. -```java -@Command("foo") -class MyCommand extends BaseCommand {} -``` -A command can also have aliases. -```java -@Command(value = "foo", alias = {"bar", "baz"}) -class MyCommand extends BaseCommand {} -``` -Alternatively you can also declare the command name and alias through the `BaseCommand`'s constructor. -```java -class MyCommand extends BaseCommand { - - public MyCommand() { - super("foo", Arrays.asList("bar", "baz")); - } -} -``` -!!!! -The usage of the keyword `Sender` in the following examples are **not** the correct name, it just represents a sender. -As the real sender name can change based on platform or the provided custom sender. -!!! - -# Sub commands -Each sub commands are declared by methods, currently there is no other way to declare its name and alias other than through annotations. - -## Default -A `@Default` method is a "sub command without a name", implying it is the main executor of a command that has no sub commands. -For example the command `/foo` would be declared in the following way: -```java -@Command("foo") -class MyCommand extends BaseCommand { - - @Default - public void executor(Sender sender) { - // Code to be executed - } -} -``` - -## SubCommand -A `@SubCommand` is a sub command that has a specific name. For example `/foo bar` -```java -@Command("foo") -class MyCommand extends BaseCommand { - - @SubCommand("bar") - public void executor(Sender sender) { - // Code to be executed - } -} -``` - -## Alias -Both annotations also support an alias to be passed: -`@Default(alias = {"bar"})` would be executed as either `/foo` or `/foo bar`. -`@SubCommand(value = "bar", alias = {"baz"})` would be executed as either `/foo bar` or `/foo baz`. - -# Registering -Registering the command is very simple, you simply do: -```java -commandManager.registerCommand(new MyCommand()); -``` diff --git a/libraries/triumph-cmds/complex-arguments.md b/libraries/triumph-cmds/complex-arguments.md deleted file mode 100644 index 69018f3..0000000 --- a/libraries/triumph-cmds/complex-arguments.md +++ /dev/null @@ -1,37 +0,0 @@ -

Arguments

-
-

Command argument declaration and options.

-
- ---- - -# Complex arguments -By default, other more complex arguments are also allowed, for example `Collections`, like `List` or `Set`. - -# Collections -Collections are also type safe, meaning if you do `List` that means any argument that is *not* a number will be `null`, for example: -`/foo bar 1 2 3 hello 4 5` -> `[1, 2, 3, null, 4, 5]`. -Collections by default are **only** allowed as the last argument, for example: -```java -void execute(Sender sender, int number, List args); -``` -With one exception being a split argument. - -## Split argument -A split argument is a collection that is annotated by `@Split`, example: -Given the command `/foo bar diamond,iron_ingot,stone,grass_block 5`, can be declared as: -```java -void execute(Sender sender, @Split(",") List materials, int amount) { - println(materials); // Would print [DIAMOND, IRON_INGOT, STONE, GRASS_BLOCK] -} -``` - -## Join argument -The same way you can split a string into a collection, you can also join a list of arguments into a single string. -This however can only be used as the last argument of the command. -Command example: `/foo bar 5 hello there people`. -```java -void excecute(Sender sender, int number, @Join(", ") String message) { - println(message); // Would print "hello, there, people" -} -``` diff --git a/libraries/triumph-cmds/custom-arguments.md b/libraries/triumph-cmds/custom-arguments.md deleted file mode 100644 index 0affe4e..0000000 --- a/libraries/triumph-cmds/custom-arguments.md +++ /dev/null @@ -1,23 +0,0 @@ -

Arguments

-
-

Command argument declaration and options.

-
- ---- - -# Registering arguments -If you wish to create your own arguments, you can do so by using `CommandManager#registerArgument`. -This method takes 2 parameters, the first being a `Class`. This class is what will be used when defining the parameters of the command. -The second parameter is a lambda with 2 parameters, the first being the Sender object and the second being a String representing the argument input. - -## Example of registering arguments -```java -commandManager.registerArgument(LocalDate.class, (sender, argument) -> LocalDate.parse(argument)); -``` - -Now we need to use this argument in our command, given the command `/foo bar 2000-01-01`: -```java -void execute(Sender sender, LocalDate date) { - println(date); // outputs 2000-01-01 -} -``` diff --git a/libraries/triumph-cmds/custom-senders.md b/libraries/triumph-cmds/custom-senders.md deleted file mode 100644 index 17be926..0000000 --- a/libraries/triumph-cmds/custom-senders.md +++ /dev/null @@ -1,56 +0,0 @@ -

Custom Senders

-
-

Custom senders creation and registration.

-
- ---- - -# Creating a simple sender -```java -public class MySender {} -``` - -# Creating a SenderValidator -Sender Validators are used for pre command checks. -```java -public class MySenderValidator implements SenderValidator { - - // This method is used when registering, it'll check if the sender declared in the command method is valid or not - @Override - public @NotNull Set> getAllowedSenders() { - return Collections.singleton(MySender.class); - } - - @Override - public boolean validate(final @NotNull MessageRegistry messageRegistry, final @NotNull SubCommand subCommand, final @NotNull MySender sender) { - // Do any checks you want here, for example on Bukkit, this is where it checks if the subcommand is console only, or player only, etc. - // Return true if valid, false, if not, use the message registry to send messages to the player if you want - return false; - } -} -``` -Now you can either make a custom SenderMapper or just use lambda. -If you're not using lambda, then make sure you specify the correct senders. If you're using lambda it will be a little easier. -```java -class MyMapper implements SenderMapper -``` -Now time to create the command manager. We will be using the BukkitCommandManager for this example. -```java -final BukkitCommandManager manager = BukkitCommandManager.create( - plugin, - defaultSender -> new MySender(), // The mapping of the sender, pass a new instance if you don't want lambda - new MySenderValidator() // Validator -); -``` -That is all! You can now register a new command with your custom sender. -```java -@Command("foo") -class MyCommand extends BaseCommand { - - @Default - public void executor(MySender sender) { - // Code to be executed - } -} -``` -You can learn how to create and register commands [here](/library/triumph-cmds/commands). \ No newline at end of file diff --git a/libraries/triumph-cmds/flags.md b/libraries/triumph-cmds/flags.md deleted file mode 100644 index a079bcb..0000000 --- a/libraries/triumph-cmds/flags.md +++ /dev/null @@ -1,65 +0,0 @@ -

Flags

-
-

Flags, flag arguments, and everything else about flags!

-
- ---- - -# Flags -Flags, if you didn't already know, when in commands are typically short identifiers that convey bits of information -or mark what certain arguments are going to be explicitly. It's useful for controlling lots of optional arguments. -In commands, the argument would be the `-n` part of `/flag example -n=1`. - -## Example of Registering Flags - -### Without Flag Argument -```java -@Command("flag") -public class Command { - - @SubCommand("example") - @CommandFlags({@Flag(flag = "f")}) - public void execute(Sender sender, Flags flags) { - if (flags.hasFlag("f")) { - ... - } - } - -} -``` - -### With Flag Argument -```java -@Command("flag") -public class Command { - - @SubCommand("example") - @CommandFlags({@Flag(flag = "n", longFlag = "num", argument = int.class, suggestion = "numbers")}) - public void example(Sender sender, Flags flags) { - flags.getValue("n").ifPresent(arg -> { - int num = Integer.parseInt(arg); - ... - }); - } - -} -``` - -# Registering Flags -To register flags, annotate the command method with `@CommandFlags(Flag[] value)`. Then, you pass in a list -that has all flag annotations and details to link them to the command. - -Then, to access the flags, add the `Flags` parameter to the function parameters. - -## Flag Definitions -For each individual `@Flag` annotation, you can choose to define these flags with the following fields... -* `flag` - short flag definition (`/command -flag`) -* `longFlag` - long flag definition (`/command --longFlag`) -* `argument` - java class of the type of argument desired -* `suggestion` - string suggestion argument - -Either the `flag` or `longFlag` fields must be present. By default, argument is `void.class` which -corresponds to no argument. The suggestion is what will be suggested as the argument for the flag. - - - diff --git a/libraries/triumph-cmds/introduction.md b/libraries/triumph-cmds/introduction.md deleted file mode 100644 index af4f889..0000000 --- a/libraries/triumph-cmds/introduction.md +++ /dev/null @@ -1,30 +0,0 @@ -
header
- -

Triumph CMDs

-
-

- license - release - discord -

-
- ---- - -!!!! -Attention! This version is still a SNAPSHOT and many things can change. -!!! - -# Features - - -# Contributing -Contributions, issues, and feature requests are welcome! -Feel free to check [issues page](https://github.com/TriumphTeam/triumph-cmds/issues). - -# Show your support -Give a star on [GitHub](https://github.com/TriumphTeam/triumph-cmds) if this project helped you! - -# License -Copyright © 2022 [TriumphTeam](https://github.com/TriumphTeam). -This project is [MIT](https://github.com/TriumphTeam/triumph-cmds/blob/master/LICENSE) licensed. diff --git a/libraries/triumph-cmds/messages.md b/libraries/triumph-cmds/messages.md deleted file mode 100644 index f3af86f..0000000 --- a/libraries/triumph-cmds/messages.md +++ /dev/null @@ -1,32 +0,0 @@ -

Messages

-
-

Customization of error/invalid usage messages.

-
- ---- - -# Messages -The library provides many messages that are configurable through a simple structure. Any message that you modify -will be handled using the function and syntax displayed below in the example provided. - -```java -commandManager.registerMessage(MessageKey.INVALID_ARGUMENT, (sender, context) -> { - // handle sending the error message -}); -``` - -Different use-cases provide different applicable keys. You can find a list of all available keys for each module below. - -## Universal Keys -Universal keys are accessed through the `MessageKey` class. -* `INVALID_ARGUMENT` -* `TOO_MANY_ARGUMENTS` -* `NOT_ENOUGH_ARGUMENTS` -* `UNKNOWN_COMMAND` - -## Bukkit Keys -Bukkit keys are accessed through the `BukkitMessageKey` class. -* `NO_PERMISSION` -* `PLAYER_ONLY` -* `CONSOLE_ONLY` - diff --git a/libraries/triumph-cmds/named-arguments.md b/libraries/triumph-cmds/named-arguments.md deleted file mode 100644 index 054c2ab..0000000 --- a/libraries/triumph-cmds/named-arguments.md +++ /dev/null @@ -1,28 +0,0 @@ -

Arguments

-
-

Command argument declaration and options.

-
- ---- - -# Named Arguments -Named arguments allow for arguments to be named. So instead of a command being `/foo bar baz 1`, this will allow for `/foo bar string:baz, number:1`. -This also allows for arguments to be inputted in any order! - -## Example of Named Arguments -Firstly, we must register the named arguments -CommandManager#registerNamedArguments either takes a varag of `Argument`s or a `List`. -```java -commandManager.registerNamedArguments(ArgumentKey.of("example"), // the key of the argument - Argument.forString().name("string").build(), // a description and suggestion can also be set in the argument builder! - Argument.forInt().name("number").build()); -``` - -Now we need to setup our command: -```java -@NamedArguments("example") -void execute(Sender sender, Arguments arguments) { - println("string=" + arguments.get("string", String.class).get() + ", number=" + arguments.get("number", int.class).get()); // outputs string=baz, number=1 - // this is just an example, please dont use Optional#get without checking if the value is present/empty first! -} -``` diff --git a/libraries/triumph-cmds/requirements.md b/libraries/triumph-cmds/requirements.md deleted file mode 100644 index 1a916a2..0000000 --- a/libraries/triumph-cmds/requirements.md +++ /dev/null @@ -1,30 +0,0 @@ -

Requirements

-
-

Command Requirements

-
- ---- - -# Requirements -Requirements give fine control to determine whether or not a sender is allowed to run a command. - -## Example of requirements -Firstly, we need to register the requirement. -```java -commandManager.registerRequirement(RequirementKey.of("example"), (sender) -> { - // requirement logic here - return hasPermission(sender); - }) -``` - -Now we need to add the requirement to our command. -```java -@Requirement("example") -void execute(Sender sender) { - // command logic here -} -``` -## Additional Info -* Multiple requirements can be added to a command by wrapping them in a `Requirements` annotation. -* A `MessageKey` can be used in the requirement to send messages to the user upon not meeting the requirement. add the message key string to the parameters! -* Requirements can be inverted by adding a `boolean` to the annotation. diff --git a/libraries/triumph-cmds/setup.md b/libraries/triumph-cmds/setup.md deleted file mode 100644 index d28c310..0000000 --- a/libraries/triumph-cmds/setup.md +++ /dev/null @@ -1,111 +0,0 @@ -

Setup

-
-

This is how you add the lib to your project.

-
- ---- - -# Version -Make sure to replace `{version}` with the latest version (`%version%`). - -# Platform -Make sure to replace `{platform}` with one of the following: - -* `bukkit` - For any Bukkit based plugin, Spigot, Paper, etc. -* `jda-prefixed` - For prefixed commands for JDA, for example `!test`. -* `jda-slash` - For JDA slash commands. - --+- -+Gradle (Kotlin)+ -You need to add the dependency to your `build.gradle.kts`. -```kotlin -repositories { - maven("https://repo.triumphteam.dev/snapshots/") -} - -dependencies { - implementation("dev.triumphteam:triumph-cmd-{platform}:{version}") // Replace version here -} -``` -In order to include the lib in your project, you need to add `shadow` plugin `build.gradle.kts`. -Replace `[YOUR PACKAGE]` with your plugin's package, for example `me.myplugin.plugin`. -```kotlin -// This goes on the top of the build script. -plugins { - id("com.github.johnrengelman.shadow") version "7.0.0" -} - -// This can go anywhere. -shadowJar { - relocate("dev.triumphteam.cmd", "[YOUR PACKAGE].cmd") -} -``` -+++ -+Gradle (Groovy)+ -You need to add the dependency to your `build.gradle`. -```groovy -repositories { - maven { url = "https://repo.triumphteam.dev/snapshots/" } -} - -dependencies { - implementation "dev.triumphteam:triumph-cmd-{platform}:{version}" // Replace version here -} -``` -In order to include the lib in your project, you need to add `shadow` plugin `build.gradle`. -Replace `[YOUR PACKAGE]` with your plugin's package, for example `me.myplugin.plugin`. -```groovy -// This goes on the top of the build script. -plugins { - id "com.github.johnrengelman.shadow" version "7.0.0" -} - -// This can go anywhere. -shadowJar { - relocate("dev.triumphteam.cmd", "[YOUR PACKAGE].cmd") -} -``` -+++ -+Maven+ -You need to add the dependency to your `pom.xml`. -```xml - - - repo - https://repo.triumphteam.dev/snapshots/ - - - - - dev.triumphteam - triumph-cmd-{platform} - {version} - -``` -In order to include the framework in your project, you need the shade plugin. -Replace `[YOUR PACKAGE]` with your plugin's package, for example `me.myplugin.plugin`. -```xml - - org.apache.maven.plugins - maven-shade-plugin - 3.1.1 - - - - dev.triumphteam.cmd - [YOUR PACKAGE].cmd - - - - - - package - - shade - - - - -``` -+++ --+- diff --git a/libraries/triumph-cmds/simple-arguments.md b/libraries/triumph-cmds/simple-arguments.md deleted file mode 100644 index 8ad921c..0000000 --- a/libraries/triumph-cmds/simple-arguments.md +++ /dev/null @@ -1,32 +0,0 @@ -

Arguments

-
-

Command argument declaration and options.

-
- ---- - -By default, the library adds many argument types. - -# Common: -* `short`/`Short` -* `int`/`Integer` -* `long`/`Long` -* `float`/`Float` -* `double`/`Double` -* `boolean`/`Boolean` -* `String` -* `Enums` - Any type of enums, for example `Material`. - -Additionally, each platform also adds a few default types. - -# Bukkit: -* `Material` - Uses `matchMaterial` instead of `valueOf` by overriding default enum behavior. -* `Player` -* `World` - -# JDA: -* `User` -* `Member` -* `TextChannel` -* `VoiceChannel` -* `Role` \ No newline at end of file diff --git a/libraries/triumph-cmds/suggestions.md b/libraries/triumph-cmds/suggestions.md deleted file mode 100644 index 55651fd..0000000 --- a/libraries/triumph-cmds/suggestions.md +++ /dev/null @@ -1,38 +0,0 @@ -

Suggestions

-
-

Argument Suggestions

-
- ---- - -# Suggestions -Suggestions, as the name suggests, allow for command inputs to be suggested to the user based on the argument required. - -## Registering suggestions -There are two ways to register suggestions: -The first way is to register by `Class` type. This will make all arguments using the class type use the suggestion resolver. -The second way is to register by using a `SuggestionKey`. This will only resolve suggestion when parameters are annotated with `@Suggestion`. -Both of these methods will have a second parameter of a lambda that has 2 parameters of the Sender object, alongside the `SuggestionContext` and will return a `List`. - -## Registering by Class - -```java -commandManager.registerSuggestion(LocalDate.class, (sender, context) -> List.of(LocalDate.now(), LocalDate.EPOCH)); // suggest today's date and epoch date -``` -That's all for registering with class types! Now this will be the default suggestion resolver for LocalDate arguments. - -## Registering with Suggestion Keys - -```java -commandManager.registerSuggestion(SuggestionKey.of("formatted-dates"), (sender, context) -> { - var pattern = DateTimeFormatter.ofPattern("dd/MM/yyyy"); - return Stream.of(LocalDate.now(), LocalDate.EPOCH).map(pattern::format).toList(); // suggest dates in a different format - }) -``` - -Now that the suggestion is registered, we must annotate the argument. -```java -void execute(Sender sender, @Suggestion("formatted-dates") LocalDate date) { - // command logic here -} -``` diff --git a/libraries/triumph-core/ICON.png b/libraries/triumph-core/ICON.png deleted file mode 100644 index 9de188d..0000000 Binary files a/libraries/triumph-core/ICON.png and /dev/null differ diff --git a/libraries/triumph-core/PROJECT.json b/libraries/triumph-core/PROJECT.json deleted file mode 100644 index 1f93eba..0000000 --- a/libraries/triumph-core/PROJECT.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "options": { - "name": "Triumph Core", - "color": [ - "#5D3D90", - "#A157BE" - ], - "github": "TriumphTeam/triumph-core" - }, - "summary": [ - { - "type": "HEADER", - "literal": "Welcome" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Introduction", - "destination": "introduction" - } - ] - }, - { - "type": "HEADER", - "literal": "Getting Started" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Setup", - "destination": "setup" - }, - { - "type": "ITEM", - "literal": "Core", - "destination": "core" - } - ] - }, - { - "type": "HEADER", - "literal": "Features - Bukkit" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Commands", - "destination": "feature-bukkit-commands" - } - ] - } - ] -} diff --git a/libraries/triumph-core/core.md b/libraries/triumph-core/core.md deleted file mode 100644 index b72b99e..0000000 --- a/libraries/triumph-core/core.md +++ /dev/null @@ -1,60 +0,0 @@ -

Core

-
-

Basics about the core.

-
- ---- - -# Core -This library is heavily based on the Kotlin framework **[ktor](https://ktor.io/)**. -The main utility of the core library is to simplify adding and getting "features" of the plugin. - -# What are features? -"Feature" is a concept for anything that adds to the application. You can think of it like "register-ables", something that you can register and use later. -For example, you want a "PlayerManager", you can turn that into a "feature" that can be easily installed with `install(PlayerManager)` and gotten with `feature(PlayerManager)`. - -# Platforms -Currently, you can use it for `Bukkit` and `JDA`. - -# Creating a feature -Firstly let's create a simple feature that allows us to print `hello`. -```kotlin -// Main feature class -class Print { - - // Function we want to call from the feature - fun printHello() { - println("hello") - } - - // Feature companion, the type parameters are - // The configuration can be anything, therefore also the main feature - companion object Feature : ApplicationFeature { - override val key = key("print") - - override fun install(application: TriumphApplication, configure: Print.() -> Unit): Print { - // Creates an instance of the feature and applies the configuration - return Print().apply(configure) - } - } -} -``` - -# Creating a Bukkit application -As an example let's create a simple application (plugin) to use our feature. -```kotlin -class MyPlugin : BukkitApplication() { - - override fun onEnable() { - // Installing our first feature - install(Print) - } -} -``` -Now let's say we want to use the `printHello` function. -```kotlin -// If you are not sure if the application is present you can use `featureOrNull` instead -// Or alternatively you can also do application[Print] -val print = application.feature(Print) -print.printHello() -``` diff --git a/libraries/triumph-core/feature-bukkit-commands.md b/libraries/triumph-core/feature-bukkit-commands.md deleted file mode 100644 index 10584d9..0000000 --- a/libraries/triumph-core/feature-bukkit-commands.md +++ /dev/null @@ -1,70 +0,0 @@ -

Bukkit commands feature

-
-

Feature that simplifies using and registering commands.

-
- ---- - -# Dependency --+- -+Gradle (Kotlin)+ -```kotlin -dependencies { - implementation("dev.triumphteam:triumph-core-feature-bukkit-commands:%version%") // Replace version here -} -``` -+++ -+Gradle (Groovy)+ -```groovy -dependencies { - implementation "dev.triumphteam:triumph-core-feature-bukkit-commands:%version%"" // Replace version here -} -``` -+++ -+Maven+ -```xml - - dev.triumphteam - triumph-core-feature-bukkit-commands - %version% - -+++ --+- - -# Creating the commands feature -For now let's just use the default `CommandSender` for bukkit, but this feature allows you to use custom ones. -This is useful because you can completely abstract the code to work on multiple platforms without much change if any at all. -```kotlin -class MyCommands(plugin: BukkitApplication) : - Commands(plugin, SenderMapper.defaultMapper(), Validator()) { - - companion object Feature : CommandFeature { - - override val key = key("my-commands") - - override fun install(application: BukkitApplication, configure: MyCommands.() -> Unit): MyCommands { - return MyCommands(application).apply(configure) - } - } -} -``` - -# Registering commands -Now that the feature is created, you can either install it with `install(MyCommands)` or just use the `commands` block directly. -```kotlin -override fun onEnable() { - commands(MyCommands) { - // Registering a suggestion - suggestion(SuggestionKey.of("example")) { sender, context -> listOf("example1", "example2", "example3") } - - // Registering an argument - argument { sender, arg -> Material.matchMaterial(arg) } - - // Registering commands - register( - CommandOne(), - CommandTwo(), - CommandTree(), - ) - } -} \ No newline at end of file diff --git a/libraries/triumph-core/introduction.md b/libraries/triumph-core/introduction.md deleted file mode 100644 index 4bee900..0000000 --- a/libraries/triumph-core/introduction.md +++ /dev/null @@ -1,28 +0,0 @@ -
header
- -

Triumph CORE

-
-

- license - language - release - language -

-
- ---- - -!!!! -Attention! This version is still a SNAPSHOT and many things can change. -!!! - -# Contributing -Contributions, issues, and feature requests are welcome! -Feel free to check [issues page](https://github.com/TriumphTeam/triumph-core/issues). - -# Show your support -Give a star on [GitHub](https://github.com/TriumphTeam/triumph-core) if this project helped you! - -# License -Copyright © 2022 [TriumphTeam](https://triumphteam.dev/). -This project is [MIT](https://github.com/TriumphTeam/triumph-core/blob/master/LICENSE) licensed. diff --git a/libraries/triumph-core/setup.md b/libraries/triumph-core/setup.md deleted file mode 100644 index 3c10310..0000000 --- a/libraries/triumph-core/setup.md +++ /dev/null @@ -1,110 +0,0 @@ -

Setup

-
-

This is how you add the lib to your project.

-
- ---- - -# Version -Make sure to replace `{version}` with the latest version (`%version%`). - -# Platform -Make sure to replace `{platform}` with one of the following: - -* `bukkit` - For any Bukkit based plugin, Spigot, Paper, etc. -* `jda` - For *well* JDA. - --+- -+Gradle (Kotlin)+ -You need to add the dependency to your `build.gradle.kts`. -```kotlin -repositories { - maven("https://repo.triumphteam.dev/snapshots/") -} - -dependencies { - implementation("dev.triumphteam:triumph-core-{platform}:%version%") // Replace version here -} -``` -In order to include the library in your project, you need to add `shadow` plugin `build.gradle.kts`. -Replace `[YOUR PACKAGE]` with your package, for example `me.myplugin.plugin`. -```kotlin -// This goes on the top of the build script. -plugins { - id("com.github.johnrengelman.shadow") version "7.0.0" -} - -// This can go anywhere. -shadowJar { - relocate("dev.triumphteam.core", "[YOUR PACKAGE].core") -} -``` -+++ -+Gradle (Groovy)+ -You need to add the dependency to your `build.gradle`. -```groovy -repositories { - maven { url = "https://repo.triumphteam.dev/snapshots/" } -} - -dependencies { - implementation "dev.triumphteam:triumph-core-{platform}:%version%"" // Replace version here -} -``` -In order to include the library in your project, you need to add `shadow` plugin `build.gradle`. -Replace `[YOUR PACKAGE]` with your package, for example `me.myplugin.plugin`. -```groovy -// This goes on the top of the build script. -plugins { - id "com.github.johnrengelman.shadow" version "7.0.0" -} - -// This can go anywhere. -shadowJar { - relocate("dev.triumphteam.core", "[YOUR PACKAGE].core") -} -``` -+++ -+Maven+ -You need to add the dependency to your `pom.xml`. -```xml - - - repo - https://repo.triumphteam.dev/snapshots/ - - - - - dev.triumphteam - triumph-core-{platform} - %version% - -``` -In order to include the library in your project, you need the shade plugin. -Replace `[YOUR PACKAGE]` with your package, for example `me.myplugin.plugin`. -```xml - - org.apache.maven.plugins - maven-shade-plugin - 3.1.1 - - - - dev.triumphteam.core - [YOUR PACKAGE].core - - - - - - package - - shade - - - - -``` -+++ --+- diff --git a/libraries/triumph-gui/PROJECT.json b/libraries/triumph-gui/PROJECT.json deleted file mode 100644 index 65775a4..0000000 --- a/libraries/triumph-gui/PROJECT.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "options": { - "name": "Triumph GUI", - "color": ["#37EF7D", "#11998D"], - "github": "TriumphTeam/triumph-gui" - }, - "summary": [ - { - "type": "HEADER", - "literal": "Welcome" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Introduction", - "destination": "introduction" - } - ] - }, - { - "type": "HEADER", - "literal": "Getting Started" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "Setup", - "destination": "setup" - } - ] - }, - { - "type": "HEADER", - "literal": "Types" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "GUI", - "destination": "gui" - }, - { - "type": "ITEM", - "literal": "PaginatedGUI", - "destination": "pagegui" - }, - { - "type": "ITEM", - "literal": "ScrollingGUI", - "destination": "scrollgui" - }, - { - "type": "ITEM", - "literal": "StorageGUI", - "destination": "storagegui" - } - ] - }, - { - "type": "HEADER", - "literal": "Additional Options" - }, - { - "type": "LIST", - "children": [ - { - "type": "ITEM", - "literal": "GUI Features", - "destination": "features" - } - ] - } - ] -} diff --git a/libraries/triumph-gui/assets/ezgif-6-0f0b0eb384f3.gif b/libraries/triumph-gui/assets/ezgif-6-0f0b0eb384f3.gif deleted file mode 100644 index 7585df7..0000000 Binary files a/libraries/triumph-gui/assets/ezgif-6-0f0b0eb384f3.gif and /dev/null differ diff --git a/libraries/triumph-gui/assets/ezgif-6-90e434269b68.gif b/libraries/triumph-gui/assets/ezgif-6-90e434269b68.gif deleted file mode 100644 index 7b7e644..0000000 Binary files a/libraries/triumph-gui/assets/ezgif-6-90e434269b68.gif and /dev/null differ diff --git a/libraries/triumph-gui/assets/ezgif-6-be4759200973.gif b/libraries/triumph-gui/assets/ezgif-6-be4759200973.gif deleted file mode 100644 index 27799ea..0000000 Binary files a/libraries/triumph-gui/assets/ezgif-6-be4759200973.gif and /dev/null differ diff --git a/libraries/triumph-gui/assets/screenshot_8.png b/libraries/triumph-gui/assets/screenshot_8.png deleted file mode 100644 index f8e6429..0000000 Binary files a/libraries/triumph-gui/assets/screenshot_8.png and /dev/null differ diff --git a/plugins/placeholder.txt b/plugins/placeholder.txt deleted file mode 100644 index e69de29..0000000 diff --git a/settings.conf b/settings.conf new file mode 100644 index 0000000..e3430ff --- /dev/null +++ b/settings.conf @@ -0,0 +1 @@ +editPath = "https://github.com/TriumphTeam/docs/blob/main/" diff --git a/triumph-gui/3_x_x/0-welcome/group.conf b/triumph-gui/3_x_x/0-welcome/group.conf new file mode 100644 index 0000000..d2b5395 --- /dev/null +++ b/triumph-gui/3_x_x/0-welcome/group.conf @@ -0,0 +1,7 @@ +header = "Welcome" +pages = [ + { + header = "Introduction" + link = "introduction" + } +] diff --git a/libraries/triumph-gui/introduction.md b/triumph-gui/3_x_x/0-welcome/introduction.md similarity index 92% rename from libraries/triumph-gui/introduction.md rename to triumph-gui/3_x_x/0-welcome/introduction.md index 60b7737..6eef3aa 100644 --- a/libraries/triumph-gui/introduction.md +++ b/triumph-gui/3_x_x/0-welcome/introduction.md @@ -1,3 +1,8 @@ +

Introduction

+
+

This is just an example text for now.

+
+
license

Triumph GUI

diff --git a/triumph-gui/3_x_x/1-started/group.conf b/triumph-gui/3_x_x/1-started/group.conf new file mode 100644 index 0000000..929f764 --- /dev/null +++ b/triumph-gui/3_x_x/1-started/group.conf @@ -0,0 +1,7 @@ +header = "Getting Started" +pages = [ + { + header = "Setup" + link = "setup" + } +] diff --git a/libraries/triumph-gui/setup.md b/triumph-gui/3_x_x/1-started/setup.md similarity index 99% rename from libraries/triumph-gui/setup.md rename to triumph-gui/3_x_x/1-started/setup.md index c6982f8..800125b 100644 --- a/libraries/triumph-gui/setup.md +++ b/triumph-gui/3_x_x/1-started/setup.md @@ -72,7 +72,7 @@ You need to add the dependency to your pom.xml. In order to include the framework in your project, you need to add the following to your `pom.xml`, in the plugins section. Replace `[YOUR PACKAGE]`with your plugin's package, for example `me.myplugin.plugin`. -```markup +```xml org.apache.maven.plugins maven-shade-plugin diff --git a/triumph-gui/3_x_x/2-types/group.conf b/triumph-gui/3_x_x/2-types/group.conf new file mode 100644 index 0000000..45c9830 --- /dev/null +++ b/triumph-gui/3_x_x/2-types/group.conf @@ -0,0 +1,19 @@ +header = "Types" +pages = [ + { + header = "GUI" + link = "gui" + } + { + header = "Paginated GUI" + link = "pagegui" + } + { + header = "Scrolling GUI" + link = "scrollgui" + } + { + header = "Storage GUI" + link = "storagegui" + } +] diff --git a/libraries/triumph-gui/gui.md b/triumph-gui/3_x_x/2-types/gui.md similarity index 97% rename from libraries/triumph-gui/gui.md rename to triumph-gui/3_x_x/2-types/gui.md index da5493e..14d4d54 100644 --- a/libraries/triumph-gui/gui.md +++ b/triumph-gui/3_x_x/2-types/gui.md @@ -5,7 +5,7 @@ # GUI -![](./assets/screenshot_8.png) +![](https://i.imgur.com/pXnpNal.png) # Creating a GUI diff --git a/libraries/triumph-gui/pagegui.md b/triumph-gui/3_x_x/2-types/pagegui.md similarity index 97% rename from libraries/triumph-gui/pagegui.md rename to triumph-gui/3_x_x/2-types/pagegui.md index 244e5b1..e0c9bb7 100644 --- a/libraries/triumph-gui/pagegui.md +++ b/triumph-gui/3_x_x/2-types/pagegui.md @@ -5,7 +5,7 @@ # Paginated GUI -![](./assets/ezgif-6-90e434269b68.gif) +![](https://i.imgur.com/PqNYUIs.gif) # Creating a Paginated GUI diff --git a/libraries/triumph-gui/scrollgui.md b/triumph-gui/3_x_x/2-types/scrollgui.md similarity index 95% rename from libraries/triumph-gui/scrollgui.md rename to triumph-gui/3_x_x/2-types/scrollgui.md index 690616b..d962a7e 100644 --- a/libraries/triumph-gui/scrollgui.md +++ b/triumph-gui/3_x_x/2-types/scrollgui.md @@ -6,7 +6,7 @@ # Scrolling GUI -![](./assets/ezgif-6-be4759200973.gif) +![](https://i.imgur.com/nadBZEL.gif) # Creating a Scrolling GUI diff --git a/libraries/triumph-gui/storagegui.md b/triumph-gui/3_x_x/2-types/storagegui.md similarity index 95% rename from libraries/triumph-gui/storagegui.md rename to triumph-gui/3_x_x/2-types/storagegui.md index d7ccaaf..62d7136 100644 --- a/libraries/triumph-gui/storagegui.md +++ b/triumph-gui/3_x_x/2-types/storagegui.md @@ -9,7 +9,7 @@ Attention! Items stored inside this GUI will not Persist on Server Restart. # Storage GUI -![](./assets/ezgif-6-0f0b0eb384f3.gif) +![](https://i.imgur.com/fcqrvnp.gif) # Creating a Persistent GUI diff --git a/libraries/triumph-gui/features.md b/triumph-gui/3_x_x/3-additional/features.md similarity index 99% rename from libraries/triumph-gui/features.md rename to triumph-gui/3_x_x/3-additional/features.md index 1393dd2..b016e90 100644 --- a/libraries/triumph-gui/features.md +++ b/triumph-gui/3_x_x/3-additional/features.md @@ -3,7 +3,7 @@

After the basics of a GUI there is a lot more useful features you can use.

-## Common features +# Common features The following are the common features in all GUIs. diff --git a/triumph-gui/3_x_x/3-additional/group.conf b/triumph-gui/3_x_x/3-additional/group.conf new file mode 100644 index 0000000..4d962f5 --- /dev/null +++ b/triumph-gui/3_x_x/3-additional/group.conf @@ -0,0 +1,7 @@ +header = "Additional Options" +pages = [ + { + header = "GUI Features" + link = "features" + } +] diff --git a/triumph-gui/3_x_x/version.conf b/triumph-gui/3_x_x/version.conf new file mode 100644 index 0000000..797a448 --- /dev/null +++ b/triumph-gui/3_x_x/version.conf @@ -0,0 +1,2 @@ +reference = "3.x.x" +recommended = true diff --git a/libraries/triumph-gui/ICON.png b/triumph-gui/icon.png similarity index 100% rename from libraries/triumph-gui/ICON.png rename to triumph-gui/icon.png diff --git a/triumph-gui/project.conf b/triumph-gui/project.conf new file mode 100644 index 0000000..c805337 --- /dev/null +++ b/triumph-gui/project.conf @@ -0,0 +1,4 @@ +id = "triumph-gui" +name = "Triumph GUI" +color = "#18A88B" +projectHome = "https://github.com/TriumphTeam/trumph-gui"