mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-09 18:08:37 +01:00
Move cleanup to front, don't discover if not necessary
This commit is contained in:
parent
2de657bca6
commit
606079ea98
@ -127,10 +127,21 @@ public class ExtensionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Periodically cleanup observers
|
||||||
|
MinecraftServer.getSchedulerManager().buildTask(() -> {
|
||||||
|
for (Extension ext : extensions.values()) {
|
||||||
|
ext.cleanupObservers();
|
||||||
|
}
|
||||||
|
}).repeat(1L, TimeUnit.MINUTE).schedule();
|
||||||
|
|
||||||
// Load extensions
|
// Load extensions
|
||||||
{
|
{
|
||||||
// Get all extensions and order them accordingly.
|
// Get all extensions and order them accordingly.
|
||||||
List<DiscoveredExtension> discoveredExtensions = discoverExtensions();
|
List<DiscoveredExtension> discoveredExtensions = discoverExtensions();
|
||||||
|
|
||||||
|
// Don't waste resources on doing extra actions if there is nothing to do.
|
||||||
|
if (discoveredExtensions.isEmpty()) return;
|
||||||
|
|
||||||
discoveredExtensions = generateLoadOrder(discoveredExtensions);
|
discoveredExtensions = generateLoadOrder(discoveredExtensions);
|
||||||
loadDependencies(discoveredExtensions);
|
loadDependencies(discoveredExtensions);
|
||||||
|
|
||||||
@ -164,13 +175,6 @@ public class ExtensionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// periodically cleanup observers
|
|
||||||
MinecraftServer.getSchedulerManager().buildTask(() -> {
|
|
||||||
for (Extension ext : extensions.values()) {
|
|
||||||
ext.cleanupObservers();
|
|
||||||
}
|
|
||||||
}).repeat(1L, TimeUnit.MINUTE).schedule();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user