if(playerCommand.startsWith("[REC]") && c.playerName == NAME || c.playerName == NAME2) {
this is for 317... convert to whatever revision you want
|
I'm wondering for commands that are designated to a username, how do you make it for 2 usernames?
if(playerCommand.startsWith("[REC]") && c.playerName == NAME || c.playerName == NAME2) {
this is for 317... convert to whatever revision you want
Code:if(playerCommand.startsWith("[REC]") && (c.playerName == NAME || c.playerName == NAME2)) {
Ah, I got it anyways, just forgot to mention in the post.
This works:
player.getUsername().equalsIgnoreCase("homework") || player.getUsername().equalsIgnoreCase("despair")) {
That works, right?
The || is the 'or' operator in java. Should be simple now for future reference
Search for You have completed whatever.. and post the method here
Why have you yet even attempted to troubleshoot or learn something yourself? Really, I'm not trying to sound mean or anything and I realize we all start somewhere but spend a week or two just learning the basics such as this, it'll save you a lot of time and effort in the long run and you won't have to constantly run to the help section.
OT: Here's a base using switch statements:
Code:case "command": if (player.getUsername().equalsIgnoreCase("player1") || player.getUsername().equalsIgnoreCase("player2") { doSomething(); return true; } return true;
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |