Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
Fix #350
Browse files Browse the repository at this point in the history
Former-commit-id: 84a3c18
  • Loading branch information
Ghost-chu committed Feb 29, 2020
1 parent f352518 commit cd41bb4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.maxgamer.quickshop.PluginsIntegration.IntegrateStage;
import org.maxgamer.quickshop.PluginsIntegration.IntegratedPlugin;
import org.maxgamer.quickshop.PluginsIntegration.IntegrationStage;
import org.maxgamer.quickshop.QuickShop;

@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
public class FactionsUUIDIntegration implements IntegratedPlugin {
private List<String> createFlags;
private List<String> tradeFlags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.maxgamer.quickshop.PluginsIntegration.IntegrateStage;
import org.maxgamer.quickshop.PluginsIntegration.IntegratedPlugin;
import org.maxgamer.quickshop.PluginsIntegration.IntegrationStage;
import org.maxgamer.quickshop.QuickShop;

@SuppressWarnings("DuplicatedCode")
@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
public class ResidenceIntegration implements IntegratedPlugin {
List<String> createLimits;
List<String> tradeLimits;
Expand Down
26 changes: 18 additions & 8 deletions src/main/java/org/maxgamer/quickshop/Util/IntegrationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class IntegrationHelper {

public void register(@NotNull IntegratedPlugin clazz) {
if (!isIntegrationClass(clazz)) {
throw new InvaildIntegratedPluginClass();
throw new InvaildIntegratedPluginClass("Invaild Integration module: " + clazz.getName());
}
Util.debugLogHeavy("Registering " + clazz.getName());
integrations.add(clazz);
Expand All @@ -62,9 +62,9 @@ public void callIntegrationsLoad(@NotNull IntegrateStage stage) {
+ integratedPlugin.getName()
+ " stage is "
+ integratedPlugin
.getClass()
.getDeclaredAnnotation(IntegrationStage.class)
.loadStage());
.getClass()
.getDeclaredAnnotation(IntegrationStage.class)
.loadStage());
}
});
}
Expand All @@ -82,9 +82,9 @@ public void callIntegrationsUnload(@NotNull IntegrateStage stage) {
+ integratedPlugin.getName()
+ " stage is "
+ integratedPlugin
.getClass()
.getDeclaredAnnotation(IntegrationStage.class)
.loadStage());
.getClass()
.getDeclaredAnnotation(IntegrationStage.class)
.loadStage());
}
});
}
Expand Down Expand Up @@ -112,6 +112,16 @@ public boolean callIntegrationsCanTrade(@NotNull Player player, @NotNull Locatio
private boolean isIntegrationClass(@NotNull IntegratedPlugin clazz) {
return clazz.getClass().getDeclaredAnnotation(IntegrationStage.class) != null;
}

}

class InvaildIntegratedPluginClass extends IllegalArgumentException {}
class InvaildIntegratedPluginClass extends IllegalArgumentException {
public InvaildIntegratedPluginClass() {
super();
}

public InvaildIntegratedPluginClass(String s) {
super(s);
}

}

0 comments on commit cd41bb4

Please sign in to comment.