jeudi 1 mars 2018

Java basic 'if' statement parsing

So, let's say that in a method I have the following if statement:

 String displayName = e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if(displayName.equals(ChatColor.translateAlternateColorCodes('&', "&9&lDiamond Golem Spawner")))
{
}

How can I create a sort of 'shortcut' to shorten the above code in this way for instance:

if(displayName.customEquals("&9&lDiamond Golem Spawner")))
{
}

In order to automatically imply that my customEquals is actually equals(ChatColor.translateAlternateColorCodes('&', arg))

Thanks in advanced

Aucun commentaire:

Enregistrer un commentaire