mirror of
https://github.com/Shiewk/BlockHistory3.git
synced 2026-04-28 04:24:17 +02:00
Fix RejectedExecutionException when too many actions are happening
This commit is contained in:
@@ -41,7 +41,7 @@ public final class HistoryManager {
|
||||
1,
|
||||
1,
|
||||
TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(0xff),
|
||||
new ArrayBlockingQueue<>(1000),
|
||||
new NamedLoggingThreadFactory(
|
||||
threadName,
|
||||
threadPriority,
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
public final class BlockListener implements Listener {
|
||||
|
||||
@@ -155,7 +156,7 @@ public final class BlockListener implements Listener {
|
||||
}
|
||||
signData.append(serializer.serialize(line));
|
||||
}
|
||||
BlockHistoryPlugin.instance().getHistoryManager().addHistoryElement(new BlockHistoryElement(
|
||||
addEntryToManager(new BlockHistoryElement(
|
||||
block.getWorld(),
|
||||
blockLocation.getBlockX(),
|
||||
blockLocation.getBlockY(),
|
||||
@@ -169,7 +170,11 @@ public final class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
private void addEntryToManager(BlockHistoryElement element){
|
||||
try {
|
||||
BlockHistoryPlugin.instance().getHistoryManager().addHistoryElement(element);
|
||||
} catch (RejectedExecutionException e){
|
||||
BlockHistoryPlugin.logger().warn("Too many actions are happening at the same time, skipping one");
|
||||
}
|
||||
}
|
||||
|
||||
private void createAndAddEntry(BlockHistoryType type, Player player, Block block) {
|
||||
|
||||
Reference in New Issue
Block a user