mirror of
https://github.com/itHotL/PlayerStats.git
synced 2025-02-21 02:31:58 +01:00
Added logic to fill database with statistics and substatistics
This commit is contained in:
parent
9d2c22bff6
commit
748498b99f
@ -1,8 +1,9 @@
|
||||
package com.artemis.the.gr8.playerstats.core.database;
|
||||
|
||||
import com.artemis.the.gr8.databasemanager.DatabaseManager;
|
||||
import com.artemis.the.gr8.databasemanager.models.MyStatType;
|
||||
import com.artemis.the.gr8.databasemanager.models.MyStatistic;
|
||||
import com.artemis.the.gr8.databasemanager.datamodels.MyStatType;
|
||||
import com.artemis.the.gr8.databasemanager.datamodels.MyStatistic;
|
||||
import com.artemis.the.gr8.databasemanager.datamodels.MySubStatistic;
|
||||
import com.artemis.the.gr8.playerstats.core.utils.EnumHandler;
|
||||
import org.bukkit.Statistic;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@ -33,7 +34,7 @@ public class Database {
|
||||
}
|
||||
|
||||
private void setUp() {
|
||||
databaseManager.setUp(getStats(), null);
|
||||
databaseManager.updateStatistics(getStats(), getSubStats());
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
@ -63,4 +64,19 @@ public class Database {
|
||||
case ENTITY -> MyStatType.ENTITY;
|
||||
};
|
||||
}
|
||||
|
||||
private @NotNull List<MySubStatistic> getSubStats() {
|
||||
EnumHandler enumHandler = EnumHandler.getInstance();
|
||||
List<MySubStatistic> subStats = new ArrayList<>();
|
||||
|
||||
enumHandler.getAllBlockNames().forEach(blockName ->
|
||||
subStats.add(new MySubStatistic(blockName, MyStatType.BLOCK)));
|
||||
enumHandler.getAllItemNames().forEach(itemName ->
|
||||
subStats.add(new MySubStatistic(itemName, MyStatType.ITEM)));
|
||||
enumHandler.getAllEntityNames().forEach(entityName ->
|
||||
subStats.add(new MySubStatistic(entityName, MyStatType.ENTITY)));
|
||||
|
||||
return subStats;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user