void AddExtension(string extName, int version) { ExtEntry ext = FindExtension(extName.Trim()); if (ext == null) { return; } ext.ClientExtVersion = (byte)version; if (ext.ExtName == CpeExt.CustomBlocks) { if (version == 1) { Send(Packet.CustomBlockSupportLevel(1)); } hasCustomBlocks = true; } else if (ext.ExtName == CpeExt.ChangeModel) { hasChangeModel = true; } else if (ext.ExtName == CpeExt.FullCP437) { hasCP437 = true; } else if (ext.ExtName == CpeExt.ExtPlayerList) { hasExtList = true; } else if (ext.ExtName == CpeExt.BlockDefinitions) { hasBlockDefs = true; } else if (ext.ExtName == CpeExt.TextColors) { hasTextColors = true; for (int i = 0; i < Colors.List.Length; i++) { if (!Colors.List[i].IsModified()) { continue; } Send(Packet.SetTextColor(Colors.List[i])); } } else if (ext.ExtName == CpeExt.ExtEntityPositions) { hasExtPositions = true; } else if (ext.ExtName == CpeExt.TwoWayPing) { hasTwoWayPing = true; } else if (ext.ExtName == CpeExt.BulkBlockUpdate) { hasBulkBlockUpdate = true; } }
public static void Update(ColorDesc col) { List[col.Index] = col; Player[] players = PlayerInfo.Online.Items; foreach (Player p in players) { if (!p.Supports(CpeExt.TextColors)) { continue; } p.Send(Packet.SetTextColor(col)); } SaveList(); }
void AddExtension(string extName, int version) { CpeExt ext = FindExtension(extName.Trim()); if (ext == null) { return; } ext.ClientVersion = (byte)version; if (ext.Name == CpeExt.CustomBlocks) { if (version == 1) { Send(Packet.CustomBlockSupportLevel(1)); } hasCustomBlocks = true; UpdateFallbackTable(); if (MaxRawBlock < Block.CPE_MAX_BLOCK) { MaxRawBlock = Block.CPE_MAX_BLOCK; } } else if (ext.Name == CpeExt.ChangeModel) { hasChangeModel = true; } else if (ext.Name == CpeExt.EmoteFix) { hasEmoteFix = true; } else if (ext.Name == CpeExt.FullCP437) { hasCP437 = true; } else if (ext.Name == CpeExt.ExtPlayerList) { hasExtList = true; } else if (ext.Name == CpeExt.BlockDefinitions) { hasBlockDefs = true; if (MaxRawBlock < 255) { MaxRawBlock = 255; } } else if (ext.Name == CpeExt.TextColors) { hasTextColors = true; for (int i = 0; i < Colors.List.Length; i++) { if (!Colors.List[i].IsModified()) { continue; } Send(Packet.SetTextColor(Colors.List[i])); } } else if (ext.Name == CpeExt.ExtEntityPositions) { hasExtPositions = true; } else if (ext.Name == CpeExt.TwoWayPing) { hasTwoWayPing = true; } else if (ext.Name == CpeExt.BulkBlockUpdate) { hasBulkBlockUpdate = true; } else if (ext.Name == CpeExt.ExtTextures) { hasExtTexs = true; } #if TEN_BIT_BLOCKS else if (ext.Name == CpeExt.ExtBlocks) { hasExtBlocks = true; if (MaxRawBlock < 767) { MaxRawBlock = 767; } } #endif }