Merge branch 'master' into release

This commit is contained in:
snowleo 2011-07-19 01:52:44 +02:00
commit 6af9ec266b
4 changed files with 64 additions and 16 deletions

View File

@ -215,11 +215,11 @@ public class EssentialsPlayerListener extends PlayerListener
user.getInventory().setContents(user.getSavedInventory()); user.getInventory().setContents(user.getSavedInventory());
user.setSavedInventory(null); user.setSavedInventory(null);
} }
user.dispose();
if (!ess.getSettings().getReclaimSetting()) if (!ess.getSettings().getReclaimSetting())
{ {
return; return;
} }
user.dispose();
final Thread thread = new Thread(new Runnable() final Thread thread = new Thread(new Runnable()
{ {
public void run() public void run()

View File

@ -1,9 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.OfflinePlayer;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import org.bukkit.entity.Player;
public class Commandban extends EssentialsCommand public class Commandban extends EssentialsCommand
@ -21,12 +23,24 @@ public class Commandban extends EssentialsCommand
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
final User player = getPlayer(server, args, 0, true); final User player = getPlayer(server, args, 0, true);
if (player.isAuthorized("essentials.ban.exempt")) if (player.getBase() instanceof OfflinePlayer)
{ {
sender.sendMessage(Util.i18n("banExempt")); if (sender instanceof Player
return; && !ess.getUser(sender).isAuthorized("essentials.ban.offline"))
{
sender.sendMessage(Util.i18n("banExempt"));
return;
}
} }
else
{
if (player.isAuthorized("essentials.ban.exempt"))
{
sender.sendMessage(Util.i18n("banExempt"));
return;
}
}
String banReason; String banReason;
if (args.length > 1) if (args.length > 1)
{ {
@ -42,4 +56,3 @@ public class Commandban extends EssentialsCommand
server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason)); server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason));
} }
} }

View File

@ -1,9 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.OfflinePlayer;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import org.bukkit.entity.Player;
public class Commandtempban extends EssentialsCommand public class Commandtempban extends EssentialsCommand
@ -21,10 +23,22 @@ public class Commandtempban extends EssentialsCommand
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
final User player = getPlayer(server, args, 0, true); final User player = getPlayer(server, args, 0, true);
if (player.isAuthorized("essentials.tempban.exempt")) if (player.getBase() instanceof OfflinePlayer)
{ {
sender.sendMessage(Util.i18n("tempbanExempt")); if (sender instanceof Player
return; && !ess.getUser(sender).isAuthorized("essentials.tempban.offline"))
{
sender.sendMessage(Util.i18n("tempbanExempt"));
return;
}
}
else
{
if (player.isAuthorized("essentials.tempban.exempt"))
{
sender.sendMessage(Util.i18n("tempbanExempt"));
return;
}
} }
final String time = getFinalArg(args, 1); final String time = getFinalArg(args, 1);
final long banTimestamp = Util.parseDateDiff(time, true); final long banTimestamp = Util.parseDateDiff(time, true);

View File

@ -5,6 +5,7 @@ import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import org.bukkit.entity.Player;
public class Commandtogglejail extends EssentialsCommand public class Commandtogglejail extends EssentialsCommand
@ -23,19 +24,39 @@ public class Commandtogglejail extends EssentialsCommand
} }
User p = getPlayer(server, args, 0, true); User p = getPlayer(server, args, 0, true);
if (p.isAuthorized("essentials.jail.exempt"))
{
sender.sendMessage(Util.i18n("mayNotJail"));
return;
}
if (args.length >= 2 && !p.isJailed()) if (args.length >= 2 && !p.isJailed())
{ {
if (p.getBase() instanceof OfflinePlayer)
{
if (sender instanceof Player
&& !ess.getUser(sender).isAuthorized("essentials.togglejail.offline"))
{
sender.sendMessage(Util.i18n("mayNotJail"));
return;
}
}
else
{
if (p.isAuthorized("essentials.jail.exempt"))
{
sender.sendMessage(Util.i18n("mayNotJail"));
return;
}
}
charge(sender); charge(sender);
p.setJailed(true); p.setJailed(true);
p.sendMessage(Util.i18n("userJailed")); p.sendMessage(Util.i18n("userJailed"));
p.setJail(null); p.setJail(null);
ess.getJail().sendToJail(p, args[1]); if (!(p.getBase() instanceof OfflinePlayer))
{
ess.getJail().sendToJail(p, args[1]);
}
else
{
// Check if jail exists
ess.getJail().getJail(args[1]);
}
p.setJail(args[1]); p.setJail(args[1]);
long timeDiff = 0; long timeDiff = 0;
if (args.length > 2) if (args.length > 2)
@ -56,7 +77,7 @@ public class Commandtogglejail extends EssentialsCommand
return; return;
} }
if (args.length >= 2 && p.isJailed() && !args[1].equalsIgnoreCase(p.getJail())) if (args.length >= 2 && p.isJailed() && args[1].equalsIgnoreCase(p.getJail()))
{ {
String time = getFinalArg(args, 2); String time = getFinalArg(args, 2);
long timeDiff = Util.parseDateDiff(time, true); long timeDiff = Util.parseDateDiff(time, true);