Exemplo n.º 1
0
    def perform(self, recordUndo=True):
        self.player = input_text_buttons("Enter a Player Name: ", 160)
        if not self.player:
            return
        if len(self.player) > 16:
            alert("Name to long. Maximum name length is 16.")
            return
        elif len(self.player) < 4:
            alert("Name to short. Minimum name length is 4.")
            return
        try:
            self.uuid = version_utils.getUUIDFromPlayerName(self.player)
            self.player = version_utils.getPlayerNameFromUUID(self.uuid) #Case Corrected
        except:
            action = ask("Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player {} exists.".format(self.player, self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
            	return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
            self.player = version_utils.getPlayerNameFromUUID(self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        if self.tool.panel:
            self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(self.player)] = self.playerTag

            self.level.players.append(self.player)
            if self.tool.panel: 
                self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.uuid

        self.tool.playerPos[(0,0,0)] = self.uuid
        self.tool.revPlayerPos[self.uuid] = (0,0,0)
        self.tool.playerTexture[self.uuid] = loadPNGTexture(version_utils.getPlayerSkin(self.uuid, force=False))
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
Exemplo n.º 2
0
 def rename_item(self):
     result = input_text_buttons("Choose a name", 300,
                                 self.selected_item[3])
     if type(result) in (str, unicode):
         self.selected_item[3] = result
         self.selected_item[9].name = result
         self.build_layout()
Exemplo n.º 3
0
    def perform(self, recordUndo=True):
        self.player = input_text_buttons("Enter a Player Name: ", 160)
        if not self.player:
            return
        if len(self.player) > 16:
            alert("Name to long. Maximum name length is 16.")
            return
        elif len(self.player) < 4:
            alert("Name to short. Minimum name length is 4.")
            return
        try:
            '''
            print "Player: \""+str(self.player)+"\""
            self.uuid = version_utils.playercache.getPlayerFromPlayername(self.player)
            print "UUID: \""+str(self.uuid)+"\""
            self.player = version_utils.playercache.getPlayerFromUUID(self.uuid)  #Case Corrected
            '''
            self.uuid, self.player, other_uuid = version_utils.playercache.getPlayerInfo(self.player)
        except:
            action = ask("Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player {} exists.".format(self.player, self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
                return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
            self.player = version_utils.playercache.getPlayerFromUUID(self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        if self.tool.panel:
            self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(self.player)] = self.playerTag

            self.level.players.append(self.player)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.uuid

        self.tool.playerPos[(0,0,0)] = self.uuid
        self.tool.revPlayerPos[self.uuid] = (0,0,0)
        self.tool.playerTexture[self.uuid] = loadPNGTexture(version_utils.getPlayerSkin(self.uuid, force=False))
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
Exemplo n.º 4
0
    def perform(self, recordUndo=True):
        initial = ""
        allowed_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
        while True:
            self.player = input_text_buttons("Enter a Player Name: ", 160, initial=initial, allowed_chars=allowed_chars)
            if self.player is None:
                return
            elif len(self.player) > 16:
                alert("Name too long. Maximum name length is 16.")
                initial = self.player
            elif len(self.player) < 1:
                alert("Name too short. Minimum name length is 1.")
                initial = self.player
            else:
                break
            
#         print 1
        data = self.playercache.getPlayerInfo(self.player)
        if "<Unknown UUID>" not in data and "Server not ready" not in data:
            self.uuid = data[0]
            self.player = data[1]
        else:
            action = ask("Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player \"{}\" exists.".format(self.player, self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
                return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
#             print 2
            self.player = self.playercache.getPlayerInfo(self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
#         print "PlayerAddOperation.perform::self.uuid", self.uuid
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        #if self.tool.panel:
        #    self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(self.player)] = self.playerTag
            
            self.level.players.append(self.player)
            #if self.tool.panel:
                #self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag
            
            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID["UUID"].append(self.uuid)
                self.tool.panel.player_UUID["Name"].append(self.player)

        self.tool.playerPos[self.editor.level.dimNo][(0,0,0)] = self.uuid
        self.tool.revPlayerPos[self.editor.level.dimNo][self.uuid] = (0,0,0)
#         print 3
        r = self.playercache.getPlayerSkin(self.uuid, force_download=False)
        if not isinstance(r, (str, unicode)):
#             print 'r 1', r
            r = r.join()
#             print 'r 2', r
        self.tool.playerTexture[self.uuid] = loadPNGTexture(r)
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
        self.playerTag.save(self.level.getPlayerPath(self.uuid))
        self.tool.nonSavedPlayers.append(self.level.getPlayerPath(self.uuid))
        self.tool.inOtherDimension[self.editor.level.dimNo].append(self.uuid)
Exemplo n.º 5
0
 def rename_item(self):
     result = input_text_buttons("Choose a name", 300, self.selected_item[3])
     if type(result) in (str, unicode):
         self.selected_item[3] = result
         self.selected_item[9].name = result
         self.build_layout()
Exemplo n.º 6
0
    def perform(self, recordUndo=True):
        initial = ""
        allowed_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
        while True:
            self.player = input_text_buttons("Enter a Player Name: ", 160, initial=initial, allowed_chars=allowed_chars)
            if self.player is None:
                return
            elif len(self.player) > 16:
                alert("Name too long. Maximum name length is 16.")
                initial = self.player
            elif len(self.player) < 1:
                alert("Name too short. Minimum name length is 1.")
                initial = self.player
            else:
                break
        try:
            '''
            print "Player: \""+str(self.player)+"\""
            self.uuid = version_utils.playercache.getPlayerFromPlayername(self.player)
            print "UUID: \""+str(self.uuid)+"\""
            self.player = version_utils.playercache.getPlayerFromUUID(self.uuid)  #Case Corrected
            '''
            data = version_utils.playercache.getPlayerInfo(self.player, force=True)
            if isinstance(data, tuple):
                self.uuid = data[0]
                self.player = data[1]
            else:
                self.uuid = data
        except:
            action = ask("Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player {} exists.".format(self.player, self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
                return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
            self.player = version_utils.playercache.getPlayerFromUUID(self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        if self.tool.panel:
            self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(self.player)] = self.playerTag

            self.level.players.append(self.player)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.uuid

        self.tool.playerPos[(0,0,0)] = self.uuid
        self.tool.revPlayerPos[self.uuid] = (0,0,0)
        self.tool.playerTexture[self.uuid] = loadPNGTexture(version_utils.getPlayerSkin(self.uuid, force=False))
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
        self.playerTag.save(self.level.getPlayerPath(self.uuid))
        self.tool.nonSavedPlayers.append(self.level.getPlayerPath(self.uuid))
        self.tool.inOtherDimension[self.editor.level.dimNo].append(self.uuid)
Exemplo n.º 7
0
    def perform(self, recordUndo=True):
        initial = ""
        allowed_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
        while True:
            self.player = input_text_buttons("Enter a Player Name: ",
                                             160,
                                             initial=initial,
                                             allowed_chars=allowed_chars)
            if self.player is None:
                return
            elif len(self.player) > 16:
                alert("Name too long. Maximum name length is 16.")
                initial = self.player
            elif len(self.player) < 1:
                alert("Name too short. Minimum name length is 1.")
                initial = self.player
            else:
                break
        try:
            '''
            print "Player: \""+str(self.player)+"\""
            self.uuid = version_utils.playercache.getPlayerFromPlayername(self.player)
            print "UUID: \""+str(self.uuid)+"\""
            self.player = version_utils.playercache.getPlayerFromUUID(self.uuid)  #Case Corrected
            '''
            data = version_utils.playercache.getPlayerInfo(self.player,
                                                           force=True)
            if isinstance(data, tuple):
                self.uuid = data[0]
                self.player = data[1]
            else:
                self.uuid = data
        except:
            action = ask(
                "Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player {} exists."
                .format(self.player,
                        self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
                return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
            self.player = version_utils.playercache.getPlayerFromUUID(
                self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        if self.tool.panel:
            self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(
                self.player)] = self.playerTag

            self.level.players.append(self.player)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(
                self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.uuid

        self.tool.playerPos[(0, 0, 0)] = self.uuid
        self.tool.revPlayerPos[self.uuid] = (0, 0, 0)
        self.tool.playerTexture[self.uuid] = loadPNGTexture(
            version_utils.getPlayerSkin(self.uuid, force=False))
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
        self.playerTag.save(self.level.getPlayerPath(self.uuid))
        self.tool.nonSavedPlayers.append(self.level.getPlayerPath(self.uuid))
        self.tool.inOtherDimension[self.editor.level.dimNo].append(self.uuid)
Exemplo n.º 8
0
    def perform(self, recordUndo=True):
        initial = ""
        allowed_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
        while True:
            self.player = input_text_buttons("Enter a Player Name: ",
                                             160,
                                             initial=initial,
                                             allowed_chars=allowed_chars)
            if self.player is None:
                return
            elif len(self.player) > 16:
                alert("Name too long. Maximum name length is 16.")
                initial = self.player
            elif len(self.player) < 1:
                alert("Name too short. Minimum name length is 1.")
                initial = self.player
            else:
                break

#         print 1
        data = self.playercache.getPlayerInfo(self.player)
        if "<Unknown UUID>" not in data and "Server not ready" not in data:
            self.uuid = data[0]
            self.player = data[1]
        else:
            action = ask(
                "Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player \"{}\" exists."
                .format(self.player,
                        self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
                return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
#             print 2
            self.player = self.playercache.getPlayerInfo(self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
#         print "PlayerAddOperation.perform::self.uuid", self.uuid
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        #if self.tool.panel:
        #    self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(
                self.player)] = self.playerTag

            self.level.players.append(self.player)
            #if self.tool.panel:
            #self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(
                self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID["UUID"].append(self.uuid)
                self.tool.panel.player_UUID["Name"].append(self.player)

        self.tool.playerPos[self.editor.level.dimNo][(0, 0, 0)] = self.uuid
        self.tool.revPlayerPos[self.editor.level.dimNo][self.uuid] = (0, 0, 0)
        #         print 3
        r = self.playercache.getPlayerSkin(self.uuid, force_download=False)
        if not isinstance(r, (str, unicode)):
            #             print 'r 1', r
            r = r.join()
#             print 'r 2', r
        self.tool.playerTexture[self.uuid] = loadPNGTexture(r)
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
        self.playerTag.save(self.level.getPlayerPath(self.uuid))
        self.tool.nonSavedPlayers.append(self.level.getPlayerPath(self.uuid))
        self.tool.inOtherDimension[self.editor.level.dimNo].append(self.uuid)