From 20de71371662f8f2494f4ab4746217f59bce9489 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Sun, 25 Dec 2016 20:24:24 +0300 Subject: [PATCH] Some readability --- .../luckperms/common/storage/StorageFactory.java | 8 +++----- .../common/storage/backing/utils/NodeDataHolder.java | 12 ++++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/StorageFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/StorageFactory.java index 32979dcbb..769e326b0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/StorageFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/StorageFactory.java @@ -27,11 +27,7 @@ import lombok.experimental.UtilityClass; import com.google.common.collect.ImmutableSet; import me.lucko.luckperms.common.LuckPermsPlugin; -import me.lucko.luckperms.common.storage.backing.AbstractBacking; -import me.lucko.luckperms.common.storage.backing.JSONBacking; -import me.lucko.luckperms.common.storage.backing.MongoDBBacking; -import me.lucko.luckperms.common.storage.backing.SQLLegacyBacking; -import me.lucko.luckperms.common.storage.backing.YAMLBacking; +import me.lucko.luckperms.common.storage.backing.*; import me.lucko.luckperms.common.storage.backing.sqlprovider.H2Provider; import me.lucko.luckperms.common.storage.backing.sqlprovider.MySQLProvider; import me.lucko.luckperms.common.storage.backing.sqlprovider.SQLiteProvider; @@ -121,6 +117,8 @@ public class StorageFactory { switch (method) { case MYSQL: return new SQLLegacyBacking(plugin, new MySQLProvider(plugin.getConfiguration().getDatabaseValues())); + case CIRNOCRAFT: + return new CirnocraftBacking(plugin, plugin.getConfiguration().getDatabaseValues()); case SQLITE: return new SQLLegacyBacking(plugin, new SQLiteProvider(new File(plugin.getDataFolder(), "luckperms.sqlite"))); case H2: diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/utils/NodeDataHolder.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/utils/NodeDataHolder.java index 795b1bb63..5b1d1a318 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/utils/NodeDataHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/utils/NodeDataHolder.java @@ -41,10 +41,14 @@ import java.util.Map; @AllArgsConstructor(staticName = "of") public class NodeDataHolder { public static NodeDataHolder fromNode(Node node) { - long expiry = node.isTemporary() ? node.getExpiryUnixTime() : 0L; - return NodeDataHolder.of(node.getPermission(), node.getValue(), - node.getServer().orElse(null), node.getWorld().orElse(null), - expiry, new Gson().toJson(node.getContexts().toMap())); + return NodeDataHolder.of( + node.getPermission(), + node.getValue(), + node.getServer().orElse(null), + node.getWorld().orElse(null), + node.isTemporary() ? node.getExpiryUnixTime() : 0L, + new Gson().toJson(node.getContexts().toMap()) + ); } private final String permission;