Skip to content

Commit 1ee5617

Browse files
committed
Fix and features
1 parent 373e85c commit 1ee5617

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

annotations/src/main/java/com/javadiscord/jdi/core/processor/ClassFileUtil.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
public class ClassFileUtil {
1515
private static final List<File> classesInPath = new ArrayList<>();
16+
private static boolean loadedParentJar = false;
1617

1718
private ClassFileUtil() {}
1819

@@ -72,7 +73,8 @@ private static List<File> getClasses(File file) throws IOException {
7273
List<File> classFiles = new ArrayList<>();
7374
if (file.isDirectory()) {
7475
classFiles.addAll(getClassesFromDirectory(file));
75-
} else if (isJarFile(file)) {
76+
} else if (isJarFile(file) && !loadedParentJar) {
77+
loadedParentJar = true;
7678
classFiles.addAll(getClassesFromJar(file));
7779
} else if (file.getName().endsWith(".class")) {
7880
classFiles.add(file);

core/src/main/java/com/javadiscord/jdi/core/GatewayEventListenerAnnotations.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ public void receive(EventType eventType, Object event) {
254254
);
255255
}
256256
LOGGER.trace("Invoking method {} with params {}", method.getName(), paramOrder);
257+
257258
method.invoke(listener, paramOrder.toArray());
259+
258260
} catch (Exception e) {
259261
LOGGER.error("Failed to invoke {}", method.getName(), e);
260262
throw new RuntimeException(e);

core/src/main/java/com/javadiscord/jdi/core/interaction/SlashCommandEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public Guild guild() {
122122
}
123123

124124
public User user() {
125-
return interaction.user();
125+
return interaction.member().user();
126126
}
127127

128128
public InteractionType interactionType() {

models/src/main/java/com/javadiscord/jdi/core/models/user/User.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,10 @@ public record User(
2222
@JsonProperty("premium_type") PremiumType premiumType,
2323
@JsonProperty("public_flags") int publicFlags,
2424
@JsonProperty("avtar_decoration") String avatarDecoration
25-
) {}
25+
) {
26+
27+
public String asMention() {
28+
return "<@" + id + ">";
29+
}
30+
31+
}

0 commit comments

Comments
 (0)