From a3ae0ab9671fd1812fbba4a56cae221eb1f74b34 Mon Sep 17 00:00:00 2001 From: Rammelkast Date: Fri, 2 Jul 2021 17:19:14 +0200 Subject: [PATCH] Fix #155, update README.md --- README.md | 2 +- .../rammelkast/anticheatreloaded/AntiCheatReloaded.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5d6c6a7..6cf6c71 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -AntiCheatReloaded ![Latest Release](https://img.shields.io/github/v/release/Rammelkast/AntiCheatReloaded) ![Downloads](https://img.shields.io/github/downloads/Rammelkast/AntiCheatReloaded/total) ![Last Commit](https://img.shields.io/github/last-commit/Rammelkast/AntiCheatReloaded) +AntiCheatReloaded ![Latest Release](https://img.shields.io/github/v/release/Rammelkast/AntiCheatReloaded) ![Downloads](https://img.shields.io/github/downloads/Rammelkast/AntiCheatReloaded/total) ![Last Commit](https://img.shields.io/github/last-commit/Rammelkast/AntiCheatReloaded) ![Last Build](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.rammelkast.com%2Fjob%2FAntiCheatReloaded) ============= AntiCheatReloaded helps server admins combat the use of hacked clients and spambots. It analyses the behavior of players and can prevent malicious gameplay. The plugin offers a lot of customizability and can be connected across multiple servers in case it is used in a server network context. AntiCheatReloaded is based on gravitylow's AntiCheat and has been around since 2012. diff --git a/src/main/java/com/rammelkast/anticheatreloaded/AntiCheatReloaded.java b/src/main/java/com/rammelkast/anticheatreloaded/AntiCheatReloaded.java index 4bf19a7..151dccb 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/AntiCheatReloaded.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/AntiCheatReloaded.java @@ -70,8 +70,8 @@ public final class AntiCheatReloaded extends JavaPlugin { plugin = this; manager = new AntiCheatManager(this, getLogger()); - // Base threads on available cores, limit of 4 - final int threads = Math.min(Runtime.getRuntime().availableProcessors() / 4, 4); + // Base threads on available cores, lower limit of 1 and upper limit of 4 + final int threads = Math.max(Math.min(Runtime.getRuntime().availableProcessors() / 4, 4), 1); executorService = Executors.newFixedThreadPool(threads); Bukkit.getConsoleSender().sendMessage(PREFIX + ChatColor.GRAY + "Pool size is " + threads + " threads"); @@ -182,7 +182,9 @@ public final class AntiCheatReloaded extends JavaPlugin { // Save user levels verboseLog("Saving user levels..."); - config.getLevels().saveLevelsFromUsers(manager.getUserManager().getUsers()); + if (config != null) { + config.getLevels().saveLevelsFromUsers(manager.getUserManager().getUsers()); + } AntiCheatManager.close(); cleanup();