Skip to content
LPDMinecraft edited this page Dec 30, 2021 · 15 revisions

Lcraft APIs

Welcome to the Lcraft API Wiki! Here you can find out all the details, classes, functions and why this API with its module system might be useful for you. We want to help you optimise and develop your code for your Minecraft plugin. Such as:

  • Your code structure
  • Your order
  • That you need less classes for the same result We have programmed and set up a complete module system for Bungeecord and Bukkit plugins and are working all the time to make this even more optimised and easier.

First Steps

Setup

Go into your InteliJ Proyekt
Select File > Project Structure
Go on Libraries
Go on the + and then Java
Select the Lcraft API File
Select your projekt to add it on
You can select multimodules with CLR
The press "OK"

module.yml

Please follow 1 to 1 this order of the objects

name: 'My TestModule'
description: This is my TestModule
version: '1.0'
spigot-main: de.lcraft.test.Module
bungee-main: de.lcraft.test.Module
author: Lcraft
authors:
  - LPD
  - LetsPlayNik
  - Lcraft
required-modules: 'Lcraft-API, Lcraft Permissions API, Lcraft Languages API'

The Name is the name of your module. In the description you can describe your plugin. Under Version you can set a version that you can vary as you please. For Bukkit plug-ins and Bungeecord plug-ins, you can set two different main modules. These must be different because the complete module system is divided into several areas/systems and the BungeeCord system is completely different from the Spigot system. You can set author and authors, in the end it is an ArrayList that counts both together. This way you can also symbolise, for example, main programmers and helpers. At the required-modules you can name all Modules you use. You have to have these required modules, but you can also add others.

Module class

We will explain how to create a class, but not how to create classes and import methods. So you need a little experience in this area because it is basic Java and programming knowledge.

Spigot

Spigot That is a spigot module, you extend the class of "de.lcraft.api.minecraft.spigot.manager.Module", then you have to import the onEnable() and onDisable() Methods. You can get the CommandManager with getCommandManager(); and the ListenerManager with getListenerManager().

BungeeCord

BungeeCord That is a bungeecord module, you extend the class of "de.lcraft.api.minecraft.bungee.manager.Module", then you have to import the onEnable() and onDisable() Methods. You can get the CommandManager with getCommandManager(); and the ListenerManager with getListenerManager()

Explanation

Config

The Config is a class, that can create config files. There are three constructures:

public Config(String startPath, String path, String filename)
public Config(String path, String filename)
public Config(String filename)

The first constructor is the most important. It can create configurations in any folder in the server folder. The second and third construct is for the configurations used by the API for configuration. If you search a Config for your Module use the ModuleConfig

You can get the normal YamlConfiguration with the Getter-Method cfg(). To save it you can use the save() Method. You can set and get ArrayLists with the Methods saveArrayList(ArrayList list, String root) and getArrayList(String root).

There is a getter( getOption(String path, Object start) ), that: If the path dont exists

  • It creates the path and set Object start to it
  • It returns the Object start When the path exists
  • It gets you the value from the path

ModuleConfig

The ModuleConfig is a Config that differs only with the composition. The only new thing about ModuleConfig is that you can specify your module and the config is created in the module folder.

ModuleDescriptionFile

The ModuleDescriptionFile is a class, that stores information from the ModuleDescriptionFile(module.yml). In your module class you get it with the method getModuleDescriptionFile(); When you create it, it needs the ModuleDescriptionFile(module.yml) as variable. Then it checks with a method if it hasEnoughInformations. It looks for name, spigot-main or bungee-main, version, authors or author, description and requiried-modules. After this little check it sets all varibabels of himself to the information he got from the file. Also there are many getters, but no setters.

ModuleCommandManager

You can get the Command Manager in you module class with getModuleCommandManager() With the method addCommand(ModuleCommand, boolean canDisableInConfig) add a Command. With the attribute canDisableInConfig, you can set if someone can disable this config.

ModuleCommand

You need to create a class with the name of your command and at the end command. You need to import the methods. With the getAllPermissions and getAllTranslations methods, you must also return the respective specified variable with return;.

In the constructur super() are many variables, that you can set in the class, if you do that, you can remove the variables, that you set in the super(); delete in the constructur.

If you set constructur splitting to false, only the method onCommandExecute() is executed when the command is executed. If you also set it to true, then it is split between two methods name onLPlayerCommand and onConsoleCommand. In this mode, onCommandExecute will still work.

Also there are sendMessageCommands, that sends with the logger info, warning, error and default messages. You can translate with the translate() Method and look for permissions with the hasPermissions() Method.

You can also add ModuleSubCommands, with the addSubCommand() Method.

ModuleSubCommand

Its the same like ModuleCommands, but the only diffrent is, that is not like /hello, but it can make to the command /hello the subcommand test so it can named /hello test. But you can also make to a SubCommand a SubCommand like /hello test hello, because every SubCommand is a Command, that can have SubCommands.

ModuleListenerManager

You can get the Command Manager in you module class with getListenerManager()

Supports

Servers Bukkit Spigot Paper Pupur
1.16 ✔️ ✔️ ✔️ ✔️
1.17 ✔️ ✔️ ✔️ ✔️
1.18 ✔️ ✔️ ✔️ ✔️
Proxies BungeeCord Waterfall Velocity
1.16 ✔️ ✔️ ✔️
1.17 ✔️ ✔️ ✔️
1.18 ✔️ ✔️ ✔️

Help map

Commands

Improved Bukkit classes/utils

  • LPlayer
  • CraftingRecipes
  • Inventorys
  • ItemBuilders
  • Other Utils

Improved BungeeCord classes/utils

  • LPlayer

Update Map

Version 1.0.0

Version 1.0.1

Version 1.0.2

Version 1.0.3

Version 1.0.4

Version 1.0.5

Version 1.0.6

Version 1.0.7

Version 1.0.8

Clone this wiki locally