Пример #1
0
        public void GameMode(Player player, int gameMode)
        {
            player.SetGameMode((GameMode)gameMode);

            //if (gameMode == 1)
            //{
            //	player.Inventory.Slots.Clear();

            //	player.Inventory.Slots.AddRange(InventoryUtils.CreativeInventoryItems);
            //}

            //player.SendPackage(new McpeStartGame
            //{
            //	seed = -1,
            //	generator = 1,
            //	gamemode = gameMode,
            //	entityId = player.EntityId,
            //	spawnX = (int) player.Level.SpawnPoint.X,
            //	spawnY = (int) player.Level.SpawnPoint.Y,
            //	spawnZ = (int) player.Level.SpawnPoint.Z,
            //	x = player.KnownPosition.X,
            //	y = player.KnownPosition.Y,
            //	z = player.KnownPosition.Z
            //});

            //{
            //	McpeContainerSetContent creativeContent = McpeContainerSetContent.CreateObject();
            //	creativeContent.windowId = (byte) 0x79;
            //	creativeContent.slotData = player.Inventory.GetSlots();
            //	creativeContent.hotbarData = player.Inventory.GetHotbar();
            //	player.SendPackage(creativeContent);
            //}

            player.Level.BroadcastMessage(string.Format("{0} changed to game mode {1}.", player.Username, gameMode), type: MessageType.Raw);
        }
Пример #2
0
        public void GameMode(Player player, int gameMode)
        {
            player.SetGameMode((GameMode) gameMode);

            player.Level.BroadcastMessage($"{player.Username} changed to game mode {(GameMode) gameMode}.", type: MessageType.Raw);
        }