fix: now the mapper automagically converts internal names to FQN

This commit is contained in:
zaaarf 2023-03-15 11:41:42 +01:00
parent 19b739943f
commit c46106beba
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C

View file

@ -52,7 +52,7 @@ public class ObfuscationMapper {
* @throws MappingNotFoundException if no mapping is found * @throws MappingNotFoundException if no mapping is found
*/ */
public String obfuscateClass(String name) { public String obfuscateClass(String name) {
ObfuscationData data = mapper.get(name); ObfuscationData data = mapper.get(name.replace('.', '/'));
if(data == null) if(data == null)
throw new MappingNotFoundException(name); throw new MappingNotFoundException(name);
else return data.obf; else return data.obf;
@ -80,10 +80,13 @@ public class ObfuscationMapper {
* @throws MappingNotFoundException if no mapping is found * @throws MappingNotFoundException if no mapping is found
*/ */
public String obfuscateMember(String parentName, String memberName) { public String obfuscateMember(String parentName, String memberName) {
ObfuscationData data = mapper.get(parentName); ObfuscationData data = mapper.get(parentName.replace('.', '/'));
if(data == null) if(data == null)
throw new MappingNotFoundException(parentName + "::" + memberName); throw new MappingNotFoundException(parentName + "::" + memberName);
return data.members.get(memberName); String member = data.members.get(memberName);
if(member == null)
throw new MappingNotFoundException(parentName + "::" + memberName);
return member;
} }
/** /**