Added Networking API (#180)

* sent data to client

* send more data + debug + add docs + switch to handshake

* add diff between container and normal changes

* fix docs

* changes according guidelines

* make requested changes + cleanup

* correct documentation

* Improved Networking API documentation

* Moved networking API channel registration out of main class

* Cleanup

* Removed debug on chat/command lookups

* Optimized array merging

* Fixed ClassCastException when running console commands

* Skip preparing networking data if not a channel player

* Renamed "networking-debug" to "network-debug"

* Fixed failed handshake still registering players

* Adjusted networking phrases

* Renamed pluginchannel to channel

Co-authored-by: Intelli <contact@intelli.software>
This commit is contained in:
vacla 2022-03-24 01:49:46 +01:00 committed by GitHub
parent e848d65b93
commit 8cdf99429d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 554 additions and 3 deletions

View file

@ -48,6 +48,7 @@ public class Config extends Language {
public boolean LOG_CANCELLED_CHAT;
public boolean HOPPER_FILTER_META;
public boolean EXCLUDE_TNT;
public boolean NETWORK_DEBUG;
public boolean MYSQL;
public boolean CHECK_UPDATES;
public boolean API_ENABLED;
@ -189,6 +190,7 @@ public class Config extends Language {
this.LOG_CANCELLED_CHAT = this.getBoolean("log-cancelled-chat", true);
this.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false);
this.EXCLUDE_TNT = this.getBoolean("exclude-tnt", false);
this.NETWORK_DEBUG = this.getBoolean("network-debug", false);
this.DONATION_KEY = this.getString("donation-key");
this.MYSQL = this.getBoolean("use-mysql");
this.PREFIX = this.getString("table-prefix");

View file

@ -28,6 +28,7 @@ import net.coreprotect.consumer.Queue;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.language.Phrase;
import net.coreprotect.listener.ListenerHandler;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.paper.PaperAdapter;
import net.coreprotect.patch.Patch;
@ -411,7 +412,7 @@ public class ConfigHandler extends Queue {
ConfigHandler.loadConfig(); // Load (or create) the configuration file.
ConfigHandler.loadDatabase(); // Initialize MySQL and create tables if necessary.
ListenerHandler.registerNetworking(); // Register channels for networking API
}
catch (Exception e) {
e.printStackTrace();
@ -455,4 +456,14 @@ public class ConfigHandler extends Queue {
return false;
}
public static void performDisable() {
try {
Database.closeConnection();
ListenerHandler.unregisterNetworking(); // Unregister channels for networking API
}
catch (Exception e) {
e.printStackTrace();
}
}
}