public void ScoreboardSlotArgument_ParseShouldFail_BecauseInvalidScoreboardSlot()
        {
            // Arrange
            ScoreboardSlots.Set("{\"foo\":{}}");
            ScoreboardSlotArgument argument = new ScoreboardSlotArgument();
            IStringReader          reader   = new StringReader("bar");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsFalse(readResults.Successful);
        }
        public void ScoreboardSlotArgument_ParseShouldSucceed()
        {
            // Arrange
            ScoreboardSlots.Set("{\"foo\":{}}");
            ScoreboardSlotArgument argument = new ScoreboardSlotArgument();
            IStringReader          reader   = new StringReader("foo");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsTrue(readResults.Successful);
        }
        public void ScoreboardSlotArgument_ParseShouldSucceed_WithOptionalSlotType()
        {
            // Arrange
            Colours.Set("[\"red\",\"green\"]");
            ScoreboardSlots.Set("{\"foo\":{\"contents_optional\":true,\"slot_type\":\"colour\"}}");
            ScoreboardSlotArgument argument = new ScoreboardSlotArgument();
            IStringReader          reader   = new StringReader("foo");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsTrue(readResults.Successful);
        }
Beispiel #4
0
        public string ScoreboardObjectivesSetDisplay(ScoreboardSlots slot, string objectiveName = "")
        {
            string cmd = string.Empty;

            if (!string.IsNullOrWhiteSpace(objectiveName))
            {
                cmd = string.Format(TonkaCommands.CMD_SCOREBOARD_OBJ_SETDISPLAY_2, EnumUtils.GetEnumDefaultValue(slot), objectiveName);
            }
            else
            {
                cmd = string.Format(TonkaCommands.CMD_SCOREBOARD_OBJ_SETDISPLAY, EnumUtils.GetEnumDefaultValue(slot));
            }
            string result = SendCommand(cmd);

            return(result);
        }
Beispiel #5
0
		public string ScoreboardObjectivesSetDisplay(ScoreboardSlots slot, string objectiveName = "")
		{
			string cmd = string.Empty;
			if (!string.IsNullOrWhiteSpace(objectiveName))
			{
				cmd = string.Format(TonkaCommands.CMD_SCOREBOARD_OBJ_SETDISPLAY_2, EnumUtils.GetEnumDefaultValue(slot), objectiveName);
			}
			else
			{
				cmd = string.Format(TonkaCommands.CMD_SCOREBOARD_OBJ_SETDISPLAY, EnumUtils.GetEnumDefaultValue(slot));
			}
			string result = SendCommand(cmd);
			return result;
		}