Skip to content

Instantly share code, notes, and snippets.

@Signifies
Last active August 29, 2015 14:07
Show Gist options
  • Save Signifies/b570d0d6b1af26683b60 to your computer and use it in GitHub Desktop.
Save Signifies/b570d0d6b1af26683b60 to your computer and use it in GitHub Desktop.
Custom Player Message Method
/**
* Allows you to use basic Methods in the Player class in your message
* without having to concatenate in Java.
*
* */
static public void informPlayer(String msg, Player val) {
msg = msg.replaceAll("[playername]",val.getName());
msg = msg.replaceAll("[displayname]",val.getDisplayName());
msg = msg.replaceAll("[playerlistname]",val.getPlayerListName());
msg = msg.replaceAll("[worldname]",val.getWorld().getName());
msg = msg.replaceAll("[IP]","" +val.getAddress());
val.sendMessage(ChatColor.translateAlternateColorCodes('&',msg));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment