mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-25 09:59:49 -05:00
Fix build and add default method for reloadModule
Also write reload logic for PlotSquaredIntegrationV5
This commit is contained in:
1 parent
44c211d13f
commit
321cb151d0
5 files changed
+27
-19
No files matched your search
+6
-3
@@ -47,16 +47,19 @@ import java.util.Map;
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
|
||||
public class PlotSquaredIntegrationV5 extends QSIntegratedPlugin {
|
||||
private final boolean whiteList;
|
||||
private final boolean deleteUntrusted;
|
||||
private boolean whiteList;
|
||||
private boolean deleteUntrusted;
|
||||
private QuickshopCreateFlag createFlag;
|
||||
private QuickshopTradeFlag tradeFlag;
|
||||
|
||||
public PlotSquaredIntegrationV5(QuickShop plugin) {
|
||||
super(plugin);
|
||||
loadConfiguration();
|
||||
}
|
||||
|
||||
protected void loadConfiguration() {
|
||||
this.whiteList = plugin.getConfig().getBoolean("integration.plotsquared.whitelist-mode");
|
||||
this.deleteUntrusted = plugin.getConfig().getBoolean("integration.plotsquared.delete-when-user-untrusted");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,6 +40,7 @@ public class FabledIntegration extends QSIntegratedPlugin {
|
||||
|
||||
public FabledIntegration(QuickShop plugin) {
|
||||
super(plugin);
|
||||
plugin.getReloadManager().register(this);
|
||||
loadConfiguration();
|
||||
registerListener();
|
||||
}
|
||||
|
||||
+16
-15
@@ -28,25 +28,27 @@ import org.maxgamer.quickshop.integration.IntegrationStage;
|
||||
import org.maxgamer.quickshop.integration.QSIntegratedPlugin;
|
||||
import org.maxgamer.quickshop.util.Util;
|
||||
import org.maxgamer.quickshop.util.reload.ReloadResult;
|
||||
import org.maxgamer.quickshop.util.reload.ReloadStatus;
|
||||
|
||||
@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
|
||||
public class PlotSquaredIntegrationProxy extends QSIntegratedPlugin {
|
||||
private static QSIntegratedPlugin plotSquared;
|
||||
private final QSIntegratedPlugin plotSquared;
|
||||
|
||||
public PlotSquaredIntegrationProxy(QuickShop instance) {
|
||||
super(instance);
|
||||
}
|
||||
|
||||
private void initInstance() {
|
||||
if (plotSquared == null) {
|
||||
if (plugin.getServer().getPluginManager().getPlugin("PlotSquared").getClass().getPackage().getName().contains("intellectualsite")) {
|
||||
plotSquared = new PlotSquaredIntegrationV4(plugin);
|
||||
} else if (Util.isClassAvailable("com.plotsquared.core.configuration.Caption")) {
|
||||
plotSquared = new PlotSquaredIntegrationV5(plugin);
|
||||
} else {
|
||||
plotSquared = new PlotSquaredIntegrationV6(plugin);
|
||||
}
|
||||
if (plugin.getServer().getPluginManager().getPlugin("PlotSquared").getClass().getPackage().getName().contains("intellectualsite")) {
|
||||
plotSquared = new PlotSquaredIntegrationV4(plugin);
|
||||
} else if (Util.isClassAvailable("com.plotsquared.core.configuration.Caption")) {
|
||||
//Write reload logic for it
|
||||
plotSquared = new PlotSquaredIntegrationV5(plugin) {
|
||||
@Override
|
||||
public ReloadResult reloadModule() throws Exception {
|
||||
loadConfiguration();
|
||||
return super.reloadModule();
|
||||
}
|
||||
};
|
||||
plugin.getReloadManager().register(plotSquared);
|
||||
} else {
|
||||
plotSquared = new PlotSquaredIntegrationV6(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +84,6 @@ public class PlotSquaredIntegrationProxy extends QSIntegratedPlugin {
|
||||
|
||||
@Override
|
||||
public ReloadResult reloadModule() throws Exception {
|
||||
initInstance();
|
||||
return ReloadResult.builder().status(ReloadStatus.SUCCESS).build();
|
||||
return plotSquared.reloadModule();
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,7 @@ public class WorldGuardIntegration extends QSIntegratedPlugin {
|
||||
|
||||
public WorldGuardIntegration(QuickShop plugin) {
|
||||
super(plugin);
|
||||
plugin.getReloadManager().register(this);
|
||||
}
|
||||
|
||||
private StateFlag createOrGet(String key, boolean def) {
|
||||
|
||||
@@ -28,7 +28,9 @@ public interface Reloadable {
|
||||
*
|
||||
* @return Reloading success
|
||||
*/
|
||||
ReloadResult reloadModule() throws Exception;
|
||||
default ReloadResult reloadModule() throws Exception {
|
||||
return ReloadResult.builder().status(ReloadStatus.SUCCESS).build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user