Esempio n. 1
0
    def chat_command(self, username, parameters):
        if len(parameters) == 0:
            return ("Usage: /{0} {1}".format(self.name, self.usage),)
        elif len(parameters) == 1:
            block = parameters[0]
            count = 1
        elif len(parameters) == 2:
            block = parameters[0]
            count = parameters[1]
        else:
            block = " ".join(parameters[:-1])
            count = parameters[-1]

        player = parse_player(factory, username)
        block = parse_block(block)
        count = parse_int(count)

        # Get a location two blocks in front of the player.
        dest = player.player.location.in_front_of(2)
        dest.y += 1

        coords = int(dest.x * 32), int(dest.y * 32), int(dest.z * 32)

        factory.give(coords, block, count)

        # Return an empty tuple for iteration
        return tuple()
Esempio n. 2
0
    def chat_command(self, username, parameters):
        if len(parameters) == 0:
            return ("Usage: /{0} {1}".format(self.name, self.usage), )
        elif len(parameters) == 1:
            block = parameters[0]
            count = 1
        elif len(parameters) == 2:
            block = parameters[0]
            count = parameters[1]
        else:
            block = " ".join(parameters[:-1])
            count = parameters[-1]

        player = parse_player(self.factory, username)
        block = parse_block(block)
        count = int(count)

        # Get a location two blocks in front of the player.
        dest = player.player.location.in_front_of(2)
        dest.y += 1

        coords = int(dest.x * 32), int(dest.y * 32), int(dest.z * 32)

        self.factory.give(coords, block, count)

        # Return an empty tuple for iteration
        return tuple()
Esempio n. 3
0
 def test_parse_block_item_named(self):
     self.assertEqual(parse_block("leather-leggings"), (300, 0))
Esempio n. 4
0
 def test_parse_block_item_hex(self):
     self.assertEqual(parse_block("0x12C"), (300, 0))
Esempio n. 5
0
 def test_parse_block_item(self):
     self.assertEqual(parse_block("300"), (300, 0))
Esempio n. 6
0
 def test_parse_block_named(self):
     self.assertEqual(parse_block("coal-ore"), (16, 0))
Esempio n. 7
0
 def test_parse_block_hex(self):
     self.assertEqual(parse_block("0x10"), (16, 0))
Esempio n. 8
0
 def test_parse_block(self):
     self.assertEqual(parse_block("16"), (16, 0))
Esempio n. 9
0
 def test_parse_block_item_named(self):
     self.assertEqual(parse_block("leather-leggings"), (300, 0))
Esempio n. 10
0
 def test_parse_block_item_hex(self):
     self.assertEqual(parse_block("0x12C"), (300, 0))
Esempio n. 11
0
 def test_parse_block_item(self):
     self.assertEqual(parse_block("300"), (300, 0))
Esempio n. 12
0
 def test_parse_block_named(self):
     self.assertEqual(parse_block("coal-ore"), (16, 0))
Esempio n. 13
0
 def test_parse_block_hex(self):
     self.assertEqual(parse_block("0x10"), (16, 0))
Esempio n. 14
0
 def test_parse_block(self):
     self.assertEqual(parse_block("16"), (16, 0))