Skip to content

Commit

Permalink
complete command
Browse files Browse the repository at this point in the history
TODO:
remove list when player logout
  • Loading branch information
N-Joy-Shadow committed Dec 29, 2021
1 parent f2283f8 commit b0e524c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void onInitialize() {

if(!IsExist){
UUidUtil.playerList.add(new EnKData(playerUUID,true));
context.getSource().getPlayer().sendSystemMessage(Text.of(String.format("EnK is %s", "register")),playerUUID);
context.getSource().getPlayer().sendSystemMessage(Text.of(String.format("EnK is %s", "enable")),playerUUID);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.TranslatableText;

import njoyshadowsmod.fabricchatkoreanconvertor.utils.EnKData;
import njoyshadowsmod.fabricchatkoreanconvertor.utils.ExceptStringUtil;
import njoyshadowsmod.fabricchatkoreanconvertor.utils.UUidUtil;
import njoyshadowsmod.fabricchatkoreanconvertor.utils.UUidUtil.*;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -24,6 +27,8 @@ public abstract class MixinServerPlayNetworkHandler {

@Shadow public ServerPlayerEntity player;

@Shadow public abstract ServerPlayerEntity getPlayer();

@Inject(method = "handleMessage", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Ljava/util/function/Function;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V"
Expand All @@ -38,8 +43,11 @@ public void receiveMessage(TextStream.Message message, CallbackInfo ci) {
String Rawstring = message.getRaw();
String string = message.getFiltered();
//translator
if(Rawstring.startsWith("-")){
string= new ExceptStringUtil().getString(Rawstring.substring(1));
for(EnKData playerdata : UUidUtil.playerList) {
if(this.getPlayer().getUuid() == playerdata.getUUID() && playerdata.getIsEnable()){
string= new ExceptStringUtil().getString(Rawstring);
break;
}
}


Expand Down

0 comments on commit b0e524c

Please sign in to comment.