-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix replay players interfering with advancements
- Loading branch information
1 parent
fd80e86
commit 82e9417
Showing
3 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/me/senseiwells/replay/mixin/rejoin/ServerPlayerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.senseiwells.replay.mixin.rejoin; | ||
|
||
import com.llamalad7.mixinextras.injector.WrapWithCondition; | ||
import me.senseiwells.replay.rejoin.RejoinedReplayPlayer; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.server.players.PlayerList; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(ServerPlayer.class) | ||
public class ServerPlayerMixin { | ||
@WrapWithCondition( | ||
method = "<init>", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/server/players/PlayerList;getPlayerAdvancements(Lnet/minecraft/server/level/ServerPlayer;)Lnet/minecraft/server/PlayerAdvancements;" | ||
) | ||
) | ||
private boolean shouldUpdateAdvancements(PlayerList instance, ServerPlayer player) { | ||
return !(player instanceof RejoinedReplayPlayer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters