Updated api examples and formatting authored by Phillip's avatar Phillip
...@@ -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,7 +61,14 @@ dependencies { ...@@ -69,7 +61,14 @@ 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.
Some examples to help you get started can be found here:
1. [MythicMobs API Examples Repo](https://github.com/xikage/MythicMobs-API-Examples)
### Spawning a MythicMob
```java ```java
MythicMob mob = MythicBukkit.inst().getMobManager().getMythicMob("SkeletalKnight").orElse(null); MythicMob mob = MythicBukkit.inst().getMobManager().getMythicMob("SkeletalKnight").orElse(null);
...@@ -83,44 +82,25 @@ Examples ...@@ -83,44 +82,25 @@ Examples
} }
``` ```
### 2) Check BukkitEntity for MythicMob ### Check if a bukkit entity is a MythicMob
```java
ActiveMob mythicMob = MythicBukkit.inst().getMobManager().getActiveMob(bukkitEntity.getUniqueId()).orElse(null);
if(mythicMob != null && mythicMob.getMobType().equals("SkeletalKnight")){
// do something with mob
}
```
```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 ActiveMobs 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
------ ------
| | | | | |
|------------------------------------------------------------------|------------------------------------------------| |------------------------------------------------------------------|------------------------------------------------|
| &lt; 100% 30% &gt; | |
| 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 |
...@@ -131,3 +111,4 @@ Events ...@@ -131,3 +111,4 @@ Events
| [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