Skip to content

Commit

Permalink
V1.7.4 - Feature Flipping
Browse files Browse the repository at this point in the history
  • Loading branch information
Florianpal1 committed Jan 23, 2025
1 parent 878ea32 commit 9f8fa6b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/fr/florianpal/fauction/FAuction.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,12 @@ public void onEnable() {
placeholderAPIEnabled = true;
}

Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new ExpireSchedule(this), configurationManager.getGlobalConfig().getCheckEvery(), configurationManager.getGlobalConfig().getCheckEvery());
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new CacheSchedule(this), configurationManager.getGlobalConfig().getUpdateCacheEvery(), configurationManager.getGlobalConfig().getUpdateCacheEvery());
if (configurationManager.getGlobalConfig().isFeatureFlippingExpiration()) {
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new ExpireSchedule(this), configurationManager.getGlobalConfig().getCheckEvery(), configurationManager.getGlobalConfig().getCheckEvery());
}
if (configurationManager.getGlobalConfig().isFeatureFlippingCacheUpdate()) {
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new CacheSchedule(this), configurationManager.getGlobalConfig().getUpdateCacheEvery(), configurationManager.getGlobalConfig().getUpdateCacheEvery());
}

api = this;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,16 @@ public class GlobalConfig {

private int updateCacheEvery;

private boolean featureFlippingExpiration;

private boolean featureFlippingCacheUpdate;

public void load(YamlDocument config) {
lang = config.getString("lang");

featureFlippingExpiration = config.getBoolean("feature-flipping.item-expiration", true);
featureFlippingCacheUpdate = config.getBoolean("feature-flipping.cache-update", true);

orderBy = config.getString("orderBy");
dateFormat = config.getString("dateFormat");
remainingDateFormat = config.getString("remainingDateFormat");
Expand Down Expand Up @@ -169,4 +177,12 @@ public int getUpdateCacheEvery() {
public String getRemainingDateFormat() {
return remainingDateFormat;
}

public boolean isFeatureFlippingExpiration() {
return featureFlippingExpiration;
}

public boolean isFeatureFlippingCacheUpdate() {
return featureFlippingCacheUpdate;
}
}
7 changes: 6 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: 2
version: 3
lang: "en"

feature-flipping:
item-expiration: true
cache-update: true

orderBy: "ASC" # ASC or DESC / ASC : More recent to older / DESC : Older to more recent
dateFormat: "dd/MM/yyyy ':' HH:mm"
remainingDateFormat: "MMM ddd HHh mmm sss"
Expand Down

0 comments on commit 9f8fa6b

Please sign in to comment.