From ae58e0539a62252d2e2f610dfeadc62687e23f75 Mon Sep 17 00:00:00 2001 From: games647 Date: Sun, 22 May 2016 13:59:41 +0200 Subject: [PATCH] Added support for LogIt --- CHANGELOG.md | 1 + README.md | 1 + bukkit/pom.xml | 17 +++++++++ .../fastlogin/bukkit/hooks/LogItHook.java | 36 +++++++++++++++++++ bukkit/src/main/resources/plugin.yml | 1 + .../listener/PlayerConnectionListener.java | 3 ++ 6 files changed, 59 insertions(+) create mode 100644 bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LogItHook.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 38a9c3fa..f0ef8f19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Added support for AuthMe 3.X * Fixed premium logins if the server is not fully started * Added other command argument to /premium and /cracked +* Added support for LogIt ######1.2.1 diff --git a/README.md b/README.md index f2cc4698..929cfe72 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ So they don't need to enter passwords. This is also called auto login (auto-logi * [AuthMe (both 5.X and 3.X)](http://dev.bukkit.org/bukkit-plugins/authme-reloaded/) * [xAuth](http://dev.bukkit.org/bukkit-plugins/xauth/) +* [LogIt](https://github.com/XziomekX/LogIt) * [AdvancedLogin (Paid)](https://www.spigotmc.org/resources/advancedlogin.10510/) * [CrazyLogin](http://dev.bukkit.org/bukkit-plugins/crazylogin/) * [LoginSecurity](http://dev.bukkit.org/bukkit-plugins/loginsecurity/) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index dee14a2d..30a610ea 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -40,6 +40,11 @@ http://repo.luricos.de/bukkit-plugins/ + + logit-only-repo + http://ci.ac3-servers.eu/job/LogIt-Classic/2/maven-repository/repository/ + + jitpack.io @@ -98,6 +103,18 @@ + + io.github.lucaseasedup.logit + LogIt + SNAPSHOT + + + * + * + + + + com.github.RoyalDev RoyalAuth diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LogItHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LogItHook.java new file mode 100644 index 00000000..cd0ef637 --- /dev/null +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LogItHook.java @@ -0,0 +1,36 @@ +package com.github.games647.fastlogin.bukkit.hooks; + +import io.github.lucaseasedup.logit.CancelledState; +import io.github.lucaseasedup.logit.LogItCore; +import io.github.lucaseasedup.logit.account.Account; + +import org.bukkit.entity.Player; + +/** + * Github: https://github.com/XziomekX/LogIt + * Project page: + * + * Bukkit: Unknown + * Spigot: Unknown + */ +public class LogItHook implements BukkitAuthPlugin { + + @Override + public boolean forceLogin(Player player) { + return LogItCore.getInstance().getSessionManager().startSession(player) == CancelledState.NOT_CANCELLED; + } + + @Override + public boolean isRegistered(String playerName) throws Exception { + return LogItCore.getInstance().getAccountManager().isRegistered(playerName); + } + + @Override + public boolean forceRegister(Player player, String password) { + Account account = new Account(player.getName()); + account.changePassword(password); + account.setLastActiveDate(System.currentTimeMillis() / 1000); + account.setRegistrationDate(System.currentTimeMillis() / 1000); + return LogItCore.getInstance().getAccountManager().insertAccount(account) == CancelledState.NOT_CANCELLED; + } +} diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index cbf0d57b..6e340eba 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -19,6 +19,7 @@ softdepend: # Auth plugins - xAuth - AuthMe + - LogIt - CrazyLogin - LoginSecurity - RoyalAuth diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PlayerConnectionListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PlayerConnectionListener.java index a096df6f..9cab098e 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PlayerConnectionListener.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PlayerConnectionListener.java @@ -1,7 +1,10 @@ package com.github.games647.fastlogin.bungee.listener; +import com.github.games647.fastlogin.bungee.FastLoginBungee; import com.github.games647.fastlogin.bungee.FastLoginBungee; import com.github.games647.fastlogin.bungee.ForceLoginTask; +import com.github.games647.fastlogin.bungee.ForceLoginTask; +import com.github.games647.fastlogin.bungee.PlayerProfile; import com.github.games647.fastlogin.bungee.PlayerProfile; import com.github.games647.fastlogin.bungee.hooks.BungeeAuthPlugin; import com.google.common.base.Charsets;