Some readability

This commit is contained in:
bakatrouble 2016-12-25 20:24:24 +03:00 committed by Luck
parent 9dbef6acc2
commit 20de713716
2 changed files with 11 additions and 9 deletions

View File

@ -27,11 +27,7 @@ import lombok.experimental.UtilityClass;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.storage.backing.AbstractBacking; import me.lucko.luckperms.common.storage.backing.*;
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.sqlprovider.H2Provider; 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.MySQLProvider;
import me.lucko.luckperms.common.storage.backing.sqlprovider.SQLiteProvider; import me.lucko.luckperms.common.storage.backing.sqlprovider.SQLiteProvider;
@ -121,6 +117,8 @@ public class StorageFactory {
switch (method) { switch (method) {
case MYSQL: case MYSQL:
return new SQLLegacyBacking(plugin, new MySQLProvider(plugin.getConfiguration().getDatabaseValues())); return new SQLLegacyBacking(plugin, new MySQLProvider(plugin.getConfiguration().getDatabaseValues()));
case CIRNOCRAFT:
return new CirnocraftBacking(plugin, plugin.getConfiguration().getDatabaseValues());
case SQLITE: case SQLITE:
return new SQLLegacyBacking(plugin, new SQLiteProvider(new File(plugin.getDataFolder(), "luckperms.sqlite"))); return new SQLLegacyBacking(plugin, new SQLiteProvider(new File(plugin.getDataFolder(), "luckperms.sqlite")));
case H2: case H2:

View File

@ -41,10 +41,14 @@ import java.util.Map;
@AllArgsConstructor(staticName = "of") @AllArgsConstructor(staticName = "of")
public class NodeDataHolder { public class NodeDataHolder {
public static NodeDataHolder fromNode(Node node) { public static NodeDataHolder fromNode(Node node) {
long expiry = node.isTemporary() ? node.getExpiryUnixTime() : 0L; return NodeDataHolder.of(
return NodeDataHolder.of(node.getPermission(), node.getValue(), node.getPermission(),
node.getServer().orElse(null), node.getWorld().orElse(null), node.getValue(),
expiry, new Gson().toJson(node.getContexts().toMap())); node.getServer().orElse(null),
node.getWorld().orElse(null),
node.isTemporary() ? node.getExpiryUnixTime() : 0L,
new Gson().toJson(node.getContexts().toMap())
);
} }
private final String permission; private final String permission;