Beispiel #1
0
            public void Set(WorldDifficulty new_difficulty)
            {
                var colors   = Server.Colors;
                var old_diff = Server.World.Difficulty;

                Server.World.Difficulty = new_difficulty;

                Sender.SendFormattedMessage($"Changed world difficulty from {colors.TargetEmphasis}{old_diff}{colors.Success} to {colors.TargetEmphasis}{new_difficulty}{colors.Success}.", colors.Success);

                Server.Commands.LogCommandActivity(Sender, $"Changed world difficulty from {old_diff} to {new_difficulty}.");
            }
Beispiel #2
0
    void GetUserInputs()
    {
        if (!createNewWorldMenu)
        {
            return;
        }
        if (createNewWorldMenu.stringInputs.Length < 1)
        {
            return;
        }

        StringParameter worldName       = Array.Find(createNewWorldMenu.stringInputs, si => si.optionID == 1);
        StringParameter worldGamemode   = Array.Find(createNewWorldMenu.stringInputs, si => si.optionID == 2);
        StringParameter worldDifficulty = Array.Find(createNewWorldMenu.stringInputs, si => si.optionID == 3);
        StringParameter worldType       = Array.Find(createNewWorldMenu.stringInputs, si => si.optionID == 4);
        StringParameter worldSize       = Array.Find(createNewWorldMenu.stringInputs, si => si.optionID == 5);

        print($"name {worldName} - gamemode {worldGamemode} - difficulty {worldDifficulty} - type {worldType} - size {worldSize}");

        this.worldName = worldName.GetValue();

        switch (worldGamemode.GetValueAsNum())
        {
        case 0:
            worldGameMode = WorldGameMode.Survival;
            break;

        case 1:
            worldGameMode = WorldGameMode.Creative;
            break;

        default:
            worldGameMode = WorldGameMode.Survival;
            break;
        }

        switch (worldDifficulty.GetValueAsNum())
        {
        case 0:
            this.worldDifficulty = WorldDifficulty.Peaceful;
            break;

        case 1:
            this.worldDifficulty = WorldDifficulty.Easy;
            break;

        case 2:
            this.worldDifficulty = WorldDifficulty.Normal;
            break;

        case 3:
            this.worldDifficulty = WorldDifficulty.Hard;
            break;

        default:
            this.worldDifficulty = WorldDifficulty.Peaceful;
            break;
        }

        switch (worldType.GetValueAsNum())
        {
        case 0:
            this.worldType = WorldType.Flat;
            break;

        case 1:
            this.worldType = WorldType.Normal;
            break;

        default:
            this.worldType = WorldType.Flat;
            break;
        }

        switch (worldSize.GetValueAsNum())
        {
        case 0:
            worldX = 128;
            worldY = 256;
            worldZ = 128;
            break;

        case 1:
            worldX = 512;
            worldY = 256;
            worldZ = 512;
            break;

        case 2:
            worldX = 1024;
            worldY = 256;
            worldZ = 1024;
            break;

        case 3:
            worldX = 3072;
            worldY = 256;
            worldZ = 3072;
            break;

        default:
            worldX = 128;
            worldY = 256;
            worldZ = 128;
            break;
        }
    }