mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 09:07:37 +00:00
Add bypass for command blocking and definite bans
This commit is contained in:
parent
ecbd9c02da
commit
bc6dbb1052
@ -1,10 +1,12 @@
|
||||
package dev.plex.listener.impl;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.listener.PlexListener;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
|
||||
@ -36,6 +38,7 @@ public class BanListener extends PlexListener
|
||||
|
||||
if (plugin.getPunishmentManager().isBanned(event.getUniqueId()))
|
||||
{
|
||||
if (Plex.get().getPermissions() != null && Plex.get().getPermissions().playerHas(null, Bukkit.getOfflinePlayer(event.getUniqueId()), "plex.ban.bypass")) return;
|
||||
PlexPlayer player = DataUtils.getPlayer(event.getUniqueId());
|
||||
player.getPunishments().stream().filter(punishment -> (punishment.getType() == PunishmentType.BAN || punishment.getType() == PunishmentType.TEMPBAN) && punishment.isActive()).findFirst().ifPresent(punishment ->
|
||||
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED,
|
||||
|
@ -46,6 +46,7 @@ public class CommandListener extends PlexListener
|
||||
{
|
||||
String command = "/" + event.getMessage().replaceFirst("/", "").trim();
|
||||
Player player = event.getPlayer();
|
||||
if (player.hasPermission("plex.commandblocker.bypass")) return;
|
||||
PlexPlayer plexPlayer = DataUtils.getPlayer(player.getUniqueId());
|
||||
String commandName = StringUtils.normalizeSpace(command).split(" ")[0].replaceFirst("/", "");
|
||||
String arguments = StringUtils.normalizeSpace(StringUtils.normalizeSpace(command).replace(command.split(" ")[0], ""));
|
||||
|
Loading…
Reference in New Issue
Block a user