[614/634] How to Add New Rank To your Server (Like Donator Rank)
Hi guys, This is my First Tutorial .. I Know There is Better but I trying to be helpful.
First of All open your source files.
Then Go to org.dementhium.model.definition.PlayerDefinition.j ava
After you open PlayerDefinition Search For
Code:
private int rights;
And add under it
Code:
private int isDonator;
Then all Search For
Code:
public void setRights(int rights) {
this.rights = rights;
}
public int getRights() {
return rights;
}
And Add Under it
Code:
public void setDonator(int isDonator) {
this.isDonator = isDonator;
}
public int getDonator() {
return isDonator;
}
Now we Done with PlayerDefinition.java... So Close it.
Now Open ActionSender.java... you can find it in org.dementhium.net
After you open ActionSender Search For
Code:
public static final String[] MODERATORS
or
public static final String[] ADMINS
ANd add Under ONe of them
Code:
public static final String[] DONATORS = { "EXAMPLE"};
Then Search For
Code:
public static void loginResponse(Player player) {
And Add Right Under It
Code:
for (String donator : DONATORS)
if (player.getUsername().equalsIgnoreCase(donator))
player.getDefinition().setDonator(1);
And DOne..
Hope I Helped ... Please Comment if i helped you .. and if you have errors post them here :D, Thx.
EXTRA
Give Donator ANd DemoteDonator Commands:
GiveDonor:
Code:
if (command[0].equalsIgnoreCase("givedonator")) {
String name = getCompleteString(command, 1).toLowerCase();
Player o = World.getWorld().getPlayerInServer(name);
if (o == null) {
player.sendMessage("Could not find player: " + name);
return;
}
o.getDefinition().setDonator(1);
o.sendMessage(player.getUsername() + " has given you donator rank.");
player.sendMessage("You have gave " + name + " donator rank.");
}
Demote Donator:
Code:
if (command[0].equalsIgnoreCase("demotedonator")) {
String name = getCompleteString(command, 1).toLowerCase();
Player o = World.getWorld().getPlayerInServer(name);
if (o == null) {
player.sendMessage("Could not find player: " + name);
return;
}
player.getDefinition().setDonator(0);
o.sendMessage(player.getUsername() + " has removed your donator rank.");
player.sendMessage("You have removed " + name + "'s donator rank.");
}
Hope that help you guys.
Thanks,
Asaad <3