Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 64c15f0

Browse files
author
CodeDoctorDE
committed
fix critical error
1 parent b08bc7f commit 64c15f0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/main/java/com/github/codedoctorde/linwood/entity/GameEntity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public class GameEntity {
2424
@OneToOne(mappedBy = "gameEntity")
2525
private GuildEntity guild;
2626

27+
public Long getId() {
28+
return id;
29+
}
2730

2831
public GuildEntity getGuild() {
2932
return guild;

src/main/java/com/github/codedoctorde/linwood/entity/NotificationEntity.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@ public class NotificationEntity {
1616
@Column(name = "id")
1717
private Long id;
1818
@Column
19-
@Nullable
2019
private Long teamRoleId = null;
2120
@Column
22-
@Nullable
2321
private Long supportChatId = null;
2422
@Column
25-
@Nullable
2623
private Long statusChatId = null;
2724
@Column
28-
@Nullable
2925
private Long logChatId = null;
3026
@OneToOne(mappedBy = "notificationEntity")
3127
private GuildEntity guild;
@@ -60,6 +56,7 @@ public void setTeamRoleId(Long teamRoleId) {
6056
this.teamRoleId = teamRoleId;
6157
}
6258

59+
@Nullable
6360
public Long getSupportChatId() {
6461
return supportChatId;
6562
}

src/main/java/com/github/codedoctorde/linwood/listener/NotificationListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.awt.*;
1515
import java.text.MessageFormat;
1616
import java.time.LocalDateTime;
17+
import java.util.Objects;
1718
import java.util.ResourceBundle;
1819

1920
public class NotificationListener {
@@ -24,8 +25,8 @@ public void onMessageReceived(MessageReceivedEvent event){
2425
var session = Linwood.getInstance().getDatabase().getSessionFactory().openSession();
2526
var entity = Linwood.getInstance().getDatabase().getGuildById(session, event.getGuild().getIdLong());
2627
var notification = entity.getNotificationEntity();
27-
if(event.getChannel().getIdLong() ==
28-
notification.getSupportChatId()){
28+
if(Objects.equals(event.getChannel().getIdLong(),
29+
notification.getSupportChatId())){
2930
var role = event.getGuild().getRoleById(notification.getTeamRoleId());
3031
var bundle = getBundle(entity);
3132
event.getGuild().findMembers(member -> member.getRoles().contains(role) && member.getOnlineStatus() == OnlineStatus.ONLINE).onSuccess(members -> {

0 commit comments

Comments
 (0)