コード例 #1
0
        public bool Supports(string extName, int version = 1)
        {
            if (!hasCpe)
            {
                return(false);
            }
            CpeExtension ext = FindExtension(extName);

            return(ext != null && ext.ClientVersion == version);
        }
コード例 #2
0
ファイル: Server.cs プロジェクト: UnknownShadow200/MCGalaxy
        public static void LoadAllSettings()
        {
            // Unload custom plugins
            List <Plugin> plugins = new List <Plugin>(Plugin.all);

            foreach (Plugin p in plugins)
            {
                if (Plugin.core.Contains(p))
                {
                    continue;
                }
                Plugin.Unload(p, false);
            }

            ZSGame.Instance.infectMessages = ZSConfig.LoadInfectMessages();
            Colors.Load();
            Alias.Load();
            BlockDefinition.LoadGlobal();
            ImagePalette.Load();

            SrvProperties.Load();
            AuthService.ReloadDefault();
            Group.LoadAll();
            CommandPerms.Load();
            Command.InitAll();
            Block.SetBlocks();
            AwardsList.Load();
            PlayerAwards.Load();
            Economy.Load();
            WarpList.Global.Filename = "extra/warps.save";
            WarpList.Global.Load();
            CommandExtraPerms.Load();
            ProfanityFilter.Init();
            Team.LoadList();
            ChatTokens.LoadCustom();
            SrvProperties.FixupOldPerms();
            CpeExtension.LoadDisabledList();

            TextFile announcementsFile = TextFile.Files["Announcements"];

            announcementsFile.EnsureExists();
            announcements = announcementsFile.GetText();

            // Reload custom plugins
            foreach (Plugin p in plugins)
            {
                if (Plugin.core.Contains(p))
                {
                    continue;
                }
                Plugin.Load(p, false);
            }

            OnConfigUpdatedEvent.Call();
        }
コード例 #3
0
        void SendCpeExtensions()
        {
            extensions = CpeExtension.GetAllEnabled();
            Send(Packet.ExtInfo((byte)(extensions.Length + 1)));
            // fix for old classicube java client, doesn't reply if only send EnvMapAppearance with version 2
            Send(Packet.ExtEntry(CpeExt.EnvMapAppearance, 1));

            foreach (CpeExt ext in extensions)
            {
                Send(Packet.ExtEntry(ext.Name, ext.ServerVersion));
            }
        }
コード例 #4
0
        /// <summary> Retrieves a list of all supported and enabled CPE extensions </summary>
        public static CpeExt[] GetAllEnabled()
        {
            if (!Server.Config.EnableCPE)
            {
                return(Empty);
            }
            CpeExtension[] all  = All;
            List <CpeExt>  exts = new List <CpeExt>(all.Length);

            for (int i = 0; i < all.Length; i++)
            {
                CpeExtension e = all[i];
                if (!e.Enabled)
                {
                    continue;
                }

                exts.Add(new CpeExt()
                {
                    Name = e.Name, ServerVersion = e.Version
                });
            }
            return(exts.ToArray());
        }
コード例 #5
0
        void AddExtension(string extName, int version)
        {
            CpeExtension 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;
                if (MaxRawBlock < Block.CpeMaxBlock)
                {
                    MaxRawBlock = Block.CpeMaxBlock;
                }
            }
            else if (ext.Name == CpeExt.ChangeModel)
            {
                hasChangeModel = 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
        }