-
Notifications
You must be signed in to change notification settings - Fork 83
API tutorial
Currently very outdated!
Welcome to the DungeonsXL API tutorial. The API aims to be as powerful and user-friendly as possible. Please submit issues or pull requests if you think that important methods are missing!
In DungeonsXL 0.11, you'll find many methods without explanation why they are marked as deprecated and without links to supported methods. This is because even though the code has been made a lot more dynamic in 0.10 and 0.11, there is still some work to do. Deprecated methods in DungeonsXL will not stay part of the plugin for legacy reasons. They are still working and in use - the problem is that they are very unlikely to exist or to work the same way in the release version 1.0. This does not mean that methods which are not deprecated are guaranteed to be part of the release, though. Unfortunately, promises are not possible at all, yet.
This list contains some the most important objects you'll probably have to deal with if you create addons for DungeonsXL.
DungeonsXL is the main class of the DungeonsXL plugin. It extends BRPlugin which extends JavaPlugin. Its purpose is to handle things which have to happen when the plugin loads and to initialize and store objects.
There are some different representations of a player. The DPlayers class handles it.
The main representation for all players that are online.
Extends DGlobalPlayer.
Represents players who edit a map.
Currently not in use.
Extends DGlobalPlayer.
Represents players who play a dungeon.
Deprecated: Also represents players who edit a map.
A DPlayer contains a DSavePlayer object.
Represents players saved in the savePlayers.yml file, usually because they are in a dungeon. Therefore, DSavePlayer is a bridge to make a DPlayer persistent.
A collection of _DPlayer_s who are a team in a dungeon.
Primarily, a Game is a collection of _DGroup_s.
A Game also has a GameType. GameType is an interface and its implementation is an enum called GameTypeDefault. A game type defines some game rules additionally to those configured in the configs. _GameType_s allow admins to easily use a map for different purposes.
A GameWorld is the representation of a played map. A GameWorld may or may not have a running Game.
TO DO
TO DO
TO DO
TO DO
DungeonsXL provides a feature-rich event system to allow you to hook into its actions as good as possible.
TO DO
TO DO
TO DO
TO DO
TO DO
TO DO
TO DO
TO DO
TO DO
This topic shows you examples how to create common custom contents with the DXL API.
DungeonsXL uses the command API provided by BRCommons. Therefore, creating custom subcommands to /dxl is simple. Just create a new class which extends BRCommand, like, for example, this one. Then, add this to your onEnable() method in the main class:
@Override
public void onEnable() {
BRCommands dCommands = DungeonsXL.getInstance().getCommands();
dCommands.addCommand(new MyCommandExtendsBRCommand());
dCommands.addCommand(new YetAnotherCustomCommand());
}
GameType is an interface sothat you can implement it in a new enum in your addon to add new values. Have a look at the default implementation to see how to do that.
After you created your own implementation of GameType, you should add it to the instance of the game type handler class: GameTypes.
@Override
public void onEnable() {
GameTypes gameTypes = DungeonsXL.getInstance().getGameTypes();
for (GameType gameType : MyGameTypeImplementation.values()) {
gameTypes.addGameType(gameType);
}
}
TO DO
TO DO
TO DO
TO DO
TO DO
Wiki: © 2015-2021 Daniel Saukel and contributors, licensed under CC BY-SA (only unless otherwise stated)
- General information
- General setup and usage
- Dungeon setup
- Signs
- Game rules
- Linked dungeon configuration
- Dungeon world configuration
- Details
- Examples (WIP)
- Simple dungeon
- Bedwars TODO
- PVP arena TODO
- Mob arena TODO
- Tutorial TODO
- Data structure guide
- FAQ