mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 08:30:59 +00:00
kick player if they have associated with a banned share
This commit is contained in:
@@ -11,6 +11,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.programmerdan.minecraft.banstick.handler.BanStickEventHandler.doKickWithCheckup;
|
||||
|
||||
/**
|
||||
* BSShares DAO management object.
|
||||
*
|
||||
@@ -246,6 +248,15 @@ public final class BSShares {
|
||||
|
||||
BanStick.getPlugin().info("Found new overlap between {0} and {1}", forPlayer.getName(), player.getName());
|
||||
|
||||
// this happens after the player has already logged in
|
||||
// if the player has been associated with a banned share, kick them
|
||||
final List<BSBan> bans = BSBan.byShare(share, false);
|
||||
if (!bans.isEmpty()) {
|
||||
final BSBan ban = bans.get(0);
|
||||
|
||||
BanStick.getPlugin().info("New overlap between {0} and {1} resulting in at least one ban; kicking...", forPlayer.getName(), player.getName());
|
||||
doKickWithCheckup(player.getUUID(), ban);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -519,7 +519,7 @@ public class BanStickEventHandler implements Listener {
|
||||
* @param puuid The person to kick
|
||||
* @param picked The ban being applied
|
||||
*/
|
||||
public void doKickWithCheckup(final UUID puuid, final BSBan picked) {
|
||||
public static void doKickWithCheckup(final UUID puuid, final BSBan picked) {
|
||||
// now schedule a task to kick out the trash.
|
||||
Bukkit.getScheduler().runTask(BanStick.getPlugin(), new Runnable() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user