Skip to content

Commit

Permalink
Use ClassInfo#getCodeName for better names
Browse files Browse the repository at this point in the history
  • Loading branch information
GliczDev committed Dec 30, 2023
1 parent 25e8b67 commit 72439dd
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private CommandData handleCommand(StructCommand command, ScriptCommand scriptCom
.map(argument -> {
ClassInfo<?> argumentType = ReflectionUtil.getArgumentType(argument);
if (argumentType != null)
return argumentType.getName().getSingular();
return argumentType.getCodeName();
return null;
})
.filter(Objects::nonNull)
Expand All @@ -138,14 +138,14 @@ private EventData handleEvent(SkriptEvent event, SkriptEventInfo<?> eventInfo) {
private FunctionData handleFunction(StructFunction function, Signature<?> signature) {
String returnType = null;
if (signature.getReturnType() != null)
returnType = signature.getReturnType().getName().getSingular();
returnType = signature.getReturnType().getCodeName();

return new FunctionData(
function.getEntryContainer().getSource().getLine(),
signature.getName(),
signature.isLocal(),
Arrays.stream(signature.getParameters())
.map(parameter -> Map.entry(parameter.getName(), parameter.getType().getName().getSingular()))
.map(parameter -> Map.entry(parameter.getName(), parameter.getType().getCodeName()))
.collect(Collectors.toMap(
Map.Entry::getKey,
Map.Entry::getValue,
Expand Down

0 comments on commit 72439dd

Please sign in to comment.