-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return of the Block (a discussion) #3315
Comments
I fully agree, users shouldn't think of blocks just as items since they are not, blocks are items placed in a location. I believe As for the string comparison, people shouldn't be doing that to begin with, we have a warning about it for that reason. While convenient in some rather specific cases, it is a misuse so I don't mind breaking some scripts as long as who did them realizes what they are doing wrong. |
I'm 50/50 on this. While I agree its mostly redundant, Im sure someone out there might find it useful.
I 100% agree. Im sure ive done hacky string comparisons with blocks in the past, but most likely due to comparison issues with some blocks (which I think have all been fixed) .... at the end of the day, the user should really be using |
I think the world should be included because I can see how it may be useful. I also really like this idea, and I have had the exact scenario that you gave as an example! This thing helps me so much! |
Honestly I don't think it would hurt to have the world there. The more details the better. ex: send "Block: %block below player%" could result in
|
Yeah, I also feel like there should be examples in the skript docs that show how to correctly save block data to a variable to use in the future |
Description
I wanted to open up a discussion regarding the block object.
A common misconception in Skript is that a block == an item type.
This could be due to the fact that Block's class info returns a string form of the item type of said block.
Ie:
returns:
"Block: stone"
Quite often I see people saving a block to a variable, setting a block to air, then trying to reset said block back to the variable, not realizing that the block in the variable is now air.
ex:
^^^ Here, the user assumes
{_block}
=diamond ore
when in actuality it's the block object and the type is nowair
I for one remember being frustrated with this when I first started using Skript, not understanding the block object.
In a case like this, the user should be using either
type of block
orblock data of block
ex:
As you can see in the code for the Block class info:
Skript/src/main/java/ch/njol/skript/classes/data/BukkitClasses.java
Lines 220 to 222 in 2bd065d
We are returning the ItemType as a String.
One proposal I have, is to have it actually return a block string, rather than an ItemType, ex:
(this is just an example of something that can return, that can be a little more detailed for the user)
or maybe something like:
Understandably this could break a lot of scripts. For example, when a user is doing a string comparison, ie:
The user SHOULD be using
type of block
in this case, but due to the common misconception of a block object, and the fact the block's toString() method returns its item type as a string, a lot of Skripters misuse this.I wanted to open this up for discussion, and see if maybe we can come up with a way to better use the block object in Skript.
The text was updated successfully, but these errors were encountered: