Fixed IllegalStateException error on some servers during server shutdowns.

This commit is contained in:
Intelli 2024-07-06 11:45:32 -06:00
parent ce8c194e0d
commit c67e69755d
9 changed files with 18 additions and 9 deletions

View File

@ -4,6 +4,7 @@ import java.sql.PreparedStatement;
import java.util.List;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -54,7 +55,7 @@ public class BlockBreakLogger {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}

View File

@ -4,6 +4,7 @@ import java.sql.PreparedStatement;
import java.util.List;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
@ -84,7 +85,7 @@ public class BlockPlaceLogger {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}

View File

@ -3,6 +3,7 @@ package net.coreprotect.database.logger;
import java.sql.PreparedStatement;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import net.coreprotect.CoreProtect;
@ -29,7 +30,7 @@ public class CommandLogger {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}

View File

@ -7,6 +7,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
@ -173,7 +174,7 @@ public class ContainerLogger extends Queue {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}

View File

@ -5,6 +5,7 @@ import java.sql.ResultSet;
import java.util.List;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.block.BlockState;
import net.coreprotect.CoreProtect;
@ -30,7 +31,7 @@ public class EntityKillLogger {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
@ -126,7 +127,7 @@ public class ItemLogger {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}

View File

@ -3,6 +3,7 @@ package net.coreprotect.database.logger;
import java.sql.PreparedStatement;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
@ -28,7 +29,7 @@ public class PlayerInteractLogger {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}

View File

@ -3,6 +3,7 @@ package net.coreprotect.database.logger;
import java.sql.PreparedStatement;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.block.BlockState;
import net.coreprotect.CoreProtect;
@ -30,7 +31,7 @@ public class PlayerKillLogger {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}

View File

@ -3,6 +3,7 @@ package net.coreprotect.database.logger;
import java.sql.PreparedStatement;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import net.coreprotect.CoreProtect;
@ -26,7 +27,7 @@ public class SignTextLogger {
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
if (Config.getGlobal().API_ENABLED) {
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}