Releases: UndefinedCreations/UndefinedAPI
0.5.00
0.4.00
Scoreboard
We have made it easy to create scoreboards when using this API. Instead of have to create teams and score in the spigot api. You can just create a UndefinedScoreboard
class. After that you can create line with addEmptyLine()
, addLine(String)
and addValueLine(Int, String, String)
. (See below)
Kotlin
player.scoreboard = Bukkit.getScoreboardManager().newScoreboard
UndefinedScoreboard("Test", player.scoreboard)
.addLine("IDK")
.addEmptyLine()
.addEmptyLine()
.addValueLine(0, "Prefix ", " Suffix")
Java
ScoreboardManager manager = Bukkit.getScoreboardManager();
player.setScoreboard(manager.getNewScoreboard());
UndefinedScoreboard board = new UndefinedScoreboard("Test", player.getScoreboard());
board.addLine("IDK");
board.addEmptyLine();
board.addEmptyLine();
board.addValueLine(0, "Prefix ", " Suffix");
Changing value line
To be able to change a value line you can use the setValueLine(Int, String, String)
. The Int
is the id of the line. (See below)
Kotlin
board.setValueLine(0, "Prefix2 ", " Suffix2")
board.setValueLine(0, prefix = "Prefix2 ")
board.setValueLine(0, suffix = " Suffix")
Java
board.setValueLine(0, "Prefix2 ", " Suffix2");
board.setValueLine(0, "Prefix2 ", null);
board.setValueLine(0, null, " Suffix");
0.3.5v
Menu page update. String to small text
0.3.4v
Mutli Button
0.3.3v
Maven Repo Update
Page Menu
Paged Menu
Caution
KOTLIN ONLY
To be able to create a custom paged Menu you will need to extend the UndefinedPageMenu
. Its never the same as a normal Menu but you will need to pase a List
of itemStacks witch will be sorted into pages. When the same as the normal Menu you will to extend the generateInventory
method with createPageInventory
method.
After that put in your back button and next button using the setBackButton
and setNextButton
. You are able to shape the inventory to your liking. (See below)
Note
You need to have the setBackButton
and setNextButton
for the gui to work.
class FunGui(list: List<ItemStack>): UndefinedPageMenu("Fun", MenuSize.LARGE, list) {
override fun generateInventory(): Inventory = createPageInventory {
setBackButton(PageButton(45, ItemStack(Material.RED_STAINED_GLASS_PANE), ItemStack(Material.GRAY_STAINED_GLASS_PANE)))
setNextButton(PageButton(53, ItemStack(Material.LIME_STAINED_GLASS_PANE), ItemStack(Material.GRAY_STAINED_GLASS_PANE)))
setColumn(6, ItemBuilder(Material.LIGHT_GRAY_STAINED_GLASS_PANE).setName(" ").build())
}
}
When lastly extend the clickData: ClickData.()
witch will run then the gui is pressed. (See below)
override var clickData: ClickData.() -> Unit = {
println("DIAMONDS")
}
0.03v
Scheduler
Caution
KOTLIN ONLY
Note
TimeUntil class was taken from TwilightAPI
This API makes it easier to create tasks by make methods that be accessed any were. We are going to start by running code sync and async by using this. (See below)
sync {
//Run sync code
}
async {
//Run async code
}
Delay
Next is delaying a task. This is not much different. (See below)
delay(20) {
//This task will be run in 20 ticks
}
delay(20, true) {
//This task will be run in 20 ticks async
}
delay(1, TimeUnit.SECONDS, false){
//This task will be run is 20 ticks sync
}
Repeating
Last one is creating repeating tasks. With this you will be able to give in how many times the task will run as wel. (See below)
repeatingTask(1) {
//This will run every tick
}
repeatingTask(20, 5){
//This will run every 20 ticks 5 times
}
repeatingTask(1, true){
//This will run every tick async
}
repeatingTask(20, true, 5){
//This will run every 20 ticks 5 times async
}
repeatingTask(1, TimeUnit.SECONDS){
//This will run every second
}
repeatingTask(1, TimeUnit.SECONDS, 5){
//This will run every second 5 times
}
repeatingTask(1, TimeUnit.SECONDS, true){
//This will run every second async
}
repeatingTask(1, TimeUnit.SECONDS, 5, true){
//This will run every second 5 times async
}
Event Rework
Events
Caution
KOTLIN ONLY
When using this API you won't need to do and registering of event or even extending the Listener
class. Even creating custom events is easier.
Listening
Listening to an event is straight forward and easy. You need to create a method called event<EventType>
. (See below)
event<PlayerJoinEvent> {
//Player Join
}
To be able to unregister the listener you can very easily put .unregister
at the end. (See below)
event<PlayerJoinEvent> {
//Player Join
}.unregister()
0.02v
Events
When using this api for events you won't need to register any events or even extend the Listener Class. The only thing you will need to do to make events work is create a method with the @EventHandler
and the event type as the first parameter. (See below)
Kotlin
@EventHandler
fun onJoin(e: PlayerJoinEvent){
//Code
}
Java
@EventHandler
public void onJoin(PlayerJoinEvent e){
//Code
}
0.1V
First version.
Features:
- Command Manager
- GUI/Menu Manager
- ItemBuilder
- File Utils
- Inventory Utils
- JSON Utils
- Location Utils
- Random Utils