TriggerReactor

TriggerReactor

24.6k Downloads

Remove the need of quotes for single string arguments

soliddanii opened this issue ยท 1 comments

commented

All of the arguments that are strings need to be written between quotes for the plugin to recognize them as such and pass them correctly to the corresponding executor.

This method is very handy for multiple word strings. Ex.:
#MESSAGE "This is an example"

But it would be nice if you could ommit them in single word strings. Ex.:

Now:
#ITEMFRAMEROTATE "CLOCKWISE" 215 71 261
Suggestion:
#ITEMFRAMEROTATE CLOCKWISE 215 71 261

In general, for every one word string that represents an enum item. Thank you.

commented

Unfortunately, it requires a lot of syntax change, and I doubt it will create more problem than making it better.

As normal id(variables) is identified by not using double quote, and String is identified by double quote, removing the double quote means that the lexer needs some kind of change to distinguish both variable id and String.

So this will unlikely be changed.


Plus, if you have problem using the enum, you can use the Java.type just like other classes.

Lets say if we want to get Material enum value from String, then first you define the class by

var Material = Java.type('org.bukkit.Material');

Then

var thevalue = Material.valueOf("MahString");

This is because every enum classes have valueOf() method by default.

Obviously, it throws exception if the String doesn't exist in the enum class.

Link: Material
Link: Enum