Skip to content

Commit

Permalink
Update to 1.14 BentoBox API
Browse files Browse the repository at this point in the history
Uses shorter table names in SQL databases.
Uses async saving methods.
  • Loading branch information
tastybento committed Jun 11, 2020
1 parent 0a768b0 commit f78b2c8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
<powermock.version>2.0.2</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.15.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.9.0</bentobox.version>
<bentobox.version>1.14.0-SNAPSHOT</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>2.0.0</build.version>
<build.version>2.1.0</build.version>
</properties>

<!-- Profiles will allow to automatically change build version. -->
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/world/bentobox/level/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ private void registerCommands(GameModeAddon gm) {
private void save(){
// Remove any potential null values from the cache
levelsCache.values().removeIf(Objects::isNull);
levelsCache.values().forEach(handler::saveObject);
levelsCache.values().forEach(handler::saveObjectAsync);
}

/**
Expand All @@ -330,7 +330,7 @@ public void setIslandLevel(World world, UUID targetPlayer, long level) {
// Add to cache
levelsCache.put(targetPlayer, ld);
topTen.addEntry(world, targetPlayer, getIslandLevel(world, targetPlayer));
handler.saveObject(ld);
handler.saveObjectAsync(ld);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/world/bentobox/level/TopTen.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void removeEntry(World world, UUID ownerUUID) {
}

public void saveTopTen() {
topTenList.values().forEach(handler::saveObject);
topTenList.values().forEach(handler::saveObjectAsync);
}

}
2 changes: 2 additions & 0 deletions src/main/java/world/bentobox/level/objects/LevelsData.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import com.google.gson.annotations.Expose;

import world.bentobox.bentobox.database.objects.DataObject;
import world.bentobox.bentobox.database.objects.Table;

@Table(name = "LevelsData")
public class LevelsData implements DataObject {

// uniqueId is the player's UUID
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/world/bentobox/level/objects/TopTenData.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import com.google.gson.annotations.Expose;

import world.bentobox.bentobox.database.objects.DataObject;
import world.bentobox.bentobox.database.objects.Table;

/**
* This class stores and sorts the top ten.
* @author tastybento
*
*/
@Table(name = "TopTenData")
public class TopTenData implements DataObject {

// UniqueId is the world name
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/addon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Level
main: world.bentobox.level.Level
version: ${version}${build.number}
icon: DIAMOND
api-version: 1.14

softdepend: AcidIsland, BSkyBlock, CaveBlock, AOneBlock, SkyGrid

Expand Down

0 comments on commit f78b2c8

Please sign in to comment.