Jump to content
  • 0
Sign in to follow this  
shoppop

Dementhium | How do i set the donor command?

Question

my give donor command doesnt seem to work, im also having trouble finding the setRights method so i can copy it for setDonator, but it doesnt seem to be working nor saving.

Share this post


Link to post
Share on other sites

14 answers to this question

Recommended Posts

  • 0
[quote name='shoppop']my give donor command doesnt seem to work, im also having trouble finding the setRights method so i can copy it for setDonator, but it doesnt seem to be working nor saving.[/QUOTE]

Can you post the setdonator command?

Share this post


Link to post
Share on other sites
  • 0
ive messed around with it to try get it working.
here it is

if (command[0].equalsIgnoreCase("givedonator")) {
Player p = new Player(null, new PlayerDefinition(getCompleteString(
command, 1).substring(0,
getCompleteString(command, 1).length() - 1).replaceAll("_",
" "), null));
String name = getCompleteString(command, 1).toLowerCase();
Player o = World.getWorld().getPlayerInServer(name);
if (o == null) {
player.sendMessage("Could not find player: " + name);
return;
}
p.getDefinition().setDonator(1);
o.sendMessage(player.getUsername() + " has given you donator rank.");
player.sendMessage("You have gave " + name + " donator rank.");
}

Share this post


Link to post
Share on other sites
  • 0
[quote name='shoppop']ive messed around with it to try get it working.
here it is

if (command[0].equalsIgnoreCase("givedonator")) {
Player p = new Player(null, new PlayerDefinition(getCompleteString(
command, 1).substring(0,
getCompleteString(command, 1).length() - 1).replaceAll("_",
" "), null));
String name = getCompleteString(command, 1).toLowerCase();
Player o = World.getWorld().getPlayerInServer(name);
if (o == null) {
player.sendMessage("Could not find player: " + name);
return;
}
p.getDefinition().setDonator(1);
o.sendMessage(player.getUsername() + " has given you donator rank.");
player.sendMessage("You have gave " + name + " donator rank.");
}[/QUOTE]

Can I have the version you didn't mess around with? please use code tags.

Share this post


Link to post
Share on other sites
  • 0
if (command[0].equalsIgnoreCase("givedonor")) {
String name = command[1];
Player other = World.getWorld().getPlayerInServer(command[1]);
int rank = Integer.parseInt(command[2]);
other.setDonor(rank);
player.sendMessage("You have given " + name + " " + rank + " donations.");
}

code tags?

Share this post


Link to post
Share on other sites
  • 0
[quote name='shoppop']anyone?[/QUOTE]

Looks fine. Did you use it as ::givedonor (name) (rank) ?

Share this post


Link to post
Share on other sites
  • 0
yes the confirm message appears butt the player does not receive rank

Share this post


Link to post
Share on other sites
  • 0
You would need to double check the setDonor() method in the player class. Ideally, the laws of abstraction and encapsulation should give you comfort that the method does what it is supposed to but you cant be sure.

Share this post


Link to post
Share on other sites
  • 0
post the setDonator() function contents in code tags. Its in whatever class of type p.getDefinition()

Share this post


Link to post
Share on other sites
Sign in to follow this  

×