mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-12-01 13:23:26 +01:00
Moved inventory checkTasks to directly before onInventoryInteract
This improves performance (allows unused threads to return faster), and resolves issues with pass-through transactions
This commit is contained in:
parent
6fce87386d
commit
2f1c45cae1
@ -39,7 +39,6 @@ public final class HopperPullListener {
|
|||||||
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
||||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||||
try {
|
try {
|
||||||
InventoryChangeListener.checkTasks(taskStarted);
|
|
||||||
if (sourceHolder == null || destinationHolder == null) {
|
if (sourceHolder == null || destinationHolder == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -133,6 +132,7 @@ public final class HopperPullListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
originalSource[inventoryContents.length] = movedItem;
|
originalSource[inventoryContents.length] = movedItem;
|
||||||
|
InventoryChangeListener.checkTasks(taskStarted);
|
||||||
InventoryChangeListener.onInventoryInteract("#hopper", sourceInventory, originalSource, null, sourceInventory.getLocation(), true);
|
InventoryChangeListener.onInventoryInteract("#hopper", sourceInventory, originalSource, null, sourceInventory.getLocation(), true);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -39,7 +39,6 @@ public final class HopperPushListener {
|
|||||||
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
||||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||||
try {
|
try {
|
||||||
InventoryChangeListener.checkTasks(taskStarted);
|
|
||||||
if (sourceHolder == null || destinationHolder == null) {
|
if (sourceHolder == null || destinationHolder == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -110,6 +109,7 @@ public final class HopperPushListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InventoryChangeListener.checkTasks(taskStarted);
|
||||||
InventoryChangeListener.onInventoryInteract("#hopper", destinationInventory, originalDestination, null, destinationInventory.getLocation(), true);
|
InventoryChangeListener.onInventoryInteract("#hopper", destinationInventory, originalDestination, null, destinationInventory.getLocation(), true);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -227,8 +227,8 @@ public final class InventoryChangeListener extends Queue implements Listener {
|
|||||||
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
||||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||||
try {
|
try {
|
||||||
InventoryChangeListener.checkTasks(taskStarted);
|
|
||||||
Material containerType = (enderChest != true ? null : Material.ENDER_CHEST);
|
Material containerType = (enderChest != true ? null : Material.ENDER_CHEST);
|
||||||
|
InventoryChangeListener.checkTasks(taskStarted);
|
||||||
onInventoryInteract(player.getName(), inventory, containerState, containerType, inventoryLocation, true);
|
onInventoryInteract(player.getName(), inventory, containerState, containerType, inventoryLocation, true);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user