database managers
This commit is contained in:
parent
df59f95c7b
commit
f0a065dd74
3 changed files with 36 additions and 0 deletions
|
@ -0,0 +1,4 @@
|
|||
package me.night.nullvalkyrie.database;
|
||||
|
||||
public class CustomWeaponsDataManager {
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package me.night.nullvalkyrie.database;
|
||||
|
||||
import org.bson.Document;
|
||||
import org.bson.conversions.Bson;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class MinerDataManager {
|
||||
public static void setNPC(String name, Material material, int level, double rate, boolean enabled, long lastclaim) {
|
||||
Document newDocument = new Document();
|
||||
newDocument.put("ID", DatabaseManager.miners.countDocuments() + 1);
|
||||
newDocument.put("Name", name);
|
||||
newDocument.put("Material", material.name());
|
||||
newDocument.put("Level", level);
|
||||
newDocument.put("Rate", rate);
|
||||
newDocument.put("Enabled", enabled);
|
||||
newDocument.put("LastClaim", lastclaim);
|
||||
DatabaseManager.miners.insertOne(newDocument);
|
||||
}
|
||||
public static void setLastclaim(int id) {
|
||||
Document document = DatabaseManager.miners.find(new Document("ID", id)).first();
|
||||
if (document != null) {
|
||||
Bson updated = new Document("LastClaim", System.currentTimeMillis());
|
||||
Bson update = new Document("$set", updated);
|
||||
DatabaseManager.miners.updateOne(document, update);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package me.night.nullvalkyrie.database;
|
||||
|
||||
public class UserDataManager {
|
||||
}
|
Loading…
Reference in a new issue