This tutorial is extremely easy and will allow you to deny access to someone who isn't/is a member on your server. Very simple and made for newbies didn't see one so i thought i'd post. Read on if you need this, don't bother if you don't as it's that simple.
Description: Explaining how and when to use if statements for commands.
Difficulty: 0.1/10
Assumed Knowledge: To be able to read.
Tested Server: Devolution, will work on all.
Files/Classes Modified: client.java
Result: To be able to define what player group you want to access certain features of the server.
Lots of people have been asking me about this so i thought id post, havent seen any other tutorials on it.
This also may clarify a few things you didn't know before.
Ok, first off ill explain what these things do.
Code:
if (playerIsMember == 1);
This piece of code will check if the player is a member, and should be put before the method or process.
Eg.
Code:
if (playerIsMember == 1); // The if statement will check the players status
sendMessage("Congratulations, You are a member!") //The message
} else
sendMessage("Sorry, your not currently a member.") //The else message
This is exactly the same when you want to write your own admin only command, it checks the player rights.
Code:
if (playerRights == 3); //The player rights check
sendMessage("Congratulations, your an owner") // The success message
{
if (playerRights == 2); // The next check
sendMessage("Congratulations, your an admin") // Message
{
if (playerRights == 1); // Next check
sendMessage("Nope, your only a moderator") // Message
} else
sendMessage("Ouch your a noob") // The message
I know it's longwinded and the code wont even work in context, its to help people understand what these things do in the process before the final outcome you see in the game.
Thanks, positive comments only. Did this in a rush so please post if their are fixes to be made.