summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <ementalo@gmx.co.uk>2011-07-07 21:05:08 +0100
committerementalo <ementalo@gmx.co.uk>2011-07-07 21:05:08 +0100
commitce14779d2bb76ca4df110d7f1d99e4da3ab03cb8 (patch)
tree153aeabb63324b8bcc6187374887a13de67cbc4b
parent4d3e8332a8e1a3b632419f242bfbec6b33457536 (diff)
downloadEssentials-ce14779d2bb76ca4df110d7f1d99e4da3ab03cb8.tar
Essentials-ce14779d2bb76ca4df110d7f1d99e4da3ab03cb8.tar.gz
Essentials-ce14779d2bb76ca4df110d7f1d99e4da3ab03cb8.tar.lz
Essentials-ce14779d2bb76ca4df110d7f1d99e4da3ab03cb8.tar.xz
Essentials-ce14779d2bb76ca4df110d7f1d99e4da3ab03cb8.zip
#571 test jailing offline players. Person needs to have visited the server at least once and have a players.yml file
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java17
2 files changed, 20 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
index acd06bf5a..888dcbf68 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
@@ -22,8 +22,12 @@ public class Commandtogglejail extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- User p = getPlayer(server, args, 0);
+ User p = getPlayer(server, args, 0, true);
+ if(p == null)
+ {
+
+ }
if (p.isAuthorized("essentials.jail.exempt"))
{
sender.sendMessage(Util.i18n("mayNotJail"));
diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
index 01ab569a1..ac19f7d74 100644
--- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
+++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
@@ -22,7 +22,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand
{
this.name = name;
}
-
+
public void setEssentials(IEssentials ess)
{
this.ess = ess;
@@ -35,9 +35,22 @@ public abstract class EssentialsCommand implements IEssentialsCommand
protected User getPlayer(Server server, String[] args, int pos) throws NoSuchFieldException, NotEnoughArgumentsException
{
+ return getPlayer(server, args, pos, false);
+ }
+
+ protected User getPlayer(Server server, String[] args, int pos, boolean getOffline) throws NoSuchFieldException, NotEnoughArgumentsException
+ {
if (args.length <= pos) throw new NotEnoughArgumentsException();
List<Player> matches = server.matchPlayer(args[pos]);
- if (matches.size() < 1) throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+
+ if (matches.size() < 1)
+ {
+ if (!getOffline) throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+ User u = ess.getOfflineUser(args[pos]);
+ if (u == null) throw new NoSuchFieldException(Util.i18n("playerNotFound"));
+ return u;
+ }
+
for (Player p : matches)
{
if (p.getDisplayName().startsWith(args[pos]))