Skip to content

Commit

Permalink
修复假人名称前缀&假人名称后缀相关问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Oct 16, 2024
1 parent fb8b658 commit 7beb5d9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/dev/dubhe/gugle/carpet/mixin/PlayerCommandMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import carpet.commands.PlayerCommand;
import dev.dubhe.gugle.carpet.GcaSetting;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

Expand All @@ -12,6 +13,16 @@
abstract class PlayerCommandMixin {
@ModifyVariable(method = "spawn", at = @At("STORE"), remap = false)
private static String spawn(String value) {
return PlayerCommandMixin.gca$getName(value);
}

@ModifyVariable(method = "cantSpawn", at = @At("STORE"), remap = false)
private static String cantSpawn(String value) {
return PlayerCommandMixin.gca$getName(value);
}

@Unique
private static String gca$getName(String value) {
if (
!GcaSetting.fakePlayerNoneName.equals(GcaSetting.fakePlayerPrefixName)
&& !value.toLowerCase(Locale.ROOT).startsWith(GcaSetting.fakePlayerPrefixName.toLowerCase(Locale.ROOT))
Expand Down

0 comments on commit 7beb5d9

Please sign in to comment.