Skip to content

Commit

Permalink
Add more debug messages to storage/loading of accounts.
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorfromhell committed Nov 4, 2023
1 parent 41db3c5 commit 3ff4e0b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Core/src/net/tnemc/core/io/storage/StorageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ public <T> Collection<T> loadAll(Class<? extends T> object, @Nullable final Stri
public <T> void store(T object, @Nullable String identifier) {

TNECore.log().inform("Storing Datable of type: " + object.getClass().getName(), DebugLevel.DEVELOPER);

//Debug
if(identifier != null) {
TNECore.log().inform("Identifier: " + identifier, DebugLevel.DEVELOPER);
}

final Datable<T> data = (Datable<T>)engine.datables().get(object.getClass());
if(data != null) {
TNECore.server().scheduler().createDelayedTask(()->data.store(connector, object, identifier),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void purge(StorageConnector<?> connector) {
public void store(StorageConnector<?> connector, @NotNull Account account, @Nullable String identifier) {
if(connector instanceof SQLConnector) {

TNECore.log().debug("Saving Account with ID: " + identifier, DebugLevel.STANDARD);
TNECore.log().debug("Saving Account with ID: " + identifier + " Name: " + account.getName(), DebugLevel.STANDARD);

//store the basic account information(accounts table)
((SQLConnector)connector).executeUpdate(((SQLConnector)connector).dialect().saveAccount(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.tnemc.core.api.callback.account.AccountSaveCallback;
import net.tnemc.core.api.response.AccountAPIResponse;
import net.tnemc.core.compatibility.PlayerProvider;
import net.tnemc.core.compatibility.log.DebugLevel;
import net.tnemc.core.currency.Currency;
import net.tnemc.core.io.storage.Datable;
import net.tnemc.core.io.storage.StorageConnector;
Expand Down Expand Up @@ -82,6 +83,8 @@ public void purge(StorageConnector<?> connector) {
@Override
public void store(StorageConnector<?> connector, @NotNull Account account, @Nullable String identifier) {

TNECore.log().debug("Saving Account with ID: " + identifier + " Name: " + account.getName(), DebugLevel.STANDARD);

final File accFile = new File(TNECore.directory(), "accounts/" + account.getIdentifier() + ".yml");
if(!accFile.exists()) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ public Collection<HoldingsEntry> loadAll(StorageConnector<?> connector, @Nullabl
final ConfigurationSection main = yaml.getConfigurationSection("Holdings");
for(final String server : main.getKeys(false)) {

if(! main.contains(server) || ! main.isConfigurationSection(server)) {
if(!main.contains(server) || ! main.isConfigurationSection(server)) {
continue;
}

for(final String region : main.getConfigurationSection(server).getKeys(false)) {

if(! main.contains(server + "." + region)) {
if(!main.contains(server + "." + region)) {
continue;
}
for(final String currency : main.getConfigurationSection(server + "." + region).getKeys(false)) {
Expand All @@ -196,7 +196,7 @@ public Collection<HoldingsEntry> loadAll(StorageConnector<?> connector, @Nullabl
EconomyManager.invalidCurrencies().add(currency);
}

if(! main.contains(server + "." + region + "." + currency)) {
if(!main.contains(server + "." + region + "." + currency)) {
continue;
}
for(final String handler : main.getConfigurationSection(server + "." + region + "." + currency).getKeys(false)) {
Expand Down

0 comments on commit 3ff4e0b

Please sign in to comment.