Removing async and updating to 1.13.2 API

The async saving is not the right thing to do here anyway, so I'm
removing it.

https://github.com/BentoBoxWorld/Challenges/issues/45
This commit is contained in:
tastybento 2018-12-31 18:43:32 -08:00
parent e279114a90
commit 32dbebd607
5 changed files with 19 additions and 31 deletions

View File

@ -66,7 +66,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.13.1-R0.1-SNAPSHOT</version> <version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -82,7 +82,7 @@ public class ChallengesAddon extends Addon {
@Override @Override
public void onDisable(){ public void onDisable(){
if (challengesManager != null) { if (challengesManager != null) {
challengesManager.save(false); challengesManager.save();
} }
} }

View File

@ -367,7 +367,7 @@ public class ChallengesManager {
/** /**
* Save configs and player data * Save configs and player data
*/ */
private void save() { public void save() {
challengeMap.entrySet().forEach(en -> { challengeMap.entrySet().forEach(en -> {
lvConfig.saveConfigObject(en.getKey()); lvConfig.saveConfigObject(en.getKey());
en.getValue().forEach(chConfig::saveConfigObject); en.getValue().forEach(chConfig::saveConfigObject);
@ -385,18 +385,6 @@ public class ChallengesManager {
} }
} }
/**
* Save to the database
* @param async - if true, saving will be done async
*/
public void save(boolean async) {
if (async) {
addon.getServer().getScheduler().runTaskAsynchronously(addon.getPlugin(), this::save);
} else {
save();
}
}
/** /**
* Sets the challenge as complete and increments the number of times it has been completed * Sets the challenge as complete and increments the number of times it has been completed
* @param user - user * @param user - user

View File

@ -65,7 +65,7 @@ public class FreshSqueezedChallenges {
} }
makeLevels(user); makeLevels(user);
makeChallenges(user, world, overwrite); makeChallenges(user, world, overwrite);
addon.getChallengesManager().save(false); addon.getChallengesManager().save();
return true; return true;
} }

View File

@ -25,14 +25,14 @@ public class SaveListener implements Listener
{ {
if (!this.addon.getChallengesManager().getAllChallengesList(e.getWorld()).isEmpty()) if (!this.addon.getChallengesManager().getAllChallengesList(e.getWorld()).isEmpty())
{ {
this.addon.getChallengesManager().save(e.isAsynchronous()); this.addon.getChallengesManager().save();
} }
} }
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Variables // Section: Variables
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
private ChallengesAddon addon; private ChallengesAddon addon;