-
Import
MWebConnect.jar
(You can download it in the Release page.). -
Create a listening event for the server
class MyServer extends Server {
@Override
public void connect(Session client) {
//Client connection
}
@Override
public void close(Session client) {
//Client disconnects.
}
@Override
public void message(Session client, String msg) {
//Client sends message
}
@Override
public void create() {
//Server creation
}
}
- Create a WebSocket server
MyServer server = new MyServer();
server.newServer("127.0.0.1", 19132);
- Running server
server.run();
- So you can connect to the server with the command /connect 127.0.0.1:19132 in Minecraft.
- Make sure to import two libraries,
com.loistudio.Session
andcom.loistudio.tools.EventEmitter
, before using this function.
This event will be triggered when the player sends a message.
(String) message ; (String) sender
This event is triggered when the player sends a message, but it will send a json string.
(String) json
This event is triggered when the player places a box.
(Player) player ; (Block) block
This event is triggered when the player places a box, but it will send a json string.
(String) json
This event is triggered when the player breaks the box.
(Player) player ; (Block) block
This event is triggered when the player breaks a box, but it will send a json string.
(String) json
This event will be triggered after the client executes the command.
(String) json
- Note: These events must be monitored with the event variable in the Session.
- Create variables before reuse
EventEmitter event = new EventEmitter();
.
event.emit("message", "HelloWorld");
event.on("message", new EventEmitter.Listener() {
public void execute(Object... args) {
System.out.println(args[0]);
}
});
- Note: the event module can only listen to the current variable. If it is created and sent in other classes, it cannot listen to the sent event in this variable unless it is sent in the current variable.
- Import the package
com.loistudio.file.JsonObject
before using it.
Create a json file
- path {String} File path
Add or set a key value to a json file.
- key {String} Key of json file
- value {Object} Value of key
Gets the value of the specified key.
- key {String} Key of json file
Delete the specified key
- key {String} Key of json file
- Import the package
com.loistudio.file.MclStatic
before using it.
Create a MclStatic file.
- path {String} File path
Set encryption key
- key {String} encryption key
- publicKey {String} public key
- privateKey {String} private key
Set array object
- arrayName {String} Array name
- array {MclStaticArray} Array object
Get the current encryption key
Set a constant value.
- key {String} Constant name
- item {String} Constant value
Get constant value
- key {String} Constant name
Get an array object
- arrayName {String} Array name
Delete the specified constant
- key {String} Constant name
Create a storage class
- class {String} taxon
Delete the specified storage class
- class {String} taxon
Set a storage class variable
- class {String} taxon
- key {String} variable name
- item {item} variable value
Gets the variable value in the specified storage class
- class {String} taxon
- key {String} variable name
Deletes variables in the specified storage class
- class {String} taxon
- key {String} variable name
Delete array object
- arrayName {String} Array name