mirror of
https://github.com/tanyaofei/minecraft-fakeplayer.git
synced 2025-09-14 19:26:51 +08:00
translation supports reloading
This commit is contained in:
parent
429613dd85
commit
1180d8f8a0
@ -75,6 +75,8 @@ public class CommandRegistry {
|
|||||||
private DebugCommand debugCommand;
|
private DebugCommand debugCommand;
|
||||||
@Inject
|
@Inject
|
||||||
private StopCommand stopCommand;
|
private StopCommand stopCommand;
|
||||||
|
@Inject
|
||||||
|
private TranslationCommand translationCommand;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Config config;
|
private Config config;
|
||||||
@ -128,7 +130,8 @@ public class CommandRegistry {
|
|||||||
Usage.of("hold", ComponentUtils.toString(translatable("fakeplayer.command.hold.description"), null), Permission.hold),
|
Usage.of("hold", ComponentUtils.toString(translatable("fakeplayer.command.hold.description"), null), Permission.hold),
|
||||||
Usage.of("stop", ComponentUtils.toString(translatable("fakeplayer.command.stop.description"), null), Permission.stop),
|
Usage.of("stop", ComponentUtils.toString(translatable("fakeplayer.command.stop.description"), null), Permission.stop),
|
||||||
Usage.of("cmd", ComponentUtils.toString(translatable("fakeplayer.command.cmd.description"), null), Permission.cmd),
|
Usage.of("cmd", ComponentUtils.toString(translatable("fakeplayer.command.cmd.description"), null), Permission.cmd),
|
||||||
Usage.of("reload", ComponentUtils.toString(translatable("fakeplayer.command.reload.description"), null), Permission.op)
|
Usage.of("reload", ComponentUtils.toString(translatable("fakeplayer.command.reload.description"), null), Permission.op),
|
||||||
|
Usage.of("reload-translation", ComponentUtils.toString(translatable("fakeplayer.command.reload-translation.description"), null), Permission.op)
|
||||||
),
|
),
|
||||||
|
|
||||||
command("select")
|
command("select")
|
||||||
@ -433,6 +436,9 @@ public class CommandRegistry {
|
|||||||
command("reload")
|
command("reload")
|
||||||
.withPermission(CommandPermission.OP)
|
.withPermission(CommandPermission.OP)
|
||||||
.executes(reloadCommand::reload),
|
.executes(reloadCommand::reload),
|
||||||
|
command("reload-translation")
|
||||||
|
.withPermission(CommandPermission.OP)
|
||||||
|
.executes(translationCommand::reloadTranslation),
|
||||||
|
|
||||||
// developer debug
|
// developer debug
|
||||||
command("debug")
|
command("debug")
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package io.github.hello09x.fakeplayer.core.command.impl;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import dev.jorel.commandapi.executors.CommandArguments;
|
||||||
|
import io.github.hello09x.devtools.core.transaction.PluginTranslator;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import static net.kyori.adventure.text.Component.translatable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tanyaofei
|
||||||
|
* @since 2024/7/29
|
||||||
|
**/
|
||||||
|
@Singleton
|
||||||
|
public class TranslationCommand {
|
||||||
|
|
||||||
|
private final PluginTranslator translator;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public TranslationCommand(PluginTranslator translator) {
|
||||||
|
this.translator = translator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reloadTranslation(@NotNull CommandSender sender, @NotNull CommandArguments args) {
|
||||||
|
translator.reload();
|
||||||
|
sender.sendMessage(translatable(
|
||||||
|
"fakeplayer.command.generic.success"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -61,6 +61,7 @@ fakeplayer.command.move.description=Move
|
|||||||
fakeplayer.command.move.forward.description=Move forward
|
fakeplayer.command.move.forward.description=Move forward
|
||||||
fakeplayer.command.move.left.description=Move left
|
fakeplayer.command.move.left.description=Move left
|
||||||
fakeplayer.command.move.right.description=Move right
|
fakeplayer.command.move.right.description=Move right
|
||||||
|
fakeplayer.command.reload-translation.description=Reload translation file
|
||||||
fakeplayer.command.reload.description=Reload config file
|
fakeplayer.command.reload.description=Reload config file
|
||||||
fakeplayer.command.reload.success=Success!
|
fakeplayer.command.reload.success=Success!
|
||||||
fakeplayer.command.respawn.description=Respawn a dead fake player
|
fakeplayer.command.respawn.description=Respawn a dead fake player
|
||||||
|
@ -61,6 +61,7 @@ fakeplayer.command.move.description=Move
|
|||||||
fakeplayer.command.move.forward.description=Move forward
|
fakeplayer.command.move.forward.description=Move forward
|
||||||
fakeplayer.command.move.left.description=Move left
|
fakeplayer.command.move.left.description=Move left
|
||||||
fakeplayer.command.move.right.description=Move right
|
fakeplayer.command.move.right.description=Move right
|
||||||
|
fakeplayer.command.reload-translation.description=Reload translation file
|
||||||
fakeplayer.command.reload.description=Reload config file
|
fakeplayer.command.reload.description=Reload config file
|
||||||
fakeplayer.command.reload.success=Success!
|
fakeplayer.command.reload.success=Success!
|
||||||
fakeplayer.command.respawn.description=Respawn a dead fake player
|
fakeplayer.command.respawn.description=Respawn a dead fake player
|
||||||
|
@ -61,6 +61,7 @@ fakeplayer.command.move.description=\u79FB\u52A8
|
|||||||
fakeplayer.command.move.forward.description=\u5411\u524D\u79FB\u52A8
|
fakeplayer.command.move.forward.description=\u5411\u524D\u79FB\u52A8
|
||||||
fakeplayer.command.move.left.description=\u5411\u5DE6\u79FB\u52A8
|
fakeplayer.command.move.left.description=\u5411\u5DE6\u79FB\u52A8
|
||||||
fakeplayer.command.move.right.description=\u5411\u53F3\u79FB\u52A8
|
fakeplayer.command.move.right.description=\u5411\u53F3\u79FB\u52A8
|
||||||
|
fakeplayer.command.reload-translation.description=\u91CD\u65B0\u52A0\u8F7D\u8BED\u8A00\u6587\u4EF6
|
||||||
fakeplayer.command.reload.description=\u91CD\u65B0\u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6
|
fakeplayer.command.reload.description=\u91CD\u65B0\u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6
|
||||||
fakeplayer.command.reload.success=\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6\u5B8C\u6210
|
fakeplayer.command.reload.success=\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6\u5B8C\u6210
|
||||||
fakeplayer.command.respawn.description=\u590D\u6D3B\u5047\u4EBA
|
fakeplayer.command.respawn.description=\u590D\u6D3B\u5047\u4EBA
|
||||||
|
@ -61,6 +61,7 @@ fakeplayer.command.move.description=\u79FB\u52A8
|
|||||||
fakeplayer.command.move.forward.description=\u5411\u524D\u79FB\u52A8
|
fakeplayer.command.move.forward.description=\u5411\u524D\u79FB\u52A8
|
||||||
fakeplayer.command.move.left.description=\u5411\u5DE6\u79FB\u52A8
|
fakeplayer.command.move.left.description=\u5411\u5DE6\u79FB\u52A8
|
||||||
fakeplayer.command.move.right.description=\u5411\u53F3\u79FB\u52A8
|
fakeplayer.command.move.right.description=\u5411\u53F3\u79FB\u52A8
|
||||||
|
fakeplayer.command.reload-translation.description=\u91CD\u65B0\u52A0\u8F09\u8A9E\u8A00\u6587\u4EF6
|
||||||
fakeplayer.command.reload.description=\u91CD\u65B0\u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6
|
fakeplayer.command.reload.description=\u91CD\u65B0\u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6
|
||||||
fakeplayer.command.reload.success=\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6\u5B8C\u6210
|
fakeplayer.command.reload.success=\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6\u5B8C\u6210
|
||||||
fakeplayer.command.respawn.description=\u590D\u6D3B\u5047\u4EBA
|
fakeplayer.command.respawn.description=\u590D\u6D3B\u5047\u4EBA
|
||||||
|
@ -61,6 +61,7 @@ fakeplayer.command.move.description=\u79FB\u52D5
|
|||||||
fakeplayer.command.move.forward.description=\u5411\u524D\u79FB\u52D5
|
fakeplayer.command.move.forward.description=\u5411\u524D\u79FB\u52D5
|
||||||
fakeplayer.command.move.left.description=\u5411\u5DE6\u79FB\u52D5
|
fakeplayer.command.move.left.description=\u5411\u5DE6\u79FB\u52D5
|
||||||
fakeplayer.command.move.right.description=\u5411\u53F3\u79FB\u52D5
|
fakeplayer.command.move.right.description=\u5411\u53F3\u79FB\u52D5
|
||||||
|
fakeplayer.command.reload-translation.description=\u91CD\u65B0\u52A0\u8F09\u8A9E\u8A00\u6587\u4EF6
|
||||||
fakeplayer.command.reload.description=\u91CD\u65B0\u52A0\u8F09\u914D\u7F6E\u6587\u4EF6
|
fakeplayer.command.reload.description=\u91CD\u65B0\u52A0\u8F09\u914D\u7F6E\u6587\u4EF6
|
||||||
fakeplayer.command.reload.success=\u91CD\u8F09\u914D\u7F6E\u6587\u4EF6\u5B8C\u6210
|
fakeplayer.command.reload.success=\u91CD\u8F09\u914D\u7F6E\u6587\u4EF6\u5B8C\u6210
|
||||||
fakeplayer.command.respawn.description=\u590D\u6D3B\u5047\u4EBA
|
fakeplayer.command.respawn.description=\u590D\u6D3B\u5047\u4EBA
|
||||||
|
@ -61,6 +61,7 @@ fakeplayer.command.move.description=\u79FB\u52D5
|
|||||||
fakeplayer.command.move.forward.description=\u5411\u524D\u79FB\u52D5
|
fakeplayer.command.move.forward.description=\u5411\u524D\u79FB\u52D5
|
||||||
fakeplayer.command.move.left.description=\u5411\u5DE6\u79FB\u52D5
|
fakeplayer.command.move.left.description=\u5411\u5DE6\u79FB\u52D5
|
||||||
fakeplayer.command.move.right.description=\u5411\u53F3\u79FB\u52D5
|
fakeplayer.command.move.right.description=\u5411\u53F3\u79FB\u52D5
|
||||||
|
fakeplayer.command.reload-translation.description=\u91CD\u65B0\u52A0\u8F09\u8A9E\u8A00\u6587\u4EF6
|
||||||
fakeplayer.command.reload.description=\u91CD\u65B0\u52A0\u8F09\u914D\u7F6E\u6587\u4EF6
|
fakeplayer.command.reload.description=\u91CD\u65B0\u52A0\u8F09\u914D\u7F6E\u6587\u4EF6
|
||||||
fakeplayer.command.reload.success=\u91CD\u8F09\u914D\u7F6E\u6587\u4EF6\u5B8C\u6210
|
fakeplayer.command.reload.success=\u91CD\u8F09\u914D\u7F6E\u6587\u4EF6\u5B8C\u6210
|
||||||
fakeplayer.command.respawn.description=\u5FA9\u6D3B\u5047\u4EBA
|
fakeplayer.command.respawn.description=\u5FA9\u6D3B\u5047\u4EBA
|
||||||
|
Loading…
Reference in New Issue
Block a user