Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
import java.util.function.Predicate;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.Objects;
import java.util.stream.Collectors;

import static com.earth2me.essentials.I18n.tlLiteral;
import static com.earth2me.essentials.I18n.tlLocale;
Expand Down Expand Up @@ -903,6 +905,11 @@ public BukkitScheduler getScheduler() {
return this.getServer().getScheduler();
}

@Override
public List<Player> getJailedPlayers() {
return getUsers().getAllUserUUIDs().stream().map(this::getUser).filter(Objects::nonNull).filter(User::isJailed).map(User::getBase).filter(Objects::nonNull).collect(Collectors.toList());
}

@Override
public IJails getJails() {
return jails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public interface IEssentials extends Plugin {

BukkitScheduler getScheduler();

List<Player> getJailedPlayers();

IJails getJails();

IWarps getWarps();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.earth2me.essentials.commands;

import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.utils.StringUtil;
import org.bukkit.Server;
import org.bukkit.entity.Player;

import java.util.stream.Collectors;

public class Commandjailedplayers extends EssentialsCommand {
public Commandjailedplayers() {
super("jailedplayers");
}

@Override
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
if (ess.getJailedPlayers() != null && !ess.getJailedPlayers().isEmpty()) {
sender.sendTl("jailedPlayersList", StringUtil.joinList(", ", ess.getJailedPlayers().stream().map(Player::getName).collect(Collectors.toList())));
} else {
sender.sendTl("jailedPlayersEmpty");
}
}
}
4 changes: 4 additions & 0 deletions Essentials/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,8 @@ itemdbCommandUsage=/<command> <item>
itemdbCommandUsage1=/<command> <item>
itemdbCommandUsage1Description=Searches the item database for the given item
jailAlreadyIncarcerated=<dark_red>Person is already in jail\:<secondary> {0}
jailedPlayersList=<primary>Jailed Players\:<reset> {0}
jailedPlayersEmpty=<primary>There are no jailed players.
jailList=<primary>Jails\:<reset> {0}
jailMessage=<dark_red>You do the crime, you do the time.
jailNotExist=<dark_red>That jail does not exist.
Expand All @@ -638,6 +640,8 @@ jailSet=<primary>Jail<secondary> {0} <primary>has been set.
jailWorldNotExist=<dark_red>That jail's world does not exist.
jumpEasterDisable=<primary>Flying wizard mode disabled.
jumpEasterEnable=<primary>Flying wizard mode enabled.
jailedplayersCommandDescription=List all jailed players.
jailedplayersCommandUsage=/<command>
jailsCommandDescription=List all jails.
jailsCommandUsage=/<command>
jumpCommandDescription=Jumps to the nearest block in the line of sight.
Expand Down
6 changes: 6 additions & 0 deletions Essentials/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ commands:
description: Names an item.
usage: /<command> [name]
aliases: [iname, einame, eitemname, itemrename, irename, eitemrename, eirename]
jailedplayers:
description: List all jailed players.
usage: /<command>
aliases: [ejailed, ejp]
jails:
description: List all jails.
usage: /<command>
Expand Down Expand Up @@ -955,6 +959,8 @@ permissions:
description: Allows the bearer to damage blocks while jailed
essentials.jail.allow-interact:
description: Allows the bearer to interact with blocks while jailed
essentials.jailedplayers:
description: Allows access to the /jailedplayers command
essentials.jails:
description: Allows access to the /jails command
essentials.deljail:
Expand Down
Loading