Api usage
Below you will understand how to use the squidgame API for your addons!
Import
First of all you have to import the plugin.
Maven
Code (YAML):
<dependency
>
<groupId>com.github.unldenis</groupId
>
<artifactId>SquidGame-plugin</artifactId
>
<version>master-81955c7be4-1</version
>
<scope>provided</scope
>
</dependency>
Gradle
Code (YAML):
implementation 'com.github.unldenis:SquidGame-plugin:master-81955c7be4-1'
Usage
Just extend the abstract class
SquidGameApi which will automatically register your implementation without any additions.
In this example, every time a player is eliminated, I increase his counter.
Code (Java):
import
com.github.unldenis.api.SquidGameApi
;
import
com.github.unldenis.gamelogic.MainGame
;
import
org.bukkit.entity.Player
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.UUID
;
public
class Stats
extends SquidGameApi
{
private Map
<UUID, Integer
> playerDeaths
=
new HashMap
<>
(
)
;
@Override
public
void onPlayerJoin
(Player player, MainGame mainGame
)
{
}
@Override
public
void onPlayerQuit
(Player player, MainGame mainGame
)
{
}
@Override
public
void onPlayerEliminated
(Player player, MainGame mainGame
)
{
UUID playerUUID
= player.
getUniqueId
(
)
;
playerDeaths.
put
(playerUUID, playerDeaths.
getOrDefault
(playerUUID,
0
)
+
1
)
;
}
}