Skip to content

Commit

Permalink
Rename RanksObject to Ranks
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Nov 5, 2023
1 parent 456082a commit 2f56be9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
* Stores data on ranks
*/
@Table(name = "Ranks")
public class RankObject implements DataObject {
public class Ranks implements DataObject {

public static final String ID = "BentoBox-Ranks";

public RankObject(Map<String, Integer> rankReference) {
public Ranks(Map<String, Integer> rankReference) {
super();
this.rankReference = rankReference;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/world/bentobox/bentobox/managers/RanksManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.Database;
import world.bentobox.bentobox.database.objects.RankObject;
import world.bentobox.bentobox.database.objects.Ranks;

/**
* Ranks Manager
Expand Down Expand Up @@ -53,18 +53,18 @@ public class RanksManager {
BANNED_RANK_REF, BANNED_RANK);

@NonNull
private Database<RankObject> handler;
private Database<Ranks> handler;

public RanksManager() {
// Set up the database handler to store and retrieve Island classes
handler = new Database<>(BentoBox.getInstance(), RankObject.class);
if (!handler.objectExists(RankObject.ID)) {
handler = new Database<>(BentoBox.getInstance(), Ranks.class);
if (!handler.objectExists(Ranks.ID)) {
// Make the initial object
DEFAULT_RANKS.forEach((ref, rank) -> ranksPut(ref, rank));
handler.saveObject(new RankObject(ranks));
handler.saveObject(new Ranks(ranks));
} else {
// Load the ranks from the database
Objects.requireNonNull(handler.loadObject(RankObject.ID)).getRankReference().forEach(this::ranksPut);
Objects.requireNonNull(handler.loadObject(Ranks.ID)).getRankReference().forEach(this::ranksPut);
}

}
Expand Down

0 comments on commit 2f56be9

Please sign in to comment.