Skip to content

Java Edition

Trollhunters501 edited this page Sep 16, 2024 · 14 revisions

Maven

In maven you must add the following repository:

<repository>
  <id>github</id>
  <name>GitHub Packages</name> 
  <url>https://maven.pkg.github.com/Creadores-Program/ServerWebGamePost</url>
</repository>

I in dependencies:

<dependency>
 <groupId>org.creadoresprogram</groupId>
 <artifactId>ServerWebGamePost</artifactId>
 <version>1.0</version>
</dependency>

Create Server

Processing Datapackets

First you need to extend the org.CreadoresProgram.ServerWebGamePost.server.ProcessDatapackServer class

And to process the datapackets that the client sends you must implement Override to the processDatapack function

Something like that:

@Override
public void processDatapack(@NonNull JSONObject datapack){
      //code...
      //JSONObject= com.alibaba.fastjson2.JSONObject
      //NonNull = lombok.NonNull
}

Send Datapackets

Simply in the org.CreadoresProgram.ServerWebGamePost.server.ServerWebGamePostServer class Execute the sendDataPacket function

Something like that:

ServerWebGamePostServer server;
server.sendDataPacket(identifier, json); //identifier you must obtain from the datapacket that the client gives in its datapacket (it is a String) Json Is com.alibaba.fastjson2.JSONObject

Clone this wiki locally