Jump to content
scootersam

Better Staff/Donator Handler.

Recommended Posts

Here, its only simple:

[B]ActionSender.java[/B]
[CODE]public void checkPlayers(Player p) {
for (int i = 0; Config.Administrators.length > i; i++) {
if(p.getUsername().equals(Config.Administrators[i])) {
player.rights = 2;
}
}
for (int i = 0; Config.Moderators.length > i; i++) {
if(p.getUsername().equals(Config.Moderators[i])) {
player.rights = 1;
}
}
for (int i = 0; Config.Donators.length > i; i++) {
if(p.getUsername().equals(Config.Donators[i])) {
player.Donator = 1;
}
}
}
[/CODE]

[B]ActionSender.java[/B]
Under Login Event.

[CODE]checkPlayers(player);[/CODE]
[B]
Config.java[/B]

[CODE]public static final String[] Administrators = {"sam",""};
public static final String[] Moderators = {"","",""};
public static final String[] Donators = {"","","","","","",""};[/CODE]

Enjoy it:)

Share this post


Link to post
Share on other sites
Can I ask how this is "Better" ?

You have to add a persons name to that list every time you want to promote somebody.

Share this post


Link to post
Share on other sites
Yes but you dont have to keep using checks, for a command or w.e like...

[code]if(cmd[0].equals("command") && if(player.getUsername().equals("test")) {[/code]

It will be usefull for my command packet handler im going to release anyway. and it saves you going through every file looking for some-ones name:L

Share this post


Link to post
Share on other sites
Naming conventions?
And how is this better?

Share this post


Link to post
Share on other sites
It will be better for the CommandPacketHandlers im going to release either later today or tomorrow as i said..and i dont care about the way i Name my Conventions, thats the way i like to do it, it doesnt effect anything, its just basicly programming language grammar.

Share this post


Link to post
Share on other sites
Has cart honestly not noticed this idiotic thread yet?

Share this post


Link to post
Share on other sites
[quote name='Hope']Has cart honestly not noticed this idiotic thread yet?[/QUOTE]

Sorry I'm at school, you know, education?

Anyways cleaned.

Share this post


Link to post
Share on other sites
This isn't really a very good way of doing things. It should be ".equalsIgnoreCase" so that only that exact name gets admin/mod/donator or whatever.

But I still don't see how this is "a better" way of doing things.

Share this post


Link to post
Share on other sites
How is this better? You dont need this, you can just add everyone u made staff in a notepad for safekeepings :L plus your just adding another way people get staff. SavedGames and Cmds to give staff is enough.

Share this post


Link to post
Share on other sites

×