mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-29 03:57:54 +01:00
Useless casting and elses.
This commit is contained in:
parent
d07b67b5bf
commit
68727496ad
@ -17,23 +17,17 @@ public class MmoshowdbCommand implements TabExecutor {
|
||||
if (args.length != 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
||||
Class<?> clazz = DatabaseManagerFactory.getCustomDatabaseManagerClass();
|
||||
|
||||
if (clazz != null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", clazz.getName()));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", "sql"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", "flatfile"));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (Config.getInstance().getUseMySQL() ? "sql" : "flatfile")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
|
@ -47,7 +47,7 @@ public class MmoupdateCommand implements TabExecutor {
|
||||
else try {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends DatabaseManager> clazz = (Class<? extends DatabaseManager>) Class.forName(oldType);
|
||||
oldDb = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
|
||||
oldDb = DatabaseManagerFactory.createCustomDatabaseManager(clazz);
|
||||
|
||||
oldType = clazz.getSimpleName(); // For pretty-printing; we have the database now
|
||||
}
|
||||
@ -119,12 +119,7 @@ public class MmoupdateCommand implements TabExecutor {
|
||||
return DatabaseManagerFactory.getCustomDatabaseManagerClass().getSimpleName();
|
||||
}
|
||||
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
return "sql";
|
||||
}
|
||||
else {
|
||||
return "flatfile";
|
||||
}
|
||||
return Config.getInstance().getUseMySQL() ? "sql" : "flatfile";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -379,11 +379,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
// There is no such user
|
||||
if (create) {
|
||||
newUser(playerName);
|
||||
return new PlayerProfile(playerName, true);
|
||||
}
|
||||
else {
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
|
||||
return new PlayerProfile(playerName, create);
|
||||
}
|
||||
// There is such a user
|
||||
writeMissingRows(id);
|
||||
|
Loading…
Reference in New Issue
Block a user