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> <groupId>fi.flexplex</groupId>
<artifactId>lib</artifactId> <artifactId>lib</artifactId>
<version>1.0.0</version> <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> <build>
<finalName>${project.name}-${project.version}</finalName> <finalName>${project.name}-${project.version}</finalName>
<plugins> <plugins>
@ -13,8 +18,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version> <version>3.7.0</version>
<configuration> <configuration>
<source>16</source> <source>17</source>
<target>16</target> <target>17</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

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