mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-21 01:01:35 +08:00
Prevent players opening their own inventories in /invsee (#5061)
This commit is contained in:
parent
b71fb520aa
commit
1c22edbb1b
@ -8,6 +8,8 @@ import org.bukkit.inventory.Inventory;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class Commandinvsee extends EssentialsCommand {
|
||||
public Commandinvsee() {
|
||||
super("invsee");
|
||||
@ -21,6 +23,11 @@ public class Commandinvsee extends EssentialsCommand {
|
||||
}
|
||||
|
||||
final User invUser = getPlayer(server, user, args, 0);
|
||||
if (user == invUser) {
|
||||
user.sendMessage(tl("invseeNoSelf"));
|
||||
throw new NoChargeException();
|
||||
}
|
||||
|
||||
final Inventory inv;
|
||||
|
||||
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip")) {
|
||||
@ -40,7 +47,9 @@ public class Commandinvsee extends EssentialsCommand {
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final User user, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
return getPlayers(server, user);
|
||||
final List<String> suggestions = getPlayers(server, user);
|
||||
suggestions.remove(user.getName());
|
||||
return suggestions;
|
||||
} else {
|
||||
//if (args.length == 2) {
|
||||
// return Lists.newArrayList("equipped");
|
||||
|
@ -534,6 +534,7 @@ invseeCommandDescription=See the inventory of other players.
|
||||
invseeCommandUsage=/<command> <player>
|
||||
invseeCommandUsage1=/<command> <player>
|
||||
invseeCommandUsage1Description=Opens the inventory of the specified player
|
||||
invseeNoSelf=\u00a7cYou can only view other players' inventories.
|
||||
is=is
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
|
Loading…
Reference in New Issue
Block a user