Skip to content

Instantly share code, notes, and snippets.

@theresajayne
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save theresajayne/c9706452d40bef675de2 to your computer and use it in GitHub Desktop.

Select an option

Save theresajayne/c9706452d40bef675de2 to your computer and use it in GitHub Desktop.
/**
* Edit XP
* @param player The player to edit XP for
* @param xpChange The Xp to set add or remove
* @param command The command to execute
*/
public void editxp(Player player, int xpChange, String command)
{
/**
* The Current Experience
*/
int currentXp = player.getExp();
switch(command) {
case "set":
player.setExp(xpChange);
break;
case "add":
player.setExp(currentXp+xpChange);
break;
case "rem":
player.setExp(currentXp - xpChange);
break;
default:
log.error("Unexpected Command");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment