Add readme

This commit is contained in:
Jonttuuu 2023-07-30 13:10:12 +03:00
parent 7e096d3d9e
commit 340fed098f
3 changed files with 60 additions and 3 deletions

49
README.md Normal file
View File

@ -0,0 +1,49 @@
# FlexLib
Java Wrapper for FlexPlex API
## Maven
```xml
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>fi.jonttu.git.FlexPlex</groupId>
<artifactId>FlexLib</artifactId>
<version>Version</version>
</dependency>
```
### Dependencies
```xml
<dependency>
<groupId>com.neovisionaries</groupId>
<artifactId>nv-websocket-client</artifactId>
<version>2.14</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
```
## Example
```java
// Instantiate FlexLib, this should be done only once and instance saved.
final FlexLib flexLib = new FlexLib("token", Logger.getGlobal());
// Get friends API if its available
final Optional<PlayerFriends> playerFriends = getPlayerFriends("a2a20f04-b722-4192-b184-8e41f1080ead");
if (playerFriends.isPresent()) {
final Set<UUID> friends = playerFriends.getFriends();
}
// Disables FlexLib
flexLib.disable();
```

11
pom.xml
View File

@ -4,7 +4,12 @@
<groupId>fi.flexplex</groupId>
<artifactId>lib</artifactId>
<version>1.0.0</version>
<name>FlexConnect</name>
<name>FlexLib</name>
<properties>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<build>
<finalName>${project.name}-${project.version}</finalName>
<plugins>
@ -13,8 +18,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>16</source>
<target>16</target>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>

View File

@ -87,6 +87,9 @@ public final class FlexLib {
return Optional.of(pFriends);
}
/**
* Disableds FlexLib API instance
*/
public void disable() {
if (this.webSocketClient != null) {
this.webSocketClient.disable();