Skip to content

Commit

Permalink
add readme.md, fix , localization
Browse files Browse the repository at this point in the history
  • Loading branch information
xkball committed Jul 1, 2023
1 parent 3fae56b commit b6a07ec
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# KeyCommand

本模组允许玩家自定义一个按键并且绑定一个命令.

需要在服务端也安装本模组 并且只有服务端也有**完全一样**的自定义命令时才能执行命令.

当玩家处在多人游戏时,执行的命令无视玩家是否有op,只要服务端允许 可以执行玩家本不能执行的命令.

当玩家处在单机模式时,能执行的命令由玩家本身权限决定.

***

This mod allows players to customize a key and bind a command.

This mod needs to be installed on both side and only the server side also has
**Exactly The Same** command key bind, it can be executed.

When the player is in a multiplayer game,
the executed command ignores whether the player has op or not, as long as the server allows it to execute commands that the player cannot execute.

When the player is in single player game,the commands can be executed or not are determined by the player's own authority.
2 changes: 2 additions & 0 deletions src/main/java/com/xkball/key_command/JsonGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public static void main(String[] args) {
out.add("key_array",array);

System.out.println(KeyCommand.jsonToString(out));
System.out.println(0xC7);
System.out.println(0x31);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.ByteBufUtils;
Expand Down Expand Up @@ -47,7 +48,7 @@ public String getName() {

@Override
public boolean canUseCommand(int permLevel, String commandName) {
return true;
return player instanceof EntityPlayerMP || player.canUseCommand(permLevel, commandName);
}

@Override
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/assets/key_command/lang/en_us.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
key.category.key_command=Command Key
key.command.lm=Open LavaLocationManager
key.command.cd=Open Main Menu


3 changes: 3 additions & 0 deletions src/main/resources/assets/key_command/lang/zh_cn.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
key.category.key_command=命令按键
key.command.lm=打开 地标管理
key.command.cd=打开 菜单

0 comments on commit b6a07ec

Please sign in to comment.