#1120 Use empty "realname" when converting from flatfile
- FlatFile doesn't store the "realname" - all names are always in all-lowercase. Converting from flatfile to other data source should therefore not take over an auth's realname - Adjust sample flatfile file to only have all-lowercase usernames
This commit is contained in:
+11
-1
@@ -37,7 +37,7 @@ public abstract class AbstractDataSourceConverter<S extends DataSource> implemen
|
||||
// which is never the case when a converter is launched from the /authme converter command.
|
||||
@Override
|
||||
public void execute(CommandSender sender) {
|
||||
if (!destinationType.equals(destination.getType())) {
|
||||
if (destinationType != destination.getType()) {
|
||||
if (sender != null) {
|
||||
sender.sendMessage("Please configure your connection to "
|
||||
+ destinationType + " and re-run this command");
|
||||
@@ -59,6 +59,7 @@ public abstract class AbstractDataSourceConverter<S extends DataSource> implemen
|
||||
if (destination.isAuthAvailable(auth.getNickname())) {
|
||||
skippedPlayers.add(auth.getNickname());
|
||||
} else {
|
||||
adaptPlayerAuth(auth);
|
||||
destination.saveAuth(auth);
|
||||
destination.updateQuitLoc(auth);
|
||||
}
|
||||
@@ -72,6 +73,15 @@ public abstract class AbstractDataSourceConverter<S extends DataSource> implemen
|
||||
+ " to " + destinationType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapts the PlayerAuth from the source before it is saved in the destination.
|
||||
*
|
||||
* @param auth the auth from the source
|
||||
*/
|
||||
protected void adaptPlayerAuth(PlayerAuth auth) {
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the data source to convert from
|
||||
* @throws Exception during initialization of source
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package fr.xephi.authme.datasource.converter;
|
||||
|
||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.datasource.FlatFile;
|
||||
|
||||
@@ -25,4 +26,11 @@ public class ForceFlatToSqlite extends AbstractDataSourceConverter<FlatFile> {
|
||||
public FlatFile getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void adaptPlayerAuth(PlayerAuth auth) {
|
||||
// Issue #1120: FlatFile returns PlayerAuth objects with realname = lower-case name all the time.
|
||||
// We don't want to take this over into the new data source.
|
||||
auth.setRealName("Player");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user