Skip to content

Commit

Permalink
Updated PostgreSQL and added configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
LielAmar committed Feb 23, 2022
1 parent eca2f52 commit 2cba305
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.lielamar</groupId>
<artifactId>2fa</artifactId>
<version>1.5.7</version>
<version>1.5.8</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -42,7 +42,7 @@
<version.h2>2.1.210</version.h2>
<version.mysql>8.0.26</version.mysql>
<version.maria-db>2.7.3</version.maria-db>
<version.postgres>42.3.1</version.postgres>
<version.postgres>42.3.3</version.postgres>
<version.mongo-db>3.12.10</version.mongo-db>
<version.slf4j>2.0.0-alpha5</version.slf4j>

Expand Down
2 changes: 1 addition & 1 deletion shadowed_pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<version.h2>1.4.200</version.h2>
<version.mysql>8.0.26</version.mysql>
<version.maria-db>2.7.3</version.maria-db>
<version.postgres>42.3.1</version.postgres>
<version.postgres>42.3.3</version.postgres>
<version.mongo-db>3.12.10</version.mongo-db>
<version.slf4j>2.0.0-alpha5</version.slf4j>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lielamar.auth.bukkit;

import com.lielamar.auth.shared.handlers.MessageHandler;
import com.lielamar.auth.shared.utils.TimeUtils;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -33,14 +34,16 @@ public String getVersion() {
public String onPlaceholderRequest(Player player, String identifier) {
switch(identifier.toLowerCase()) {
case "is_enabled":
return plugin.getAuthHandler().is2FAEnabled(player.getUniqueId()) ? "Enabled" : "Disabled";
return plugin.getAuthHandler().is2FAEnabled(player.getUniqueId()) ?
MessageHandler.TwoFAMessages.KEYWORD_ENABLED.getMessage() : MessageHandler.TwoFAMessages.KEYWORD_DISABLED.getMessage();
case "time_since_enabled":
long enableDate = plugin.getAuthHandler().getStorageHandler().getEnableDate(player.getUniqueId());
return enableDate == -1 ? "Not Enabled" : TimeUtils.parseTime(System.currentTimeMillis() - enableDate);
case "key":
return plugin.getAuthHandler().getStorageHandler().getKey(player.getUniqueId());
case "is_required":
return player.hasPermission("2fa.demand") ? "Required" : "Not Required";
return player.hasPermission("2fa.demand") ?
MessageHandler.TwoFAMessages.KEYWORD_REQUIRED.getMessage() : MessageHandler.TwoFAMessages.KEYWORD_NOT_REQUIRED.getMessage();
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void loadDependencies(Plugin plugin, Properties properties) {
String h2Version = properties.getProperty("version_h2", "2.1.210");
String mysqlVersion = properties.getProperty("version_mysql", "8.0.26");
String mariaDBVersion = properties.getProperty("version_maria_db", "2.7.3");
String postgresVersion = properties.getProperty("version_postgres", "42.3.1");
String postgresVersion = properties.getProperty("version_postgres", "42.3.3");
String mongoDBVersion = properties.getProperty("version_mongo_db", "3.12.10");
String slf4jVersion = properties.getProperty("version_slf4j", "2.0.0-alpha5");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public enum TwoFAMessages {
RELOADED_CONFIG("&aConfig was reloaded"),
FAILED_AUTHENTICATION_ALERT("&c%name% failed to authenticate %times% times"),
SOMETHING_WENT_WRONG("&cSomething went wrong. Please contact a Staff Member!"),
KEYWORD_ENABLED("Enabled"),
KEYWORD_DISABLED("Disabled"),
KEYWORD_REQUIRED("Required"),
KEYWORD_NOT_REQUIRED("Not Required"),
HELP_HEADER("&7----- &b2FA &7-----"),
HELP_COMMAND("&7\u2022 &b%command% &e%aliases%&7: %description%"),
HELP_FOOTER("&7----- -------- -----"),
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/bungee.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 2FA
version: "1.5.7"
version: "1.5.8"
author: "LielAmar"
main: com.lielamar.auth.bungee.TwoFactorAuthentication
description: Add another layer of protection to your server
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 2FA
version: "1.5.7"
version: "1.5.8"
api-version: 1.13
authors: [LielAmar, SadGhost]
main: com.lielamar.auth.bukkit.TwoFactorAuthentication
Expand All @@ -13,7 +13,7 @@ libraries:
- com.h2database:h2:2.1.210
- mysql:mysql-connector-java:8.0.26
- org.mariadb.jdbc:mariadb-java-client:2.7.3
- org.postgresql:postgresql:42.3.1
- org.postgresql:postgresql:42.3.3
- org.mongodb:mongo-java-driver:3.12.10
- org.slf4j:slf4j-api:2.0.0-alpha5

Expand Down

0 comments on commit 2cba305

Please sign in to comment.