Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 22 additions & 28 deletions FEATURES.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ UltiEssentials 是基于 UltiTools-API 框架开发的服务器基础功能插
| 命令 | 描述 | 权限 |
|------|------|------|
| `/back` | 返回上一个传送位置 | `ultiessentials.back` |
| `/recall <player>` | Bring an online player to you / 召回在线玩家 | `ultiessentials.recall.other` |
| `/spawn` | 传送到服务器出生点 | `ultiessentials.spawn.teleport` |
| `/setspawn` | 设置服务器出生点 | `ultiessentials.spawn.set` |
| `/lobby` `/hub` | 传送到主城 | `ultiessentials.lobby.teleport` |
Expand Down Expand Up @@ -71,6 +72,16 @@ These commands never change the separate vanilla IP ban list. A remaining vanill

新增 `/banip <IP> [原因]` 与 `/unbanip <IP>`,玩家和控制台均可使用。只接受数值 IPv4/IPv6 地址;封禁共享地址会影响该地址的全部玩家。命令仅管理本模块记录,不改动原版 IP 名单。解封会确认全部匹配记录已停用;独立玩家封禁仍可能生效。广播包含 IP,可通过现有广播开关关闭;执行者仍会收到结果。

### Staff recall / 管理员召回

`/recall Traveler` immediately brings the online player named `Traveler` to your current position and facing, even from another world; your own position does not change. Use the complete username (case-insensitive), not a prefix. This is a **player-only staff command**, gated by `ultiessentials.recall.other`; `/back` or `/tpahere` access alone does not grant it. It has no self or console variant, cooldown or warmup. For a consent-based request, use `/tpahere` instead. A vanished target looks offline unless you hold `ultiessentials.hide.see`; Tab completion also hides them. Another plugin may cancel the teleport: you then see `Recall failed; the player was not teleported`, not a success. On success you see `Recalled Traveler to your location`, and Traveler is told who recalled them. The recalled player can return using `/back` if that feature and its separate permission are enabled.

`features.recall.enabled` in `config/essentials.yml` defaults to `true` and now actually gates this command. Set it to `false` and run `/ul reload UltiEssentials` to refuse recalls. An existing `false` stays false; the module does not migrate or overwrite your choice. This key was removed in 6.3.0 when no command existed; with the implemented command it is live again and is no longer warned about as removed. A new JAR still requires a server restart.

`/recall Traveler` 会立即把完整用户名为 `Traveler` 的在线玩家传送到你当前的位置和朝向,允许跨世界,你自己不会移动。用户名不区分大小写,但不接受名字前缀。仅玩家可执行,需要独立的 `ultiessentials.recall.other` 权限;拥有 `/back` 或 `/tpahere` 权限不代表可以召回别人。不能召回自己,控制台不可用,无冷却、无预热。需要对方同意时用 `/tpahere`。没有 `ultiessentials.hide.see` 权限时,隐身目标按离线处理,也不会出现在补全中。其他插件取消传送时只提示失败;成功时双方收到通知。被召回者另有 `/back` 权限且该功能开启时,可以返回原位。

`config/essentials.yml` 中的 `features.recall.enabled` 默认 `true`,现在会真正控制召回命令。改为 `false` 后执行 `/ul reload UltiEssentials` 即可禁用;旧文件中已有的 `false` 不会被覆盖。该键在 6.3.0 因命令尚不存在而删除,现在恢复为有效设置,不再报告“已移除”。更换 JAR 仍需重启。

### Commands that take over vanilla commands / 接管原版命令的命令

`/ban`, `/banlist` and `/scoreboard` deliberately take over the vanilla commands of the same name: `/ban` and `/banlist` work on this module's own ban records, not on the server's ban list, and `/scoreboard` toggles this module's sidebar. The vanilla commands stay reachable as `minecraft:ban`, `minecraft:banlist` and `minecraft:scoreboard`.
Expand Down Expand Up @@ -118,6 +129,8 @@ features:
# ===== 传送功能 =====
back:
enabled: true # 启用 /back 返回命令
recall:
enabled: true # Enable staff /recall; 启用管理员召回
spawn:
enabled: true # 启用 /spawn 出生点命令
lobby:
Expand Down Expand Up @@ -219,6 +232,7 @@ UltiEssentials 不提供自动回复,也不读取 `config/autoreply.yml`。关
| 权限 | 描述 | 默认 |
|------|------|------|
| `ultiessentials.back` | 使用 /back 命令 | 玩家 |
| `ultiessentials.recall.other` | Staff recall of another online player / 召回其他在线玩家 | Grant explicitly through your permissions plugin / 通过权限插件单独授予 |
| `ultiessentials.spawn.teleport` | 传送到出生点 | 玩家 |
| `ultiessentials.spawn.set` | 设置出生点 | OP |
| `ultiessentials.lobby.teleport` | 传送到主城 | 玩家 |
Expand Down
22 changes: 12 additions & 10 deletions UAT-CHECKLIST.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.ultikits.plugins.essentials.commands;

import com.ultikits.plugins.essentials.config.EssentialsConfig;
import com.ultikits.plugins.essentials.service.OwnTeleports;
import com.ultikits.ultitools.annotations.I18n;
import com.ultikits.ultitools.annotations.command.CmdExecutor;
import com.ultikits.ultitools.annotations.command.CmdMapping;
import com.ultikits.ultitools.annotations.command.CmdParam;
import com.ultikits.ultitools.annotations.command.CmdSender;
import com.ultikits.ultitools.annotations.command.CmdTarget;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
* Immediate staff summon, not a return-location or consent-request command.
* Uses exact online names and respects Bukkit teleport cancellation; the summoned player can
* return with the separately permitted /back command. No cooldown, warmup or cross-world limit.
*/
@CmdTarget(CmdTarget.CmdTargetType.PLAYER)
@CmdExecutor(alias = {"recall"}, permission = "ultiessentials.recall.other", description = "essentials.command.recall.description")
@I18n("recall.description")
public class RecallCommand extends BaseEssentialsCommand {
private final EssentialsConfig config;

public RecallCommand(EssentialsConfig config) {
this.config = config;
}

@CmdMapping(format = "<player>")
public void recall(@CmdSender Player sender, @CmdParam("player") String playerName) {
if (!config.isRecallEnabled()) {
sender.sendMessage(i18n("essentials.error.feature_disabled"));
return;
}
Player target = Bukkit.getPlayerExact(playerName);
if (target == null || !target.isOnline() || !HideCommand.canSee(sender, target)) {
sender.sendMessage(i18n("essentials.error.player_not_found_or_offline"));
return;
}
if (target.getUniqueId().equals(sender.getUniqueId())) {
sender.sendMessage(i18n("essentials.recall.self"));
return;
}
if (!OwnTeleports.teleport(target, sender.getLocation())) {
sender.sendMessage(i18n("essentials.recall.failed"));
return;
}
sender.sendMessage(String.format(i18n("essentials.recall.success"), target.getName()));
target.sendMessage(String.format(i18n("essentials.recall.target"), sender.getName()));
}

@Override
protected void handleHelp(CommandSender sender) {
sender.sendMessage(i18n("essentials.help.recall"));
}

@Override
protected List<String> suggest(Player player, Command command, String[] args) {
if (args.length != 1) {
return Collections.emptyList();
}
return suggestOnlinePlayers(player, args[0]).stream()
.filter(name -> !name.equalsIgnoreCase(player.getName()))
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ public class EssentialsConfig extends AbstractConfigEntity {
previousComments = {"随机传送冷却时间(秒)"})
private int wildCooldown = 60;

// features.recall.enabled was removed in 6.3.0: there is no /recall command. A copy left in an
// operator's file is reported by RemovedConfigKeys (UltiKits/UltiEssentials#27).
// Restored with the implemented staff summon (#53); an operator's existing false is preserved.
// Register v1.0.0's shipped comment so upgraded files follow the server's language;
// any other text above this key stays the operator's, as for wild cooldown (#73).
@ConfigEntry(path = "features.recall.enabled", comment = "{essentials.config.essentials.features.recall.enabled}",
previousComments = {"启用 /recall 召回命令"})
private boolean recallEnabled = true;

// ============ 玩家状态功能 ============
@ConfigEntry(path = "features.fly.enabled", comment = "{essentials.config.essentials.features.fly.enabled}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,102 +2,31 @@

import com.ultikits.ultitools.abstracts.UltiToolsPlugin;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
* Settings this module used to declare in {@code config/essentials.yml} and no longer reads, and the
* warning that tells an operator whose file still holds one.
* <p>
* <b>Why a module needs this at all.</b> Deleting a configuration field removes the key from the
* code, not from anybody's disk. The framework writes a missing key's declared default into the
* operator's file on first load and never deletes a key it no longer declares
* ({@code AbstractConfigEntity#init}), so every server that has run this module still has the keys
* below in its file, carrying whatever value its operator last set. Without this warning an edited
* value would go on looking like a setting.
* <p>
* Each line names the module, the file and the key, and says where the setting's job went, because
* "this does nothing" without "here is what does" is only half of what the operator has to act on.
* <p>
* The check is scoped to an explicit list rather than derived by comparing the file against the
* declared fields: an unknown key in the file is not necessarily a key this module ever had (a typo,
* a hand-written note, another tool's key), and reporting all of them would bury the real removals.
* <p>
* 本模块已删除、但仍可能留在运维 {@code config/essentials.yml} 中的配置项,以及提示运维的警告。
* Compatibility entry point for the module's removed-setting check.
* The only formerly removed key, features.recall.enabled, is live again with #53. There are
* currently no removed settings to warn about; neither recall nor wild cooldown may be reported
* as having no effect. Retains the existing method and missing-configuration diagnostic.
*/
public final class RemovedConfigKeys {

/** The module name each warning names, matching this module's runtime name. */
private static final String MODULE = "UltiEssentials";

/** The file every key below lived in; used when the configuration bean is missing altogether. */
private static final String FILE = "config/essentials.yml";

/**
* One entry per removed key, the key path as it appears in the file; where its job went is
* {@link #reason}.
* <p>
* {@code features.wild.cooldown} is deliberately absent: it is a live key, bound to
* {@code /wild}'s cooldown through the framework's config-bound {@code @CmdCD}
* (UltiKits/UltiTools-Reborn#531), and reporting it here would tell operators to delete a
* setting that works.
*/
private static final String[] REMOVED = {
"features.recall.enabled",
};

/**
* Where a removed key's job went, in the server's language; completes the sentence
* "... and can be deleted from the file -- %s.". One literal key per removed setting, so the
* language guard checks each of them.
*/
private static String reason(String key, UltiToolsPlugin plugin) {
if ("features.recall.enabled".equals(key)) {
return plugin.i18n("essentials.warn.removed.recall");
}
throw new IllegalStateException("no reason text for removed key " + key);
}

private RemovedConfigKeys() {
}

/**
* Returns one warning per removed key that is still present in the operator's file, in the
* order the keys are listed above; an empty list when there is none.
* <p>
* Asks the framework whether each removed key is in the file through
* {@code AbstractConfigEntity#isPresentInFile(String)}, which answers from the file as it was last
* loaded -- including keys the entity no longer declares, which is exactly what a residual key is,
* and a key holding an explicit null. A fresh install has none of them, so a clean server gets an
* empty list. UltiTools-API 6.3.0 removed the parsed-file accessor this method used to read
* (UltiKits/UltiEssentials#68).
* <p>
* A file the framework could not read or parse reports no key present: the framework has already
* logged at SEVERE that it could not load the file and will not overwrite it, and repeating a
* removed-key warning for a file nobody could read would be a guess.
* <p>
* A configuration bean that is missing altogether yields a warning saying the file was not checked
* rather than an empty list: a check that silently does nothing and a server with no residual key
* would otherwise look the same in the log.
* Returns no removed-setting warnings for a loaded configuration.
*
* @param config the module's configuration after the framework has loaded it; may be null
* @param plugin the module, whose language catalogue gives the warnings their text
* @return the warnings to log, never null
* @param config the loaded configuration, or null when it could not be resolved
* @param plugin the module providing the diagnostic's translation
* @return an empty list, or the existing missing-configuration warning
*/
public static List<String> warningsFor(EssentialsConfig config, UltiToolsPlugin plugin) {
if (config == null) {
return Collections.singletonList(String.format(plugin.i18n("essentials.warn.removed_unreadable"),
MODULE, FILE));
}
String file = config.getConfigFilePath();
List<String> warnings = new ArrayList<>();
for (String removed : REMOVED) {
if (config.isPresentInFile(removed)) {
warnings.add(String.format(plugin.i18n("essentials.warn.removed_key"), MODULE, removed, file,
reason(removed, plugin)));
}
"UltiEssentials", "config/essentials.yml"));
}
return warnings;
return Collections.emptyList();
}
}
10 changes: 8 additions & 2 deletions src/main/resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

"essentials.teleport.success_warmup": "§aTeleport successful!",

"essentials.command.recall.description": "Bring an online player to your location",
"essentials.help.recall": "Usage: /recall <player> - bring an online player to you",
"essentials.recall.self": "You cannot recall yourself",
"essentials.recall.failed": "Recall failed; the player was not teleported",
"essentials.recall.success": "Recalled %s to your location",
"essentials.recall.target": "%s recalled you to their location",
"essentials.config.essentials.features.recall.enabled": "Enable /recall to bring an online player to you (requires ultiessentials.recall.other)",

"essentials.back.no_location": "No location to return to",
"essentials.back.success": "Teleported to previous location",

Expand Down Expand Up @@ -271,9 +279,7 @@
"essentials.command.whitelist.description": "Manage the whitelist",
"essentials.command.wild.description": "Random teleport",
"essentials.help.wild": "Use /wild to teleport to a random place in the wild",
"essentials.warn.removed.recall": "this module has no /recall command, so the setting never switched anything; the command is recorded as a feature request in UltiKits/UltiEssentials#53 (UltiKits/UltiEssentials#27)",
"essentials.warn.removed_unreadable": "%s: could not read %s, so it was not checked for settings this module has removed (UltiKits/UltiEssentials#27)",
"essentials.warn.removed_key": "%s: '%s' in %s has no effect and can be deleted from the file -- %s.",
"essentials.lock.refusal_open": "§cThis container is locked by §f%s",
"essentials.lock.refusal_break": "§cThis container is locked by §f%s§c and cannot be broken",
"essentials.deathpunish.prefix": "Death penalty:",
Expand Down
10 changes: 8 additions & 2 deletions src/main/resources/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

"essentials.teleport.success_warmup": "§a传送成功!",

"essentials.command.recall.description": "将在线玩家召回到你的位置",
"essentials.help.recall": "用法:/recall <玩家> - 将在线玩家召回到你身边",
"essentials.recall.self": "不能召回你自己",
"essentials.recall.failed": "召回失败;玩家未被传送",
"essentials.recall.success": "已将 %s 召回到你的位置",
"essentials.recall.target": "%s 将你召回到了其位置",
"essentials.config.essentials.features.recall.enabled": "启用 /recall 将在线玩家召回到你身边(需要 ultiessentials.recall.other 权限)",

"essentials.back.no_location": "没有可返回的位置",
"essentials.back.success": "已传送到上一个位置",

Expand Down Expand Up @@ -271,9 +279,7 @@
"essentials.command.whitelist.description": "白名单管理",
"essentials.command.wild.description": "随机传送",
"essentials.help.wild": "使用 /wild 随机传送到野外",
"essentials.warn.removed.recall": "本模块没有 /recall 命令,所以该设置从未开关过任何东西;该命令已作为功能请求记录在 UltiKits/UltiEssentials#53(UltiKits/UltiEssentials#27)",
"essentials.warn.removed_unreadable": "%s:无法读取 %s,因此未检查其中是否残留本模块已删除的设置(UltiKits/UltiEssentials#27)",
"essentials.warn.removed_key": "%s:设置 '%s'(位于 %s)不起任何作用,可以从文件中删除——%s。",
"essentials.lock.refusal_open": "§c该容器被 §f%s §c锁定",
"essentials.lock.refusal_break": "§c该容器被 §f%s §c锁定,无法破坏",
"essentials.deathpunish.prefix": "死亡惩罚:",
Expand Down
Loading
Loading