mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Prefer checking for InstantMOTD cpe extension support, instead of hardcoding app name check
This commit is contained in:
parent
bf858d2454
commit
0718c14b78
@ -77,10 +77,10 @@ namespace MCGalaxy {
|
||||
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in players) {
|
||||
// Unfortunately, some clients will freeze or crash if we send a MOTD packet,
|
||||
// but don't follow it up by a new map. Thus, we have to use the ugly approach
|
||||
// of only sending to whitelisted clients.
|
||||
if (pl.appName != null && pl.appName.CaselessStarts("classicalsharp")) {
|
||||
// Some clients will freeze or crash if we send a MOTD packet, but don't follow it up by a new map.
|
||||
// Although checking for CPE extension support is preferred, also send to whitelisted clients for maximum compatibility
|
||||
bool motdOnly = pl.Supports(CpeExt.InstantMOTD) || (pl.appName != null && pl.appName.CaselessStarts("classicalsharp"));
|
||||
if (motdOnly) {
|
||||
pl.SendMapMotd();
|
||||
} else {
|
||||
LevelActions.ReloadMap(p, pl, false);
|
||||
|
@ -47,6 +47,7 @@ namespace MCGalaxy {
|
||||
new ExtEntry(CpeExt.EnvMapAspect), new ExtEntry(CpeExt.PlayerClick),
|
||||
new ExtEntry(CpeExt.EntityProperty), new ExtEntry(CpeExt.ExtEntityPositions),
|
||||
new ExtEntry(CpeExt.TwoWayPing), new ExtEntry(CpeExt.InventoryOrder),
|
||||
new ExtEntry(CpeExt.InstantMOTD),
|
||||
};
|
||||
|
||||
ExtEntry FindExtension(string extName) {
|
||||
@ -229,6 +230,7 @@ namespace MCGalaxy {
|
||||
public const string ExtEntityPositions = "ExtEntityPositions";
|
||||
public const string TwoWayPing = "TwoWayPing";
|
||||
public const string InventoryOrder = "InventoryOrder";
|
||||
public const string InstantMOTD = "InstantMOTD";
|
||||
}
|
||||
|
||||
public enum CpeMessageType : byte {
|
||||
|
Loading…
x
Reference in New Issue
Block a user