Skip to content
Merged

Fixes #534

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/src/main/java/dev/nandi0813/practice/listener/PlayerJoin.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import dev.nandi0813.practice.manager.profile.enums.ProfileStatus;
import dev.nandi0813.practice.manager.sidebar.SidebarManager;
import dev.nandi0813.practice.telemetry.transport.stats.PracticeStatsTelemetryLogger;
import dev.nandi0813.practice.manager.fight.match.Match;
import dev.nandi0813.practice.manager.fight.match.MatchManager;
import dev.nandi0813.practice.util.PermanentConfig;
import dev.nandi0813.practice.util.UpdateChecker;
import dev.nandi0813.practice.util.playerutil.PlayerUtil;
Expand Down Expand Up @@ -61,6 +63,14 @@ public void onPlayerJoin(PlayerJoinEvent e) {
profile1.setHideFromPlayers(true);
}, 10L);

// If the player was disconnected while in a match, remove them from it
// to prevent ending up in the match with lobby items on rejoin
if (profile.getStatus() == ProfileStatus.MATCH) {
Match liveMatch = MatchManager.getInstance().getLiveMatchByPlayer(player);
if (liveMatch != null)
liveMatch.removePlayer(player, true);
}

InventoryManager.getInstance().setLobbyInventory(player, true);
} else {
ProfileManager.getInstance().getProfile(player).setStatus(ProfileStatus.OFFLINE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void openConnection() {

try {
// Explicitly load the MariaDB driver to ensure it's available for JDBC DriverManager
Class.forName("org.mariadb.jdbc.Driver");
Class.forName("dev.nandi0813.practice.dependencies.mariadb.Driver");

HikariConfig config = new HikariConfig();
config.setJdbcUrl(url);
Expand Down
4 changes: 4 additions & 0 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>dev.nandi0813.practice.dependencies.hikari</shadedPattern>
</relocation>
<relocation>
<pattern>org.mariadb.jdbc</pattern>
<shadedPattern>dev.nandi0813.practice.dependencies.mariadb</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
Expand Down