mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-01-04 23:37:47 +01:00
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:
parent
e279114a90
commit
32dbebd607
2
pom.xml
2
pom.xml
@ -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>
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user