My code works, but, it can cause some bug ? little help here please

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Skoll

Active Member
Sep 2, 2020
65
6
8
29
Hello guys and ladies.

I did that code, and it works perfectly so far, but, I don't know how exactly it work :emoji_upside_down:
It can cause some bug in the future ?
My objective is prevent chunkbans using furnaces. establishing a limit to place furnace, that is 8, and the player have to break old furnaces to place again. I know that the furnace blow up it will bug my code, and I will fix this using an expression in skquery lime.
I prevented that players break furnaces from each other, which can cause some bug too.
My doubt is: there are some things can cause some bugs that I'm not finding?

Code:
on place:
    if event-block is a furnace:
        if size of {chunkban.risk.place::furnace::%event-player%::*} is 8:
            cancel event
            message "&4&l[ChunkBan-Check]&f&l Você já colocou %size of {chunkban.risk.place::furnace::%event-player%::*}% fornalhas, remova alguma para por mais" to event-player
        else:
            add event-block to {chunkban.risk.place::furnace::%event-player%::*}
            if size of {chunkban.risk.place::furnace::%event-player%::*} is greater than 9:
                loop all players:
                    if loop-player has permission "OP" or "Admin" or "Sub-Admin" or "Moderator":
                        message "&4&l[ChunkBan-Check]&f&l %event-player% está colocando muitas fornalhas (%size of {chunkban.risk.place::furnace::%event-player%::*}%).max= 8" to loop-player

on break:
    if event-block is a furnace:
        cancel event
        loop {chunkban.risk.place::furnace::%event-player%::*}:
            if "%location of event-block%" is "%location of loop-value%":
                set block at location of event-block to air
                remove loop-value from {chunkban.risk.place::furnace::%event-player%::*}
            else:
                cancel event

Thanks.
[doublepost=1601487226,1601403765][/doublepost]
Code:
    if event-block is a furnace:
        if size of {chunkban.risk.place::furnace::%event-player%::*} is 8:
            cancel event
            message "&4&l[ChunkBan-Check]&f&l Você já colocou %size of {chunkban.risk.place::furnace::%event-player%::*}% fornalhas, remova alguma para por mais" to event-player
        else:
            add location of event-block to {chunkban.risk.place::furnace::%event-player%::*}
            if size of {chunkban.risk.place::furnace::%event-player%::*} is greater than 9:
                loop all players:
                    if loop-player has permission "OP" or "Admin" or "Sub-Admin" or "Moderator":
                        message "&4&l[ChunkBan-Check]&f&l %event-player% está colocando muitas fornalhas (%size of {chunkban.risk.place::furnace::%event-player%::*}%).max= 8" to loop-player

on break:

    if event-block is a furnace:
        if {chunkban.risk.place::furnace::%event-player%::*} contains location of event-block:
            remove location of event-block from {chunkban.risk.place::furnace::%event-player%::*}
        else:
            cancel event
            broadcast "&cEsta fornalha não te pertence"

SOLVED.
 
Status
Not open for further replies.