mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 09:37:50 +01:00
/tempban and /ban have the same problem as /tjail
new permissions: essentials.ban.offline essentials.tempban.offline
This commit is contained in:
parent
d388290427
commit
150a0e0ddd
@ -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,10 +23,22 @@ 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;
|
||||||
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user