Changes
Page history
Updated api examples and formatting
authored
Mar 16, 2024
by
Phillip
Hide whitespace changes
Inline
Side-by-side
API.md
View page @
d86cbdde
...
@@ -8,7 +8,7 @@ JavaDocs for Mythic API can be found here:
...
@@ -8,7 +8,7 @@ JavaDocs for Mythic API can be found here:
-------------------------
-------------------------
## Repositories
## Repositories
### Maven
###
#
Maven
```
xml
```
xml
<repository>
<repository>
<id>
nexus
</id>
<id>
nexus
</id>
...
@@ -16,8 +16,7 @@ JavaDocs for Mythic API can be found here:
...
@@ -16,8 +16,7 @@ JavaDocs for Mythic API can be found here:
<url>
https://mvn.lumine.io/repository/maven-public/
</url>
<url>
https://mvn.lumine.io/repository/maven-public/
</url>
</repository>
</repository>
```
```
#### Gradle (Groovy)
### Gradle (Groovy)
```
groovy
```
groovy
repositories
{
repositories
{
// ...
// ...
...
@@ -25,9 +24,8 @@ repositories {
...
@@ -25,9 +24,8 @@ repositories {
maven
{
url
'https://mvn.lumine.io/repository/maven-public/'
}
maven
{
url
'https://mvn.lumine.io/repository/maven-public/'
}
}
}
```
```
#### Gradle (Kotlin)
### Gradle (Kotlin)
```
kotlin
```
groovy
repositories
{
repositories
{
// ...
// ...
mavenCentral
()
mavenCentral
()
...
@@ -36,11 +34,7 @@ repositories {
...
@@ -36,11 +34,7 @@ repositories {
```
```
## Dependencies
## Dependencies
#### Maven
#### Release Version is 5.6.1
#### Dev Builds Version is 5.6.2-SNAPSHOT
### Maven
```
xml
```
xml
<dependency>
<dependency>
<groupId>
io.lumine
</groupId>
<groupId>
io.lumine
</groupId>
...
@@ -49,17 +43,15 @@ repositories {
...
@@ -49,17 +43,15 @@ repositories {
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
```
```
#### Gradle (Groovy)
### Gradle (Groovy)
```
groovy
```
groovy
dependencies
{
dependencies
{
//...
//...
compileOnly
'io.lumine:Mythic-Dist:5.6.1'
compileOnly
'io.lumine:Mythic-Dist:5.6.1'
}
}
```
```
#### Gradle (Kotlin)
### Gradle (Kotlin)
```
kotlin
```
groovy
dependencies
{
dependencies
{
// ...
// ...
compileOnly
(
"io.lumine:Mythic-Dist:5.6.1"
)
compileOnly
(
"io.lumine:Mythic-Dist:5.6.1"
)
...
@@ -69,58 +61,46 @@ dependencies {
...
@@ -69,58 +61,46 @@ dependencies {
Examples
Examples
--------
--------
### 1) Spawning a MythicMob
The MythicMobs API contains numerous events and helper classes to help
you utilize our mobs, items, and skill systems.
```
java
Some examples to help you get started can be found here:
MythicMob
mob
=
MythicBukkit
.
inst
().
getMobManager
().
getMythicMob
(
"SkeletalKnight"
).
orElse
(
null
);
Location
spawnLocation
=
player
.
getLocation
();
1.
[
MythicMobs API Examples Repo
](
https://github.com/xikage/MythicMobs-API-Examples
)
if
(
mob
!=
null
){
// spawns mob
ActiveMob
knight
=
mob
.
spawn
(
BukkitAdapter
.
adapt
(
spawnLocation
),
1
);
// get mob as bukkit entity
Entity
entity
=
knight
.
getEntity
().
getBukkitEntity
();
}
```
###
2) Check BukkitEntity for
MythicMob
###
Spawning a
MythicMob
```
java
```
java
ActiveMob
mythicMob
=
MythicBukkit
.
inst
().
getMobManager
().
getActiveMob
(
bukkitEntity
.
getUniqueId
()).
orElse
(
null
);
MythicMob
mob
=
MythicBukkit
.
inst
().
getMobManager
().
getMythicMob
(
"SkeletalKnight"
).
orElse
(
null
);
if
(
mythicMob
!=
null
&&
mythicMob
.
getMobType
().
equals
(
"SkeletalKnight"
)){
Location
spawnLocation
=
player
.
getLocation
();
// do something with mob
if
(
mob
!=
null
){
}
// spawns mob
ActiveMob
knight
=
mob
.
spawn
(
BukkitAdapter
.
adapt
(
spawnLocation
),
1
);
// get mob as bukkit entity
Entity
entity
=
knight
.
getEntity
().
getBukkitEntity
();
}
```
```
### Check if a bukkit entity is a MythicMob
```
java
```
java
ActiveMob
mythicMob
=
MythicBukkit
.
inst
().
getMobManager
().
getActiveMob
(
bukkitEntity
.
getUniqueId
()).
orElse
(
null
);
Entity
bukkitEntity
=
...;
if
(
mythicMob
!=
null
&&
mythicMob
.
getType
().
getInternalName
().
equals
(
"SkeletalKnight"
)){
boolean
isMythicMob
=
MythicBukkit
.
inst
().
getMobManager
().
isMythicMob
(
bukkitEntity
);
// do something with mob
if
(
isMythicMob
){
}
// ...
}
```
```
###
3)
Get a collection of ActiveMob
with a filter/
predicate
### Get a collection of ActiveMob
s using a
predicate
```
java
```
java
Collection
<
ActiveMob
>
activeMobs
=
MythicBukkit
.
inst
().
getMobManager
().
getActiveMobs
(
am
->
am
.
getMobType
().
equals
(
"SkeletalKnight"
));
Collection
<
ActiveMob
>
activeMobs
=
MythicBukkit
.
inst
().
getMobManager
().
getActiveMobs
(
am
->
am
.
getMobType
().
equals
(
"SkeletalKnight"
));
//or use the Streams api
Collection
<
ActiveMob
>
activeMobs
=
MythicBukkit
.
inst
().
getMobManager
().
getActiveMobs
();
Collection
<
ActiveMob
>
filteredMobs
=
activeMobs
.
stream
().
filter
(
activeMob
->
activeMob
.
getMobType
().
equals
(
"SkeletalKnight"
)).
toList
();
```
```
<!--
The MythicMobs API contains numerous events and helper classes to help
you utilize our mobs, items, and skill systems.
Some examples to help you get started can be found here:
1.
[
MythicMobs API Examples Repo
](
https://github.com/xikage/MythicMobs-API-Examples
)
Events
Events
------
------
| | |
| | |
|------------------------------------------------------------------|------------------------------------------------|
|------------------------------------------------------------------|------------------------------------------------|
|
<
100% 30%
>
| |
| Event | Description |
| Event | Description |
|
[
MythicReloadedEvent
](
/api/events/MythicReloadedEvent
)
| Called when the plugin is reloaded |
|
[
MythicReloadedEvent
](
/api/events/MythicReloadedEvent
)
| Called when the plugin is reloaded |
|
[
MythicMobSpawnEvent
](
/api/events/MythicMobSpawnEvent
)
| Called when a MythicMob spawns |
|
[
MythicMobSpawnEvent
](
/api/events/MythicMobSpawnEvent
)
| Called when a MythicMob spawns |
...
@@ -130,4 +110,5 @@ Events
...
@@ -130,4 +110,5 @@ Events
|
[
MythicConditionLoadEvent
](
/api/events/MythicConditionLoadEvent
)
| Called when a custom condition is loaded |
|
[
MythicConditionLoadEvent
](
/api/events/MythicConditionLoadEvent
)
| Called when a custom condition is loaded |
|
[
MythicDropLoadEvent
](
/api/events/MythicDropLoadEvent
)
| Called when a custom drop is loaded |
|
[
MythicDropLoadEvent
](
/api/events/MythicDropLoadEvent
)
| Called when a custom drop is loaded |
|
[
MythicMechanicLoadEvent
](
/api/events/MythicMechanicLoadEvent
)
| Called when a custom mechanic is loaded |
|
[
MythicMechanicLoadEvent
](
/api/events/MythicMechanicLoadEvent
)
| Called when a custom mechanic is loaded |
|
[
MythicTargeterLoadEvent
](
/api/events/MythicTargeterLoadEvent
)
| Called when a custom targeter is loaded |
|
[
MythicTargeterLoadEvent
](
/api/events/MythicTargeterLoadEvent
)
| Called when a custom targeter is loaded |
\ No newline at end of file
-->
\ No newline at end of file