mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Better constructor error handling in QueueProvider.
Add back default constructor requiring world to QueueCoordinator to indicate extents require this constructor
This commit is contained in:
parent
b3ddabda29
commit
3288721259
@ -69,6 +69,7 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
||||
private Runnable whenDone;
|
||||
|
||||
public BasicQueueCoordinator(@Nonnull World world) {
|
||||
super(world);
|
||||
this.world = world;
|
||||
this.modified = System.currentTimeMillis();
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public class DelegateQueueCoordinator extends QueueCoordinator {
|
||||
private final QueueCoordinator parent;
|
||||
|
||||
public DelegateQueueCoordinator(QueueCoordinator parent) {
|
||||
super(parent == null ? null : parent.getWorld());
|
||||
this.parent = parent;
|
||||
|
||||
if (parent != null) {
|
||||
|
@ -52,7 +52,10 @@ public abstract class QueueCoordinator {
|
||||
|
||||
@Inject private GlobalBlockQueue blockQueue;
|
||||
|
||||
public QueueCoordinator() {
|
||||
/**
|
||||
* Default constructor requires world to indicate any extents given to {@link QueueCoordinator} also need this constructor.
|
||||
*/
|
||||
public QueueCoordinator(@Nullable World world) {
|
||||
PlotSquared.platform().getInjector().injectMembers(this);
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,17 @@
|
||||
*/
|
||||
package com.plotsquared.core.queue;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class QueueProvider {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotSquared.class.getSimpleName());
|
||||
|
||||
public static QueueProvider of(@Nonnull final Class<? extends QueueCoordinator> primary) {
|
||||
return new QueueProvider() {
|
||||
|
||||
@ -37,6 +43,11 @@ public abstract class QueueProvider {
|
||||
try {
|
||||
return (QueueCoordinator) primary.getConstructors()[0].newInstance(world);
|
||||
} catch (Throwable e) {
|
||||
logger.info("Error creating Queue: " + primary.getName() + " - Does it have the correct constructor(s)?");
|
||||
if (!primary.getName().contains("com.plotsquared")) {
|
||||
logger.info("It looks like " + primary.getSimpleName()
|
||||
+ " is a custom queue. Please look for a plugin in its classpath and report to themm");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user