Skip to content
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

A new executor, and a renewed executor #195

Merged
merged 22 commits into from Sep 18, 2019
Merged

Conversation

rkdrns4747
Copy link
Member

1. New executor, #KICK

This #KICK Executor is simply used to kick player.

1) kick sender - Not giving any argument

#KICK

2) kick sender with custom kick message - giving only one argument

#KICK "You are kicked"

3) kick specific player - giving only one argument

#KICK player("Pro_Snape")

4) kick specific player with custom kick message - giving two arguments

#KICK player("Pro_Snape") "You are kicked lmao"

2. Made #CLEARCHAT to accept Player instance as arg.

This makes #CLEARCHAT able to accept Player instance.

1) Clear specific player's chat

#CLEARCHAT player("Pro_Snape")

wysohn and others added 3 commits August 26, 2019 00:01
This #KICK Executor simply use to kick player.

1) kick sender - Not giving any argument
#KICK

2) kick sender with custom kick message - giving only one argument
#KICK "You are kicked"

3) kick specific player - giving only one argument
#KICK player("Pro_Snape")

4) kick specific player with custom kick message - giving two arguments
#KICK player("Pro_Snape") "You are kicked lmao"

Tested.
This commit makes #CLEARCHAT able to accept Player instance.

**1)** Clear specific player's chat

    #CLEARCHAT player("Pro_Snape")
@gerzytet gerzytet closed this Aug 26, 2019
@gerzytet gerzytet reopened this Aug 26, 2019
@gerzytet
Copy link
Contributor

The executors are looking good!
To make these executors more consistent with the style of the other executors, I have some suggestions:

  1. Add a validation check to reject argument lists that are too long, such as more than 2 args for #KICK
  2. When an argument has the wrong type, always print the argument itself in the error message rather than its type, so that it’s value is shown and users don’t ask us what a org.bukkit.Location is.
  3. Avoid chat colors in errors. It’s better to let the error handling within the interpreter format it for you. If you are interested in making prettier error messages, you should change the handling itself so that all error messages can benefit.

@gerzytet
Copy link
Contributor

Sorry about the close-reopen, that was an accident

print error if there are more than  two arguments.
add validation check when args's length is more than 2.
@rkdrns4747
Copy link
Member Author

Sorry about the close-reopen, that was an accident

Fixed what you're recommended. Hope these Executors work perfect.

@wysohn wysohn added the domain:suggestion A suggestion, i.e: new ideas, optimization, etc. label Aug 26, 2019
@wysohn wysohn added this to the 3.0.0 milestone Aug 26, 2019
@wysohn wysohn added this to In progress in 3.0.x via automation Aug 26, 2019
@wysohn wysohn changed the base branch from development to 3.0.0 August 26, 2019 19:07
@wysohn
Copy link
Member

wysohn commented Aug 26, 2019

@rkdrns4747
Thank you for the pull request!

Do you also mind to write test cases for this PR?

You can reference link

Actually, you will edit AbstractTestExecutors.java and write test codes just like the other few examples in it.

If you are able to do that, I would have no problem adding you to Collaborator.

Also, briefly learn about how 'git' works too! it will help you a lot.

same as title.
just knew eq() and anyString() don't work, also some elses.
some error fixed.
Mokito -> Mockito
same as last commit, 

Mokito -> Mockito
@wysohn
Copy link
Member

wysohn commented Aug 27, 2019

@rkdrns4747
Keep up the good work!

Please also be advised that we use 4 spaces instead of tab for indentation.

@rkdrns4747
Copy link
Member Author

rkdrns4747 commented Aug 27, 2019

@wysohn
kk, got it.
btw I got error while testing executor in Trivis, but I cannot see details of the error. Is there any way to see detailed information about an error occured while testing an Executor?

@wysohn
Copy link
Member

wysohn commented Aug 27, 2019

@rkdrns4747
If you are on Intellij, your test folder will be in green color

right click on it then you can run the test in your local machine (the run button will say something like 'run test blah blah')

it will throw error in there

ECMAException is usually caused directly by running javascript, so make sure that your assertError() are well implemented.

@rkdrns4747
Copy link
Member Author

rkdrns4747 commented Aug 27, 2019

@wyshon
I ran gradle build task in IntelliJ, but It says build finished without any errors.
Is this possible thing that build result is differrent between travis CI's build and IntelliJ's build?
(Also, I found "run test ... gger reactor" menu but It says "No tasks available.")

@wysohn
Copy link
Member

wysohn commented Aug 27, 2019

What version of jdk are you using?

It should be 1.8 though

@rkdrns4747
Copy link
Member Author

@wysohn

yea I'm using jdk1.8. and also project sdk is jdk 1.8

@wysohn
Copy link
Member

wysohn commented Aug 28, 2019

maybe directly right click on the java file instead of folder

we need to know what that ECMAException is caused by

@rkdrns4747
Copy link
Member Author

@wysohn kk. I'll try that after my school ended.

@rkdrns4747
Copy link
Member Author

rkdrns4747 commented Aug 28, 2019

ahh, now I know how Mockito works. thanks for help @wysohn!

@rkdrns4747
Copy link
Member Author

rkdrns4747 commented Aug 28, 2019

@wysohn
Can I ask you help one more? I got BUILD COMPLETE on IntelliJ, but I got error while building on Travis, ParserExeception.

this is what I got.

https://imgur.com/a/Q7uU0gx

@gerzytet
Copy link
Contributor

gerzytet commented Aug 28, 2019

When you’re using assertError, the error should be pre-computed to minimize any suprises
For example, use:
"Invalid world: 34"
Not:
"Invalid world: " + arg0

Also, when you test for equality in your JavaScript, make sure to use === instead of == for equality testing. == on some types can have surprising results. ("1" == 1 is true, 0 == "" is true, etc) === is less error prone

@rkdrns4747
Copy link
Member Author

@gerzytet ohh, that's why I don't feel good when I make new Executor, PlaceHolder. Thanks for reminding :)

also, I'll fix them a few hours later.

@wysohn
Copy link
Member

wysohn commented Aug 29, 2019

There must be a way in Intellij to test it locally

At least you can build it with gradle then it will throw errors in console as messages

We can't do much but assume that ECMAExeption is indeed thrown by the KICK executor itself, but we never know the details.

At least the code seems to be working, but maybe the message part of asserError() is not exactly matching with the one in the test cases.

@rkdrns4747
Copy link
Member Author

rkdrns4747 commented Aug 29, 2019

@wysohn I got passed KICK.js here test on Travis too, but my the actual problem is testClearChat() one that I recently added.
If assertError() 's message doesn't matched to Executor message well, It must have given me error when I build on my local device.

@wysohn
Copy link
Member

wysohn commented Aug 29, 2019

Apparently, that's a new error

If ParserException is thrown, I assume you have some syntax error in the CLEARCHAT executor

It's not related to the test

@rkdrns4747
Copy link
Member Author

@wysohn oh kk, I'll check it thx

@wysohn
Copy link
Member

wysohn commented Aug 30, 2019

Looks good to me!

Great work

@wysohn wysohn requested a review from gerzytet August 30, 2019 06:09
@wysohn wysohn moved this from In progress to Testing in 3.0.x Aug 30, 2019
Copy link
Contributor

@gerzytet gerzytet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve already kinda reviewed it, but ok

  • There are some stray == in clearchat
  • you forgot to prefix some JS variables with var (recommended for scope reasons)
  • eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

@wysohn
Copy link
Member

wysohn commented Sep 18, 2019

@rkdrns4747
Please also update Wiki accordingly.

@wysohn wysohn merged commit 0ae0cac into TriggerReactor:3.0.0 Sep 18, 2019
3.0.x automation moved this from Testing to Done Sep 18, 2019
@wysohn wysohn moved this from Done to Testing in 3.0.x Sep 18, 2019
@wysohn wysohn moved this from Testing to Beta in 3.0.x Sep 29, 2019
@rkdrns4747 rkdrns4747 moved this from Beta to Done in 3.0.x Oct 9, 2019
@rkdrns4747
Copy link
Member Author

Moved done, due to being published in ver2.2.1

@rkdrns4747 rkdrns4747 deleted the patch-4 branch October 9, 2019 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:suggestion A suggestion, i.e: new ideas, optimization, etc.
Projects
No open projects
3.0.x
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants