Skip to content
Draft
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
13 changes: 13 additions & 0 deletions core/src/main/java/dev/nandi0813/practice/listener/PlayerQuit.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public void onPlayerQuit(PlayerQuitEvent e) {

MatchManager.getInstance().invalidateRematchByPlayer(player);

dev.nandi0813.practice.manager.fight.match.Match playerMatch =
MatchManager.getInstance().getPlayerMatches().get(player);
if (playerMatch != null) {
playerMatch.removePlayer(player, true);
}

if (profile != null) {
profile.getActionBar().resetForReconnect();

Expand Down Expand Up @@ -87,6 +93,13 @@ public void onPlayerKick(PlayerKickEvent e) {

MatchManager.getInstance().invalidateRematchByPlayer(player);

// Same fix
dev.nandi0813.practice.manager.fight.match.Match playerMatch =
MatchManager.getInstance().getPlayerMatches().get(player);
if (playerMatch != null) {
playerMatch.removePlayer(player, true);
}

Profile profile = ProfileManager.getInstance().getProfile(player);
if (profile != null) {
profile.getActionBar().resetForReconnect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ public static boolean requiresSupport(Block block) {
|| type == Material.TRIPWIRE_HOOK
|| type == Material.TRIPWIRE
|| type == Material.LILY_PAD
|| type == Material.NETHER_WART;
|| type == Material.NETHER_WART
|| type == Material.NETHER_PORTAL // Portal blocks are destroyed by physics when their obsidian frame is broken.
|| type == Material.END_GATEWAY;
}

public static void loadArenaChunks(BasicArena arena) {
Expand Down Expand Up @@ -306,4 +308,4 @@ public static void setMannequinInvulnerable(Mannequin mannequin) {
mannequin.setPersistent(false);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,21 @@ public void reset() {
Block currentBlock = location.getBlock();

try {
// Set the block data directly - this is the primary method
currentBlock.setBlockData(blockData, false);

BlockState state = currentBlock.getState();
state.setBlockData(blockData);
state.update(true, false);
// Handle chest inventory if present
if (chestInventory != null) {
BlockState state = currentBlock.getState();
if (state instanceof Chest chest) {
BlockState chestState = currentBlock.getState();
if (chestState instanceof Chest chest) {
chest.getInventory().setContents(chestInventory);
chest.update(true, false);
}
}
} catch (Exception e) {
// Handle BlockData compatibility issues
// Just set the block type without the problematic block data
try {
currentBlock.setBlockData(material.createBlockData(), false);
} catch (Exception ex) {
// Ultimate fallback - just set material
currentBlock.setType(material, false);
}
}
Expand Down