Changed banlist-check for player-is-banned check if LiteBans is present (#77), release v1.5!

This commit is contained in:
Artemis-the-gr8 2022-07-04 22:26:36 +02:00
parent 98d9f94544
commit 5093fc6398
6 changed files with 15 additions and 8 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.artemis-the-gr8</groupId>
<artifactId>PlayerStats</artifactId>
<version>1.4</version>
<version>1.5</version>
<build>
<plugins>
<plugin>

View File

@ -6,7 +6,7 @@
<groupId>com.gmail.artemis-the-gr8</groupId>
<artifactId>PlayerStats</artifactId>
<version>1.4</version>
<version>1.5</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -13,12 +13,12 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ForkJoinPool;
import java.util.function.Predicate;
public class ReloadThread extends Thread {
@ -91,10 +91,17 @@ public class ReloadThread extends Thread {
"retrieved whitelist", time, DebugLevel.MEDIUM);
}
else if (config.excludeBanned()) {
Set<OfflinePlayer> bannedPlayers = Bukkit.getBannedPlayers();
offlinePlayers = Arrays.stream(Bukkit.getOfflinePlayers())
.parallel()
.filter(offlinePlayer -> !bannedPlayers.contains(offlinePlayer)).toArray(OfflinePlayer[]::new);
if (Bukkit.getPluginManager().getPlugin("LiteBans") != null) {
offlinePlayers = Arrays.stream(Bukkit.getOfflinePlayers())
.parallel()
.filter(Predicate.not(OfflinePlayer::isBanned))
.toArray(OfflinePlayer[]::new);
} else {
Set<OfflinePlayer> bannedPlayers = Bukkit.getBannedPlayers();
offlinePlayers = Arrays.stream(Bukkit.getOfflinePlayers())
.parallel()
.filter(offlinePlayer -> !bannedPlayers.contains(offlinePlayer)).toArray(OfflinePlayer[]::new);
}
MyLogger.logTimeTaken("ReloadThread",
"retrieved banlist", time, DebugLevel.MEDIUM);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,6 +1,6 @@
main: com.gmail.artemis.the.gr8.playerstats.Main
name: PlayerStats
version: 1.4
version: 1.5
api-version: 1.18
description: adds commands to view player statistics in chat
author: Artemis_the_gr8