mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
parent
8027b4741e
commit
04459f1ea7
@ -1,3 +1,7 @@
|
|||||||
|
Version 2.1.193
|
||||||
|
Fixed another bug where mcrank/mctop/leaderboards weren't loading
|
||||||
|
Fixed a bug where override locales weren't being loaded (but worked after a reloadlocale command)
|
||||||
|
(Unit Tests) Added a test to make sure leaderboards were working
|
||||||
Version 2.1.192
|
Version 2.1.192
|
||||||
Removed some debug messages from FlatFileDatabaseManager
|
Removed some debug messages from FlatFileDatabaseManager
|
||||||
Fixed another bug where player names could be saved as null for FlatFileDB (they will update on the players next login at the next save interval)
|
Fixed another bug where player names could be saved as null for FlatFileDB (they will update on the players next login at the next save interval)
|
||||||
@ -11,9 +15,6 @@ Version 2.1.192
|
|||||||
(API) Added com.gmail.nossr50.api.DatabaseAPI.doesPlayerExistInDB(java.lang.String)
|
(API) Added com.gmail.nossr50.api.DatabaseAPI.doesPlayerExistInDB(java.lang.String)
|
||||||
(Unit Tests) Added some more unit tests to FlatFileDB
|
(Unit Tests) Added some more unit tests to FlatFileDB
|
||||||
|
|
||||||
NOTES:
|
|
||||||
I removed a lot of API that should honestly never have been added, this will break some plugins, those plugins will have to update.
|
|
||||||
|
|
||||||
Version 2.1.191
|
Version 2.1.191
|
||||||
Fixed a bug related to our blocktracker
|
Fixed a bug related to our blocktracker
|
||||||
Fixed a bug that prevented the leaderboards from working on FlatFile in some circumstances
|
Fixed a bug that prevented the leaderboards from working on FlatFile in some circumstances
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.1.192</version>
|
<version>2.1.193-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.blockmeta.HashChunkManager;
|
||||||
import com.gmail.nossr50.util.skills.SkillTools;
|
import com.gmail.nossr50.util.skills.SkillTools;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -484,15 +485,16 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
return statsList.subList(Math.min(fromIndex, statsList.size()), Math.min(fromIndex + statsPerPage, statsList.size()));
|
return statsList.subList(Math.min(fromIndex, statsList.size()), Math.min(fromIndex + statsPerPage, statsList.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<PrimarySkillType, Integer> readRank(String playerName) {
|
public @NotNull HashMap<PrimarySkillType, Integer> readRank(String playerName) {
|
||||||
updateLeaderboards();
|
updateLeaderboards();
|
||||||
|
|
||||||
Map<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class);
|
HashMap<PrimarySkillType, Integer> skills = new HashMap<>();
|
||||||
|
|
||||||
for (PrimarySkillType skill : SkillTools.NON_CHILD_SKILLS) {
|
for (PrimarySkillType skill : SkillTools.NON_CHILD_SKILLS) {
|
||||||
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
|
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Gross
|
||||||
skills.put(null, getPlayerRank(playerName, powerLevels));
|
skills.put(null, getPlayerRank(playerName, powerLevels));
|
||||||
|
|
||||||
return skills;
|
return skills;
|
||||||
|
@ -18,6 +18,7 @@ import com.gmail.nossr50.database.DatabaseManagerFactory;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
|
import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
|
||||||
import com.gmail.nossr50.listeners.*;
|
import com.gmail.nossr50.listeners.*;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.runnables.SaveTimerTask;
|
import com.gmail.nossr50.runnables.SaveTimerTask;
|
||||||
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
||||||
@ -337,6 +338,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
transientEntityTracker = new TransientEntityTracker();
|
transientEntityTracker = new TransientEntityTracker();
|
||||||
setServerShutdown(false); //Reset flag, used to make decisions about async saves
|
setServerShutdown(false); //Reset flag, used to make decisions about async saves
|
||||||
|
LocaleLoader.reloadLocale(); //Apply override locale
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerLevelUtils getPlayerLevelUtils() {
|
public static PlayerLevelUtils getPlayerLevelUtils() {
|
||||||
|
@ -644,6 +644,36 @@ public class FlatFileDatabaseManagerTest {
|
|||||||
assertEquals(db.getDatabaseType(), DatabaseType.FLATFILE);
|
assertEquals(db.getDatabaseType(), DatabaseType.FLATFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReadRank() {
|
||||||
|
//This is an empty DB
|
||||||
|
assertNotNull(db);
|
||||||
|
String rankBoyName = "rankBoy";
|
||||||
|
UUID rankBoyUUID = new UUID(1337, 1337);
|
||||||
|
String rankGirlName = "rankGirl";
|
||||||
|
UUID rankGirlUUID = new UUID(7331, 7331);
|
||||||
|
|
||||||
|
PlayerProfile rankGirlProfile = addPlayerProfileWithLevelsAndSave(rankGirlName, rankGirlUUID, 100); //Rank 1
|
||||||
|
PlayerProfile rankBoyProfile = addPlayerProfileWithLevelsAndSave(rankBoyName, rankBoyUUID, 10); //Rank 2
|
||||||
|
|
||||||
|
assertEquals(LeaderboardStatus.UPDATED, db.updateLeaderboards());
|
||||||
|
Map<PrimarySkillType, Integer> rankGirlPositions = db.readRank(rankGirlName);
|
||||||
|
Map<PrimarySkillType, Integer> rankBoyPositions = db.readRank(rankBoyName);
|
||||||
|
|
||||||
|
for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
|
||||||
|
if(primarySkillType.isChildSkill()) {
|
||||||
|
assertNull(rankBoyPositions.get(primarySkillType));
|
||||||
|
assertNull(rankGirlPositions.get(primarySkillType));
|
||||||
|
} else {
|
||||||
|
assertEquals(1, rankGirlPositions.get(primarySkillType));
|
||||||
|
assertEquals(2, rankBoyPositions.get(primarySkillType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(1, db.readRank(rankGirlName).get(null)); //Girl should be position 1
|
||||||
|
assertEquals(2, db.readRank(rankBoyName).get(null)); //Boy should be position 2
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadFromFile() {
|
public void testLoadFromFile() {
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
@ -708,6 +738,38 @@ public class FlatFileDatabaseManagerTest {
|
|||||||
return splitDataList;
|
return splitDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private @NotNull PlayerProfile addPlayerProfileWithLevelsAndSave(String playerName, UUID uuid, int levels) {
|
||||||
|
assertNotNull(db);
|
||||||
|
assertFalse(db.loadPlayerProfile(uuid).isLoaded());
|
||||||
|
|
||||||
|
db.newUser(playerName, uuid);
|
||||||
|
PlayerProfile leveledProfile = db.loadPlayerProfile(uuid);
|
||||||
|
|
||||||
|
assertTrue(leveledProfile.isLoaded());
|
||||||
|
assertEquals(playerName, leveledProfile.getPlayerName());
|
||||||
|
assertEquals(uuid, leveledProfile.getUniqueId());
|
||||||
|
|
||||||
|
for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
|
||||||
|
if(SkillTools.isChildSkill(primarySkillType))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
leveledProfile.modifySkill(primarySkillType, levels); //TODO: This method also resets XP, not cool
|
||||||
|
}
|
||||||
|
|
||||||
|
db.saveUser(leveledProfile);
|
||||||
|
leveledProfile = db.loadPlayerProfile(uuid);
|
||||||
|
|
||||||
|
for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
|
||||||
|
if(SkillTools.isChildSkill(primarySkillType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(levels, leveledProfile.getSkillLevel(primarySkillType));
|
||||||
|
}
|
||||||
|
|
||||||
|
return leveledProfile;
|
||||||
|
}
|
||||||
|
|
||||||
private void replaceDataInFile(@NotNull FlatFileDatabaseManager flatFileDatabaseManager, @NotNull String[] dataEntries) {
|
private void replaceDataInFile(@NotNull FlatFileDatabaseManager flatFileDatabaseManager, @NotNull String[] dataEntries) {
|
||||||
String filePath = flatFileDatabaseManager.getUsersFile().getAbsolutePath();
|
String filePath = flatFileDatabaseManager.getUsersFile().getAbsolutePath();
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user