Skip to content

Commit

Permalink
Change dependency behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Aug 9, 2019
1 parent 420761b commit 7cee0b5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def ci = System.getenv().containsKey('CI')
if (!ci) apply plugin: 'signing'

group = 'io.izzel.ambershop'
version = '1.1.0' + (ci ? "-ci-${System.getenv('APPVEYOR_REPO_COMMIT').substring(0, 8)}" : '')
version = '1.1.1' + (ci ? "-ci-${System.getenv('APPVEYOR_REPO_COMMIT').substring(0, 8)}" : '')

minecraft {
version = '1.12.2-14.23.5.2768'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/izzel/ambershop/AmberShop.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
dependencies = {
@Dependency(id = "spongeapi"),
@Dependency(id = "economylite", optional = true),
@Dependency(id = "epicbanitem", version = "[0.3.2,)", optional = true)
@Dependency(id = "epicbanitem", optional = true)
}
)
public class AmberShop {
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/io/izzel/ambershop/module/EbiModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,24 @@ public class EbiModule {
@Inject
public EbiModule(AmberConfManager acm, Logger logger) {
val ebi = acm.get().shopSettings.blacklistSettings;
if (ebi.enable) {
if (ebi.enable && checkEbiVersion(logger)) {
impl = new EbiImpl(ebi.checkCreate, ebi.checkTrade);
logger.info("Using EpicBanItem for item blacklist.");
} else {
impl = new AbstractImpl();
}
}

private boolean checkEbiVersion(Logger logger) {
try {
Class.forName("com.github.euonmyoji.epicbanitem.api.CheckRuleService");
return true;
} catch (Exception e) {
logger.error("Item blacklist module requires EpicBanItem 0.3.2+ .");
return false;
}
}

public boolean checkCreate(ItemStack item, World world, Subject subject) {
return impl.checkCreate(item, world, subject);
}
Expand Down

0 comments on commit 7cee0b5

Please sign in to comment.