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