mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -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;
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
foreach (Player pl in players) {
|
foreach (Player pl in players) {
|
||||||
// Unfortunately, some clients will freeze or crash if we send a MOTD packet,
|
// Some clients will freeze or crash if we send a MOTD packet, but don't follow it up by a new map.
|
||||||
// but don't follow it up by a new map. Thus, we have to use the ugly approach
|
// Although checking for CPE extension support is preferred, also send to whitelisted clients for maximum compatibility
|
||||||
// of only sending to whitelisted clients.
|
bool motdOnly = pl.Supports(CpeExt.InstantMOTD) || (pl.appName != null && pl.appName.CaselessStarts("classicalsharp"));
|
||||||
if (pl.appName != null && pl.appName.CaselessStarts("classicalsharp")) {
|
if (motdOnly) {
|
||||||
pl.SendMapMotd();
|
pl.SendMapMotd();
|
||||||
} else {
|
} else {
|
||||||
LevelActions.ReloadMap(p, pl, false);
|
LevelActions.ReloadMap(p, pl, false);
|
||||||
|
@ -34,19 +34,20 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExtEntry[] extensions = new ExtEntry[] {
|
ExtEntry[] extensions = new ExtEntry[] {
|
||||||
new ExtEntry(CpeExt.ClickDistance), new ExtEntry(CpeExt.CustomBlocks),
|
new ExtEntry(CpeExt.ClickDistance), new ExtEntry(CpeExt.CustomBlocks),
|
||||||
new ExtEntry(CpeExt.HeldBlock), new ExtEntry(CpeExt.TextHotkey),
|
new ExtEntry(CpeExt.HeldBlock), new ExtEntry(CpeExt.TextHotkey),
|
||||||
new ExtEntry(CpeExt.ExtPlayerList, 2), new ExtEntry(CpeExt.EnvColors),
|
new ExtEntry(CpeExt.ExtPlayerList, 2), new ExtEntry(CpeExt.EnvColors),
|
||||||
new ExtEntry(CpeExt.SelectionCuboid), new ExtEntry(CpeExt.BlockPermissions),
|
new ExtEntry(CpeExt.SelectionCuboid), new ExtEntry(CpeExt.BlockPermissions),
|
||||||
new ExtEntry(CpeExt.ChangeModel), new ExtEntry(CpeExt.EnvMapAppearance, 2),
|
new ExtEntry(CpeExt.ChangeModel), new ExtEntry(CpeExt.EnvMapAppearance, 2),
|
||||||
new ExtEntry(CpeExt.EnvWeatherType), new ExtEntry(CpeExt.HackControl),
|
new ExtEntry(CpeExt.EnvWeatherType), new ExtEntry(CpeExt.HackControl),
|
||||||
new ExtEntry(CpeExt.EmoteFix), new ExtEntry(CpeExt.MessageTypes),
|
new ExtEntry(CpeExt.EmoteFix), new ExtEntry(CpeExt.MessageTypes),
|
||||||
new ExtEntry(CpeExt.LongerMessages), new ExtEntry(CpeExt.FullCP437),
|
new ExtEntry(CpeExt.LongerMessages), new ExtEntry(CpeExt.FullCP437),
|
||||||
new ExtEntry(CpeExt.BlockDefinitions), new ExtEntry(CpeExt.BlockDefinitionsExt, 2),
|
new ExtEntry(CpeExt.BlockDefinitions), new ExtEntry(CpeExt.BlockDefinitionsExt, 2),
|
||||||
new ExtEntry(CpeExt.TextColors), new ExtEntry(CpeExt.BulkBlockUpdate),
|
new ExtEntry(CpeExt.TextColors), new ExtEntry(CpeExt.BulkBlockUpdate),
|
||||||
new ExtEntry(CpeExt.EnvMapAspect), new ExtEntry(CpeExt.PlayerClick),
|
new ExtEntry(CpeExt.EnvMapAspect), new ExtEntry(CpeExt.PlayerClick),
|
||||||
new ExtEntry(CpeExt.EntityProperty), new ExtEntry(CpeExt.ExtEntityPositions),
|
new ExtEntry(CpeExt.EntityProperty), new ExtEntry(CpeExt.ExtEntityPositions),
|
||||||
new ExtEntry(CpeExt.TwoWayPing), new ExtEntry(CpeExt.InventoryOrder),
|
new ExtEntry(CpeExt.TwoWayPing), new ExtEntry(CpeExt.InventoryOrder),
|
||||||
|
new ExtEntry(CpeExt.InstantMOTD),
|
||||||
};
|
};
|
||||||
|
|
||||||
ExtEntry FindExtension(string extName) {
|
ExtEntry FindExtension(string extName) {
|
||||||
@ -229,6 +230,7 @@ namespace MCGalaxy {
|
|||||||
public const string ExtEntityPositions = "ExtEntityPositions";
|
public const string ExtEntityPositions = "ExtEntityPositions";
|
||||||
public const string TwoWayPing = "TwoWayPing";
|
public const string TwoWayPing = "TwoWayPing";
|
||||||
public const string InventoryOrder = "InventoryOrder";
|
public const string InventoryOrder = "InventoryOrder";
|
||||||
|
public const string InstantMOTD = "InstantMOTD";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CpeMessageType : byte {
|
public enum CpeMessageType : byte {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user