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