Skip to content

Commit 321cb15

Browse files
Fix build and add default method for reloadModule
Also write reload logic for PlotSquaredIntegrationV5
1 parent 44c211d commit 321cb15

File tree

5 files changed

+27
-19
lines changed

5 files changed

+27
-19
lines changed

src/integration/plotsquared/5/src/main/java/org/maxgamer/quickshop/integration/plotsquared/PlotSquaredIntegrationV5.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@
4747
@SuppressWarnings("DuplicatedCode")
4848
@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
4949
public class PlotSquaredIntegrationV5 extends QSIntegratedPlugin {
50-
private final boolean whiteList;
51-
private final boolean deleteUntrusted;
50+
private boolean whiteList;
51+
private boolean deleteUntrusted;
5252
private QuickshopCreateFlag createFlag;
5353
private QuickshopTradeFlag tradeFlag;
5454

5555
public PlotSquaredIntegrationV5(QuickShop plugin) {
5656
super(plugin);
57+
loadConfiguration();
58+
}
59+
60+
protected void loadConfiguration() {
5761
this.whiteList = plugin.getConfig().getBoolean("integration.plotsquared.whitelist-mode");
5862
this.deleteUntrusted = plugin.getConfig().getBoolean("integration.plotsquared.delete-when-user-untrusted");
59-
6063
}
6164

6265
@Override

src/main/java/org/maxgamer/quickshop/integration/fabledskyblock/FabledIntegration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class FabledIntegration extends QSIntegratedPlugin {
4040

4141
public FabledIntegration(QuickShop plugin) {
4242
super(plugin);
43+
plugin.getReloadManager().register(this);
4344
loadConfiguration();
4445
registerListener();
4546
}

src/main/java/org/maxgamer/quickshop/integration/plotsquared/PlotSquaredIntegrationProxy.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,27 @@
2828
import org.maxgamer.quickshop.integration.QSIntegratedPlugin;
2929
import org.maxgamer.quickshop.util.Util;
3030
import org.maxgamer.quickshop.util.reload.ReloadResult;
31-
import org.maxgamer.quickshop.util.reload.ReloadStatus;
3231

3332
@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
3433
public class PlotSquaredIntegrationProxy extends QSIntegratedPlugin {
35-
private static QSIntegratedPlugin plotSquared;
34+
private final QSIntegratedPlugin plotSquared;
3635

3736
public PlotSquaredIntegrationProxy(QuickShop instance) {
3837
super(instance);
39-
}
40-
41-
private void initInstance() {
42-
if (plotSquared == null) {
43-
if (plugin.getServer().getPluginManager().getPlugin("PlotSquared").getClass().getPackage().getName().contains("intellectualsite")) {
44-
plotSquared = new PlotSquaredIntegrationV4(plugin);
45-
} else if (Util.isClassAvailable("com.plotsquared.core.configuration.Caption")) {
46-
plotSquared = new PlotSquaredIntegrationV5(plugin);
47-
} else {
48-
plotSquared = new PlotSquaredIntegrationV6(plugin);
49-
}
38+
if (plugin.getServer().getPluginManager().getPlugin("PlotSquared").getClass().getPackage().getName().contains("intellectualsite")) {
39+
plotSquared = new PlotSquaredIntegrationV4(plugin);
40+
} else if (Util.isClassAvailable("com.plotsquared.core.configuration.Caption")) {
41+
//Write reload logic for it
42+
plotSquared = new PlotSquaredIntegrationV5(plugin) {
43+
@Override
44+
public ReloadResult reloadModule() throws Exception {
45+
loadConfiguration();
46+
return super.reloadModule();
47+
}
48+
};
49+
plugin.getReloadManager().register(plotSquared);
50+
} else {
51+
plotSquared = new PlotSquaredIntegrationV6(plugin);
5052
}
5153
}
5254

@@ -82,7 +84,6 @@ public void unload() {
8284

8385
@Override
8486
public ReloadResult reloadModule() throws Exception {
85-
initInstance();
86-
return ReloadResult.builder().status(ReloadStatus.SUCCESS).build();
87+
return plotSquared.reloadModule();
8788
}
8889
}

src/main/java/org/maxgamer/quickshop/integration/worldguard/WorldGuardIntegration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class WorldGuardIntegration extends QSIntegratedPlugin {
5858

5959
public WorldGuardIntegration(QuickShop plugin) {
6060
super(plugin);
61+
plugin.getReloadManager().register(this);
6162
}
6263

6364
private StateFlag createOrGet(String key, boolean def) {

src/main/java/org/maxgamer/quickshop/util/reload/Reloadable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public interface Reloadable {
2828
*
2929
* @return Reloading success
3030
*/
31-
ReloadResult reloadModule() throws Exception;
31+
default ReloadResult reloadModule() throws Exception {
32+
return ReloadResult.builder().status(ReloadStatus.SUCCESS).build();
33+
}
3234

3335

3436
}

0 commit comments

Comments
 (0)