Add option to disable CPE

This commit is contained in:
UnknownShadow200 2018-06-08 22:21:25 +10:00
parent 9a96e2aa1e
commit 1cad019a44
3 changed files with 6 additions and 4 deletions

View File

@ -28,10 +28,10 @@ namespace MCGalaxy.Commands.CPE {
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
message = message.ToLower();
if (message.CaselessEq("preset")) { if (message.CaselessEq("preset")) {
SendPresetsMessage(p); return; SendPresetsMessage(p); return;
} }
message = message.ToLower();
if (!LevelInfo.ValidateAction(p, p.level, "set env settings of this level")) return; if (!LevelInfo.ValidateAction(p, p.level, "set env settings of this level")) return;
string[] args = message.SplitSpaces(); string[] args = message.SplitSpaces();

View File

@ -43,12 +43,12 @@ namespace MCGalaxy {
OnPlayerStartConnectingEvent.Call(this, mppass); OnPlayerStartConnectingEvent.Call(this, mppass);
if (cancelconnecting) { cancelconnecting = false; return; } if (cancelconnecting) { cancelconnecting = false; return; }
byte protocolType = buffer[offset + 130]; hasCpe = buffer[offset + 130] == 0x42 && ServerConfig.EnableCPE;
Loading = true; Loading = true;
if (disconnected) return; if (disconnected) return;
if (protocolType == 0x42) { hasCpe = true; SendCpeExtensions(); } if (hasCpe) { SendCpeExtensions(); }
if (protocolType != 0x42) CompleteLoginProcess(); else { CompleteLoginProcess(); }
} }
void SendCpeExtensions() { void SendCpeExtensions() {

View File

@ -77,6 +77,8 @@ namespace MCGalaxy {
[ConfigBool("check-updates", "Update", false)] [ConfigBool("check-updates", "Update", false)]
public static bool CheckForUpdates = true; public static bool CheckForUpdates = true;
[ConfigBool("enable-cpe", "Server", true)]
public static bool EnableCPE = true;
[ConfigInt("rplimit", "Other", 500, 0, 50000)] [ConfigInt("rplimit", "Other", 500, 0, 50000)]
public static int PhysicsRestartLimit = 500; public static int PhysicsRestartLimit = 500;