Solved OwnBlocks - Players may not break blocks placed by others

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Mirthfire

New Member
Jan 20, 2018
5
1
0
Suggested name: OwnBlocks

What I want:
A script that keeps track of placed blocks, and who placed them. Players are not allowed to break blocks placed by other players.

Ideas for commands:
/ownblocks info - Display who owns the target block
/ownblocks add - Makes the target block protected for the player
/ownblocks delete - Excludes the target block from being protected

Ideas for permissions:
OwnBlocks.ignoreOwnership - Allows a player to break blocks placed by others. This is typically given to admins.
OwnBlocks.use - Allows a player to even use OwnBlocks
OwnBlocks.info - Allows a player to use command /ownblocks info
OwnBlocks.add - Allows a player to use command /ownblocks add
OwnBlocks.delete - Allows a player to use command /ownblocks delete
 
not tested
code_language.skript:
on place:
    if player has permission "OwnBlocks.use":
        set {ownerOfBlock::%event-block's location%} to player

on break:
    if {ownerOfBlock::%event-block's location%} is set:
        if {ownerOfBlock::%event-block's location%} is not player:
            if player does not have permission "OwnBlocks.ignoreOwnership":
                cancel event
                send "&cThis block is owned by %{ownerOfBlock::%event-block's location%}%."
            else:
                delete {ownerOfBlock::%event-block's location%}
        else:
            delete {ownerOfBlock::%event-block's location%}

command /ownblocks <text>:
    trigger:
        if arg-1 is set:
            if arg-1 is "info":
                if player has permission "OwnBlocks.info":
                    send "&aThis block is owned by %{ownerOfBlock::%location of target block of player%}%."
                else:
                    send "&cYou do not have permission to use this command."
            else if arg-1 is "add":
                if player has permission "OwnBlocks.add":
                    set {ownerOfBlock::%location of target block of player%} to player
                    send "&aAdded protection!"
                else:
                    send "&cYou do not have permission to use this command."
            else if arg-1 is "delete":
                if player has permission "OwnBlocks.delete":
                    delete {ownerOfBlock::%location of target block of player%}
                    send "&aDeleted protection!"
                else:
                    send "&cYou do not have permission to use this command."
        else:
            send "&cInvalid command."
 
not tested
code_language.skript:
on place:
    if player has permission "OwnBlocks.use":
        set {ownerOfBlock::%event-block's location%} to player

on break:
    if {ownerOfBlock::%event-block's location%} is set:
        if {ownerOfBlock::%event-block's location%} is not player:
            if player does not have permission "OwnBlocks.ignoreOwnership":
                cancel event
                send "&cThis block is owned by %{ownerOfBlock::%event-block's location%}%."
            else:
                delete {ownerOfBlock::%event-block's location%}
        else:
            delete {ownerOfBlock::%event-block's location%}

command /ownblocks <text>:
    trigger:
        if arg-1 is set:
            if arg-1 is "info":
                if player has permission "OwnBlocks.info":
                    send "&aThis block is owned by %{ownerOfBlock::%location of target block of player%}%."
                else:
                    send "&cYou do not have permission to use this command."
            else if arg-1 is "add":
                if player has permission "OwnBlocks.add":
                    set {ownerOfBlock::%location of target block of player%} to player
                    send "&aAdded protection!"
                else:
                    send "&cYou do not have permission to use this command."
            else if arg-1 is "delete":
                if player has permission "OwnBlocks.delete":
                    delete {ownerOfBlock::%location of target block of player%}
                    send "&aDeleted protection!"
                else:
                    send "&cYou do not have permission to use this command."
        else:
            send "&cInvalid command."
Do I need any addons?
 
Suggested name: OwnBlocks

What I want:
A script that keeps track of placed blocks, and who placed them. Players are not allowed to break blocks placed by other players.

Ideas for commands:
/ownblocks info - Display who owns the target block
/ownblocks add - Makes the target block protected for the player
/ownblocks delete - Excludes the target block from being protected

Ideas for permissions:
OwnBlocks.ignoreOwnership - Allows a player to break blocks placed by others. This is typically given to admins.
OwnBlocks.use - Allows a player to even use OwnBlocks
OwnBlocks.info - Allows a player to use command /ownblocks info
OwnBlocks.add - Allows a player to use command /ownblocks add
OwnBlocks.delete - Allows a player to use command /ownblocks delete

Just a little reminder you can overwrite this with the use of pistons And don't forget About the slime blocks. Also there are double blocks like beds or Doors these can still be broken on 1 of THE 2 halfs.