Commit 0ae3c3d7 authored by Luke H-W's avatar Luke H-W Committed by GitHub
Browse files

Allow commands to target offline players (#1022)



* Add targetRequirement annotation for Command

* Added MTL lines for other langs

* Fix TargetRequirement enum scoping

* Adjust commands to targetRequirement system

* Add translation message sugar to prevent future messages from being translated for wrong player

* Temporarily disable offline targeting on /permission and /clear

* Preliminary README cleanup

* Readme commands cleanup

* Clean up command table in README, including column shuffle
Co-authored-by: default avatarAnimeGitB <AnimeGitB@bigblueball.in>
parent fa0344d1
......@@ -15,11 +15,6 @@ public final class TeleportAllCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (targetPlayer == null) {
CommandHandler.sendMessage(sender, translate(sender, "commands.execution.need_target"));
return;
}
if (!targetPlayer.getWorld().isMultiplayer()) {
CommandHandler.sendMessage(sender, translate(sender, "commands.teleportAll.error"));
return;
......
......@@ -26,11 +26,6 @@ public final class TeleportCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (targetPlayer == null) {
CommandHandler.sendMessage(sender, translate(sender, "commands.execution.need_target"));
return;
}
Position pos = targetPlayer.getPos();
float x = pos.getX();
float y = pos.getY();
......
......@@ -15,10 +15,10 @@ public class UnlockTowerCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
unlockFloor(sender, sender.getServer().getTowerScheduleManager()
unlockFloor(targetPlayer, targetPlayer.getServer().getTowerScheduleManager()
.getCurrentTowerScheduleData().getEntranceFloorId());
unlockFloor(sender, sender.getServer().getTowerScheduleManager()
unlockFloor(targetPlayer, targetPlayer.getServer().getTowerScheduleManager()
.getScheduleFloors());
CommandHandler.sendMessage(sender, translate(sender, "commands.unlocktower.success"));
......
......@@ -16,11 +16,6 @@ public final class WeatherCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (targetPlayer == null) {
CommandHandler.sendMessage(sender, translate(sender, "commands.execution.need_target"));
return;
}
int weatherId = 0;
int climateId = 1;
switch (args.size()) {
......
......@@ -88,7 +88,11 @@
"argument_error": "Invalid arguments.",
"clear_target": "Target cleared.",
"set_target": "Subsequent commands will target @%s by default.",
"need_target": "This command requires a target UID. Add a <@UID> argument or set a persistent target with /target @UID."
"set_target_online": "@%s is online. Some commands may require an offline target.",
"set_target_offline": "@%s is offline. Some commands may require an online target.",
"need_target": "This command requires a target UID. Add a <@UID> argument or set a persistent target with /target @UID.",
"need_target_online": "This command requires an online target UID, but current target is offline. Add a different <@UID> argument or set a persistent target with /target @UID.",
"need_target_offline": "This command requires an offline target UID, but current target is online. Add a different <@UID> argument or set a persistent target with /target @UID."
},
"status": {
"enabled": "Enabled",
......
......@@ -83,7 +83,11 @@
"argument_error": "Błędne argumenty.",
"clear_target": "Cel wyczyszczony.",
"set_target": "Następne komendy będą celować w @%s.",
"need_target": "Ta komenda wymaga docelowego UID. Dodaj argument <@UID> lub ustaw stały cel poleceniem /target @UID."
"set_target_online": "@%s jest online. Niektóre polecenia mogą wymagać celu offline.",
"set_target_offline": "@%s jest offline. Niektóre polecenia mogą wymagać celu online.",
"need_target": "Ta komenda wymaga docelowego UID. Dodaj argument <@UID> lub ustaw stały cel poleceniem /target @UID.",
"need_target_online": "To polecenie wymaga identyfikatora UID celu w trybie online, ale bieżący cel jest w trybie offline. Dodaj inny argument <@UID> lub ustaw trwały cel za pomocą /target @UID.",
"need_target_offline": "To polecenie wymaga identyfikatora UID celu offline, ale bieżący cel jest online. Dodaj inny argument <@UID> lub ustaw trwały cel za pomocą /target @UID."
},
"status": {
"enabled": "Włączone",
......
......@@ -88,7 +88,11 @@
"argument_error": "无效的参数。",
"clear_target": "目标已清除。",
"set_target": "随后的的命令都会以 @%s 为预设。",
"need_target": "此命令需要一个目标 UID。添加 <@UID> 参数或使用 /target @UID 来指定默认目标。"
"set_target_online": "@%s 在线。 某些命令可能需要离线目标。",
"set_target_offline": "@%s 离线。 某些命令可能需要在线目标。",
"need_target": "此命令需要一个目标 UID。添加 <@UID> 参数或使用 /target @UID 来指定默认目标。",
"need_target_online": "此命令需要在线目标 UID,但当前目标离线。 添加不同的 <@UID> 参数或使用 /target @UID 设置持久目标。",
"need_target_offline": "此命令需要离线目标 UID,但当前目标在线。 添加不同的 <@UID> 参数或使用 /target @UID 设置持久目标。"
},
"status": {
"enabled": "已启用",
......
......@@ -87,7 +87,11 @@
"argument_error": "無效的參數。",
"clear_target": "目標已清除.",
"set_target": "隨後的指令都會以@%s為預設。",
"need_target": "此指令需要一個目標 UID。添加 <@UID> 引數或者使用 /target @UID 來設定持久目標。"
"set_target_online": "@%s 在線。 某些命令可能需要離線目標。",
"set_target_offline": "@%s 離線。 某些命令可能需要在線目標。",
"need_target": "此指令需要一個目標 UID。添加 <@UID> 引數或者使用 /target @UID 來設定持久目標。",
"need_target_online": "此命令需要在線目標 UID,但當前目標離線。 添加不同的 <@UID> 參數或使用 /target @UID 設置持久目標。",
"need_target_offline": "此命令需要離線目標 UID,但當前目標在線。 添加不同的 <@UID> 參數或使用 /target @UID 設置持久目標。"
},
"status": {
"enabled": "已啟用",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment