use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class NameToUUIDDatabase method handleUpdate.
@Deprecated
public void handleUpdate(UpdateConfigurationDatabase updateConfigurationDatabase) {
if (!updateConfigurationDatabase.get().contains("updated_database_from_2_1_Pv29")) {
Collection<Document> documents = database.loadDocuments().getDocs();
String name;
for (Document document : documents) {
name = document.getString(Database.UNIQUE_NAME_KEY);
if (name != null)
if (name.length() < 32) {
database.delete(document.getString(Database.UNIQUE_NAME_KEY));
database.insert(document.append(Database.UNIQUE_NAME_KEY, name.toLowerCase()));
}
}
updateConfigurationDatabase.set(updateConfigurationDatabase.get().append("updated_database_from_2_1_Pv29", true));
((DatabaseImpl) database).save();
((DatabaseImpl) database).clear();
}
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class PlayerDatabase method updatePlayer.
public PlayerDatabase updatePlayer(OfflinePlayer offlinePlayer) {
Document document = database.getDocument(offlinePlayer.getUniqueId().toString());
document.append("offlinePlayer", CloudPlayer.newOfflinePlayer(offlinePlayer));
database.insert(document);
return this;
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class PlayerDatabase method updateName.
public PlayerDatabase updateName(UUID uuid, String name) {
Document document = database.getDocument(uuid.toString());
OfflinePlayer offlinePlayer = document.getObject("offlinePlayer", OfflinePlayer.TYPE);
offlinePlayer.setName(name);
database.insert(document);
return this;
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class StatisticManager method addPlayerLogin.
public void addPlayerLogin() {
if (!statistic)
return;
try {
Document document = database.getDocument(NAME);
if (!document.contains("playerLogin")) {
document.append("playerLogin", 0L);
}
document.append("playerLogin", document.getLong("playerLogin") + 1L);
} catch (Exception ex) {
}
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class StatisticManager method playerCommandExecutions.
public void playerCommandExecutions() {
if (!statistic)
return;
Document document = database.getDocument(NAME);
if (!document.contains("playerCommandExecutions")) {
document.append("playerCommandExecutions", 0L);
}
document.append("playerCommandExecutions", document.getLong("playerCommandExecutions") + 1L);
}
Aggregations