mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 12:35:15 +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;
|
private Runnable whenDone;
|
||||||
|
|
||||||
public BasicQueueCoordinator(@Nonnull World world) {
|
public BasicQueueCoordinator(@Nonnull World world) {
|
||||||
|
super(world);
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.modified = System.currentTimeMillis();
|
this.modified = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ public class DelegateQueueCoordinator extends QueueCoordinator {
|
|||||||
private final QueueCoordinator parent;
|
private final QueueCoordinator parent;
|
||||||
|
|
||||||
public DelegateQueueCoordinator(QueueCoordinator parent) {
|
public DelegateQueueCoordinator(QueueCoordinator parent) {
|
||||||
|
super(parent == null ? null : parent.getWorld());
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
@ -52,7 +52,10 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
@Inject private GlobalBlockQueue blockQueue;
|
@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);
|
PlotSquared.platform().getInjector().injectMembers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,11 +25,17 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.queue;
|
package com.plotsquared.core.queue;
|
||||||
|
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public abstract class QueueProvider {
|
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) {
|
public static QueueProvider of(@Nonnull final Class<? extends QueueCoordinator> primary) {
|
||||||
return new QueueProvider() {
|
return new QueueProvider() {
|
||||||
|
|
||||||
@ -37,6 +43,11 @@ public abstract class QueueProvider {
|
|||||||
try {
|
try {
|
||||||
return (QueueCoordinator) primary.getConstructors()[0].newInstance(world);
|
return (QueueCoordinator) primary.getConstructors()[0].newInstance(world);
|
||||||
} catch (Throwable e) {
|
} 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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user