L2JMobius

C6 getSimpleName() instead getName.substring(x)

ReynalDev · 4 · 5449

Offline ReynalDev

  • Knight
  • ***
    • Posts: 92
  • https://reynaldev.pythonanywhere.com/
    • ReynalDev
I think this could be useful.

Use:
Code: [Select]
String className = getClass().getSimpleName());
instead

Code: [Select]
String className = getClass().getName().substring(46);
Commit: https://bitbucket.org/MobiusDev/l2j_mobius/commits/994d0aa90d7597d213ca9bbb15199f50bafbe325


Comparation:
Code: [Select]
public static void main(String[] args)
{
Config c = new Config();
System.out.println("getName --> " + c.getClass().getName());
System.out.println("getSimpleName --> " + c.getClass().getSimpleName());
}


output:
Code: [Select]
getName --> com.l2jfrozen.Config
getSimpleName --> Config



Offline ReynalDev

  • Knight
  • ***
    • Posts: 92
  • https://reynaldev.pythonanywhere.com/
    • ReynalDev
Have you tested it?

You want to know the class name of the NPC Class right? yeah im using it in L2jFrozen 1.5.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011