remove the bad patch system

This commit is contained in:
mohammed jasem alaajel 2021-10-02 12:30:47 +04:00
parent 255ce54c47
commit 5d84b086f8
68 changed files with 5134 additions and 169390 deletions

42
.gitattributes vendored
View File

@ -1,42 +0,0 @@
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto
#
# The above will handle all files NOT found below
#
# These files are text and should be normalized (Convert crlf => lf)
*.css text
*.df text
*.htm text
*.html text
*.java text
*.js text
*.json text
*.jsp text
*.jspf text
*.jspx text
*.properties text
*.sh text
*.tld text
*.txt text
*.tag text
*.tagx text
*.xml text
# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.dll binary
*.ear binary
*.gif binary
*.ico binary
*.jar binary
*.jpg binary
*.jpeg binary
*.png binary
*.so binary
*.war binary
# extras
*.sh text

3
.gitignore vendored
View File

@ -29,6 +29,3 @@ out
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# LimeLogin files
LimeLogin-Plugin

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "FastLogin"]
path = FastLogin
url = https://github.com/games647/FastLogin.git

@ -1 +0,0 @@
Subproject commit 01c9b55d80c93e0df4ad9050519995f4d56db759

File diff suppressed because it is too large Load Diff

View File

@ -1,309 +0,0 @@
From 914ab071cda9943fb43d8544cd75d971f2e699cb Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Mon, 14 Jun 2021 22:27:22 +0400
Subject: [PATCH] Added old commits from forked repo Fastlogin
commits: \nAuto-add - character for offline mode users\nFix empty database getting users marked as cracked falsely\nDon't save offline mode user to database\nalways use false to fix an error\nsome debug stuff...\nadd GovindasPreSecondAttemptEvent\nshade sqlite so we can stop using mariadb for fastlogin
diff --git a/bungee/pom.xml b/bungee/pom.xml
index 7cbdc04..eafeda5 100644
--- a/bungee/pom.xml
+++ b/bungee/pom.xml
@@ -176,5 +176,11 @@
<optional>true</optional>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.xerial</groupId>
+ <artifactId>sqlite-jdbc</artifactId>
+ <version>3.34.0</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
index 8777a60..fef86f5 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
@@ -40,6 +40,7 @@ import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.Field;
+import java.nio.charset.StandardCharsets;
import java.util.UUID;
import net.md_5.bungee.api.connection.PendingConnection;
@@ -157,6 +158,52 @@ public class ConnectListener implements Listener {
}
}
}
+ // LimeLogin start
+ //start of Govindas code to auto-add "-" character for offline mode users differentiation from online mode
+ else {
+ if (!connection.getName().contains("-")) {
+ InitialHandler initialHandler = (InitialHandler) loginEvent.getConnection();
+ //TODO add bedrock check of player and don't trigger this for bedrock users
+ LoginSession session = plugin.getSession().get(connection);
+ String username = connection.getName();
+
+ //for bedrock support, this opens up vulnerability, so cracked players with * can join without auth
+ //but that isn't a problem as we're handling * in LimeworkProxy instead
+ //but it would be better to handle it here, just need to debug it further
+
+ //debug, we can remove after
+ UUID checkUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:" + connection.getName()).getBytes(StandardCharsets.UTF_8));
+ System.out.println("Profile uuid: " + session.getProfile().getId());
+ System.out.println("Session uuid: " + session.getUuid());
+ System.out.println("Offline uuid: " + checkUUID);
+ if (username.contains("*")) {
+
+ if (checkUUID.equals(session.getProfile().getId())) {
+ System.out.println("IT EQUALS!");
+ }
+ return;
+ }
+ if (username.length() >= 16) {
+ username = username.substring(0, 15);
+ }
+
+ session.setVerifiedUsername("-" + username);
+ initialHandler.getLoginRequest().setData("-" + username);
+ UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + connection.getName()).getBytes(StandardCharsets.UTF_8));
+ plugin.getLog().info("Govindas system has converted username to contain - character: " + username);
+ try {
+ uniqueIdSetter.invokeExact(initialHandler, uuid);
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
+ session.getProfile().setPremium(false);
+ session.getProfile().setPlayerName(connection.getName());
+ session.setUuid(uuid);
+ session.getProfile().setId(uuid);
+ }
+ }
+ //end of Govindas code
+ // LimeLogin end
}
private void setOfflineId(InitialHandler connection, String username) {
diff --git a/bungee/src/main/resources/bungee.yml b/bungee/src/main/resources/bungee.yml
index c52f41a..1d1c8d9 100644
--- a/bungee/src/main/resources/bungee.yml
+++ b/bungee/src/main/resources/bungee.yml
@@ -3,10 +3,10 @@
# This make it easy to combine BungeeCord and Bukkit support in one plugin
name: ${project.parent.name}
# ${-} will be automatically replaced by Maven
-main: ${project.groupId}.${project.artifactId}.${project.name}
+main: com.github.games647.fastlogin.bungee.FastLoginBungee
-version: ${project.version}-${git.commit.id.abbrev}
-author: games647, https://github.com/games647/FastLogin/graphs/contributors
+version: ${project.version}
+author: games647, https://github.com/games647/FastLogin/graphs/contributors, Limework.net
softDepends:
# BungeeCord auth plugins
diff --git a/core/pom.xml b/core/pom.xml
index 17535a4..46fc0a9 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -81,7 +81,7 @@
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-config</artifactId>
- <version>1.12-SNAPSHOT</version>
+ <version>1.16-R0.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
@@ -90,6 +90,13 @@
</exclusions>
</dependency>
+ <dependency>
+ <groupId>net.md-5</groupId>
+ <artifactId>bungeecord-proxy</artifactId>
+ <version>1.16-R0.5-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
<!--Floodgate for Xbox Live Authentication-->
<dependency>
<groupId>org.geysermc.floodgate</groupId>
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java
index 94500cb..316445c 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java
@@ -142,9 +142,8 @@ public class AuthStorage {
+ "`Name` VARCHAR(16) NOT NULL, "
+ "`Premium` BOOLEAN NOT NULL, "
+ "`LastIp` VARCHAR(255) NOT NULL, "
- + "`LastLogin` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, "
+ + "`LastLogin` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAM"
//the premium shouldn't steal the cracked account by changing the name
- + "UNIQUE (`Name`) "
+ ')';
if (dataSource.getJdbcUrl().contains("sqlite")) {
@@ -208,7 +207,13 @@ public class AuthStorage {
public void save(StoredProfile playerProfile) {
try (Connection con = dataSource.getConnection()) {
String uuid = playerProfile.getOptId().map(UUIDAdapter::toMojangId).orElse(null);
+ // LimeLogin start
+ //start of Govindas code
+ if (!playerProfile.getName().contains("-")) { playerProfile.setPremium(true); }
+ //end of Govindas code
+
+ // LimeLogin end
playerProfile.getSaveLock().lock();
try {
if (playerProfile.isSaved()) {
@@ -222,6 +227,13 @@ public class AuthStorage {
saveStmt.execute();
}
} else {
+ // LimeLogin start
+
+ //start of Govindas code
+ if (!playerProfile.getName().contains("-")) { playerProfile.setPremium(true); }
+ //end of Govindas code
+
+ // LimeLogin end
try (PreparedStatement saveStmt = con.prepareStatement(INSERT_PROFILE, RETURN_GENERATED_KEYS)) {
saveStmt.setString(1, uuid);
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java
index 7efb157..feac10d 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java
@@ -92,7 +92,13 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
//cracked player
playerProfile.setId(null);
playerProfile.setPremium(false);
- storage.save(playerProfile);
+ // LimeLogin start
+
+ //Govindas comment - don't save cracked player profiles, I found it to be useless
+ //storage.save(playerProfile);
+ //end of Govindas comment
+
+ // LimeLogin end
}
} catch (Exception ex) {
core.getPlugin().getLog().warn("ERROR ON FORCE LOGIN of {}", getName(player), ex);
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
index ec129a8..3f05090 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
@@ -34,6 +34,8 @@ import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent;
import java.util.Optional;
+import com.github.games647.fastlogin.core.shared.event.GovindasPreSecondAttemptEvent;
+import net.md_5.bungee.api.ProxyServer;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
import net.md_5.bungee.config.Configuration;
@@ -80,11 +82,16 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
}
} else {
if (core.getPendingLogin().remove(ip + username) != null && config.get("secondAttemptCracked", false)) {
- core.getPlugin().getLog().info("Second attempt login -> cracked {}", username);
-
- //first login request failed so make a cracked session
- startCrackedSession(source, profile, username);
- return;
+ // LimeLogin start
+ GovindasPreSecondAttemptEvent event = new GovindasPreSecondAttemptEvent(ip, username);
+ ProxyServer.getInstance().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ core.getPlugin().getLog().info("Second attempt login -> cracked {}", username);
+ //first login request failed so make a cracked session
+ startCrackedSession(source, profile, username);
+ return;
+ }
+ // LimeLogin start
}
Optional<Profile> premiumUUID = Optional.empty();
@@ -116,8 +123,17 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
private boolean checkPremiumName(S source, String username, StoredProfile profile) throws Exception {
core.getPlugin().getLog().info("GameProfile {} uses a premium username", username);
- if (core.getConfig().get("autoRegister", false) && (authHook == null || !authHook.isRegistered(username))) {
- requestPremiumLogin(source, profile, username, false);
+ // LimeLogin start
+
+ //start of Govindas comment, THIS IS NEEDED to be commented if FastLogin database gets emptied, to not get premium users counted as cracked
+ //if (core.getConfig().get("autoRegister", false) && (authHook == null || !authHook.isRegistered(username))) {
+ //end of Govindas comment
+
+ // LimeLogin end
+ if (core.getConfig().get("autoRegister", false) && (authHook == null)) {
+ // LimeLogin start
+ requestPremiumLogin(source, profile, username, false); //Comment: always use false to fix an error XD
+ // LimeLogin end
return true;
}
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java
new file mode 100644
index 0000000..5ac3cc9
--- /dev/null
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java
@@ -0,0 +1,36 @@
+// LimeLogin start
+package com.github.games647.fastlogin.core.shared.event;
+
+import net.md_5.bungee.api.plugin.Cancellable;
+import net.md_5.bungee.api.plugin.Event;
+
+public class GovindasPreSecondAttemptEvent extends Event implements Cancellable {
+
+ private final String ip;
+ private final String username;
+ private boolean cancelled;
+
+ public GovindasPreSecondAttemptEvent(String ip, String username) {
+ this.ip = ip;
+ this.username = username;
+ }
+ public String getIP() {
+ return ip;
+ }
+
+
+ public String getUsername() {
+ return username;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+}
+// LimeLogin end
\ No newline at end of file
diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml
index 8e04896..b495031 100644
--- a/core/src/main/resources/config.yml
+++ b/core/src/main/resources/config.yml
@@ -246,7 +246,7 @@ autoRegisterFloodgate: false
# Recommended is the use of MariaDB (a better version of MySQL)
# Single file SQLite database
-driver: 'org.sqlite.JDBC'
+driver: 'fastlogin.sqlite.JDBC'
# File location
database: '{pluginDir}/FastLogin.db'
--
2.25.1

View File

@ -1,55 +0,0 @@
From c9c01ec47ebcf745765f9c086083315fb791e170 Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Wed, 16 Jun 2021 18:43:32 +0400
Subject: [PATCH] renamed class GovindasPreSecondAttemptEvent to
LimePreLoginSecondAttemptEvent
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
index 3f05090..099df66 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
@@ -34,7 +34,7 @@ import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent;
import java.util.Optional;
-import com.github.games647.fastlogin.core.shared.event.GovindasPreSecondAttemptEvent;
+import com.github.games647.fastlogin.core.shared.event.LimePreLoginSecondAttemptEvent;
import net.md_5.bungee.api.ProxyServer;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
@@ -83,7 +83,7 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
} else {
if (core.getPendingLogin().remove(ip + username) != null && config.get("secondAttemptCracked", false)) {
// LimeLogin start
- GovindasPreSecondAttemptEvent event = new GovindasPreSecondAttemptEvent(ip, username);
+ LimePreLoginSecondAttemptEvent event = new LimePreLoginSecondAttemptEvent(ip, username);
ProxyServer.getInstance().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
core.getPlugin().getLog().info("Second attempt login -> cracked {}", username);
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/LimePreLoginSecondAttemptEvent.java
similarity index 78%
rename from core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java
rename to core/src/main/java/com/github/games647/fastlogin/core/shared/event/LimePreLoginSecondAttemptEvent.java
index 5ac3cc9..1f9807d 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/LimePreLoginSecondAttemptEvent.java
@@ -4,13 +4,13 @@ package com.github.games647.fastlogin.core.shared.event;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;
-public class GovindasPreSecondAttemptEvent extends Event implements Cancellable {
+public class LimePreLoginSecondAttemptEvent extends Event implements Cancellable {
private final String ip;
private final String username;
private boolean cancelled;
- public GovindasPreSecondAttemptEvent(String ip, String username) {
+ public LimePreLoginSecondAttemptEvent(String ip, String username) {
this.ip = ip;
this.username = username;
}
--
2.32.0.windows.1

File diff suppressed because it is too large Load Diff

View File

@ -1,221 +0,0 @@
From 0fb0b1654a5d157c12b84a2c9ef58671d3903b0c Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <xrambad953@gmail.com>
Date: Wed, 28 Jul 2021 01:01:53 +0400
Subject: [PATCH] fixed: govindas system was checking if names contains it
should be char at since cracked player can have many chars in the name like
-hi-there
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..713a152
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,31 @@
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+#maven
+target
+out
+
+#intellji idea
+.idea
+*.iml
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
diff --git a/bungee/Limelogin.bungee.iml b/bungee/Limelogin.bungee.iml
deleted file mode 100644
index 09874bc..0000000
--- a/bungee/Limelogin.bungee.iml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="minecraft" name="Minecraft">
- <configuration>
- <autoDetectTypes>
- <platformType>BUNGEECORD</platformType>
- </autoDetectTypes>
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
- <excludeFolder url="file://$MODULE_DIR$/target" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="limelogin.core" />
- <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
- <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:2.0.0-alpha1" level="project" />
- <orderEntry type="library" name="Maven: org.slf4j:slf4j-jdk14:1.7.32" level="project" />
- <orderEntry type="library" name="Maven: net.md-5:bungeecord-config:1.12-SNAPSHOT" level="project" />
- <orderEntry type="library" name="Maven: com.github.games647:craftapi:0.4" level="project" />
- <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-proxy:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-haproxy:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-buffer:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-common:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport-native-epoll:linux-x86_64:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport-native-unix-common:4.1.63.Final" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-api:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-event:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.28" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-log:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: jline:jline:2.12.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-native:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-protocol:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:brigadier:1.0.16-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:core:3.1.0" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: se.llbit:jo-nbt:1.3.0" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-query:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-slf4j:1.16-R0.5-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.jopt-simple:jopt-simple:5.0.4" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: mysql:mysql-connector-java:5.1.49" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-resolver-provider:3.8.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-model:3.8.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-model-builder:3.8.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-interpolation:1.25" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-artifact:3.8.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-builder-support:3.8.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.sisu:org.eclipse.sisu.inject:0.3.4" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-repository-metadata:3.8.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.resolver:maven-resolver-api:1.6.2" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.resolver:maven-resolver-spi:1.6.2" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.resolver:maven-resolver-util:1.6.2" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.resolver:maven-resolver-impl:1.6.2" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-utils:3.2.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.resolver:maven-resolver-transport-http:1.7.0" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.11" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc:floodgate-bungee:1.0-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc:floodgate-common:1.0-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.10.4" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.10" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.10" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.9" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.xerial:sqlite-jdbc:3.30.1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc.floodgate:api:2.0-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc:common:1.4.0-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc.cumulus:cumulus:1.0-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.8.0" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:javac:9+181-r4173-1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.spotbugs:spotbugs-annotations:4.2.3" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
- <orderEntry type="module-library">
- <library name="Maven: me.vik1395:BungeeAuth:1.4">
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/BungeeAuth-1.4.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="library" scope="PROVIDED" name="Maven: de.xxschrandxx.bca:BungeeCordAuthenticator:0.0.2" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Mohist-Community.SodionAuth:SodionAuth-Bungee:2bdfdc854b" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Mohist-Community.SodionAuth:SodionAuth-Core:2bdfdc854b" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
- </component>
-</module>
\ No newline at end of file
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
index fef86f5..3f33ae3 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
@@ -161,7 +161,7 @@ public class ConnectListener implements Listener {
// LimeLogin start
//start of Govindas code to auto-add "-" character for offline mode users differentiation from online mode
else {
- if (!connection.getName().contains("-")) {
+ if (!(connection.getName().charAt(0) == '-')) {
InitialHandler initialHandler = (InitialHandler) loginEvent.getConnection();
//TODO add bedrock check of player and don't trigger this for bedrock users
LoginSession session = plugin.getSession().get(connection);
@@ -176,7 +176,7 @@ public class ConnectListener implements Listener {
System.out.println("Profile uuid: " + session.getProfile().getId());
System.out.println("Session uuid: " + session.getUuid());
System.out.println("Offline uuid: " + checkUUID);
- if (username.contains("*")) {
+ if (username.charAt(0)== '*') {
if (checkUUID.equals(session.getProfile().getId())) {
System.out.println("IT EQUALS!");
diff --git a/core/limelogin.core.iml b/core/limelogin.core.iml
deleted file mode 100644
index 218e53c..0000000
--- a/core/limelogin.core.iml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
- <excludeFolder url="file://$MODULE_DIR$/target" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
- <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:2.0.0-alpha1" level="project" />
- <orderEntry type="library" name="Maven: org.slf4j:slf4j-jdk14:1.7.32" level="project" />
- <orderEntry type="library" name="Maven: net.md-5:bungeecord-config:1.12-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc.floodgate:api:2.0-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc:common:1.4.0-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc.cumulus:cumulus:1.0-SNAPSHOT" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.8.0" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:javac:9+181-r4173-1" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.spotbugs:spotbugs-annotations:4.2.3" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
- <orderEntry type="library" name="Maven: com.github.games647:craftapi:0.4" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:17.0" level="project" />
- <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
- </component>
-</module>
\ No newline at end of file
--
2.25.1

View File

@ -1,26 +0,0 @@
From 915b8c3fed953a9923c4c4703b4bfe8769a4bd04 Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <xrambad953@gmail.com>
Date: Wed, 28 Jul 2021 01:17:06 +0400
Subject: [PATCH] disable unwanted logs
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
index 3f33ae3..631e0a6 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
@@ -173,9 +173,9 @@ public class ConnectListener implements Listener {
//debug, we can remove after
UUID checkUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:" + connection.getName()).getBytes(StandardCharsets.UTF_8));
- System.out.println("Profile uuid: " + session.getProfile().getId());
- System.out.println("Session uuid: " + session.getUuid());
- System.out.println("Offline uuid: " + checkUUID);
+ //System.out.println("Profile uuid: " + session.getProfile().getId());
+ //System.out.println("Session uuid: " + session.getUuid());
+ //System.out.println("Offline uuid: " + checkUUID);
if (username.charAt(0)== '*') {
if (checkUUID.equals(session.getProfile().getId())) {
--
2.25.1

View File

@ -1,2 +0,0 @@
# LimeLogin
Private fork of fastlogin which remove all useless features.

View File

@ -1,40 +0,0 @@
#!/bin/sh
./clean.sh
PS1="$"
basedir=`pwd`
applyPatch() {
pfoldername=$1
what=$2
target=$3
branch=$4
cd "$basedir"
if [ ! -d "$target" ]; then
git clone $what $target
fi
echo "$basedir/$target"
cd "$basedir/$target"
#git checkout -d origin
git checkout $branch
echo "Resetting $target to $what..."
git config commit.gpgSign false
echo " Applying patches to $target..."
git am --abort >/dev/null 2>&1
git am --3way "../${pfoldername}-Patches/"*.patch
if [ "$?" != "0" ]; then
echo " Something did not apply cleanly to $target."
echo " Please review above details and finish the apply then"
echo " save the changes with rebuildPatches.sh"
exit 1
else
echo " Patches applied cleanly to $target"
fi
}
git submodule update --init
applyPatch FastLogin FastLogin LimeLogin-Plugin main

185
bungee/pom.xml Normal file
View File

@ -0,0 +1,185 @@
<!--
SPDX-License-Identifier: MIT
The MIT License (MIT)
Copyright (c) 2015-2021 <Your name and contributors>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.limework.forks.LimeLogin</groupId>
<artifactId>limelogin-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<!--This have to be in lowercase because it's used by plugin.yml-->
<artifactId>Limelogin.bungee</artifactId>
<packaging>jar</packaging>
<!--Represents the main plugin-->
<name>LimeLoginBungee</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>false</shadedArtifactAttached>
<artifactSet>
<excludes>
<!--Those classes are already present in BungeeCord version-->
<exclude>net.md-5:bungeecord-config</exclude>
<exclude>com.google.code.gson:gson</exclude>
</excludes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>fastlogin.hikari</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>fastlogin.slf4j</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
</repository>
<repository>
<id>opencollab-snapshot</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url>
</repository>
<repository>
<id>spigotplugins-repo</id>
<url>https://maven.gamestrike.de/mvn/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<!--Common plugin component-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>limelogin.core</artifactId>
<version>${project.version}</version>
</dependency>
<!--BungeeCord with also the part outside the API-->
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-proxy</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Bedrock player bridge -->
<!-- Should be removed one Floodgate 2.0 gets a stable release -->
<dependency>
<groupId>org.geysermc</groupId>
<artifactId>floodgate-bungee</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Bedrock player bridge -->
<!-- Version 2.0 -->
<dependency>
<groupId>org.geysermc.floodgate</groupId>
<artifactId>api</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--Login plugin-->
<dependency>
<groupId>me.vik1395</groupId>
<artifactId>BungeeAuth</artifactId>
<version>1.4</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/BungeeAuth-1.4.jar</systemPath>
</dependency>
<dependency>
<groupId>de.xxschrandxx.bca</groupId>
<artifactId>BungeeCordAuthenticator</artifactId>
<version>0.0.2</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.Mohist-Community.SodionAuth</groupId>
<artifactId>SodionAuth-Bungee</artifactId>
<version>2bdfdc854b</version>
<exclusions>
<exclusion>
<groupId>com.github.Mohist-Community.SodionAuth</groupId>
<artifactId>SodionAuth-Libs</artifactId>
</exclusion>
</exclusions>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.34.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,68 @@
/*
* SPDX-License-Identifier: MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2021 <Your name and contributors>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.games647.fastlogin.bungee;
import com.github.games647.fastlogin.core.StoredProfile;
import com.github.games647.fastlogin.core.shared.LoginSession;
public class BungeeLoginSession extends LoginSession {
private boolean alreadySaved;
private boolean alreadyLogged;
public BungeeLoginSession(String username, boolean registered, StoredProfile profile) {
super(username, registered, profile);
}
public synchronized void setRegistered(boolean registered) {
this.registered = registered;
}
public synchronized boolean isAlreadySaved() {
return alreadySaved;
}
public synchronized void setAlreadySaved(boolean alreadySaved) {
this.alreadySaved = alreadySaved;
}
public synchronized boolean isAlreadyLogged() {
return alreadyLogged;
}
public synchronized void setAlreadyLogged(boolean alreadyLogged) {
this.alreadyLogged = alreadyLogged;
}
@Override
public synchronized String toString() {
return this.getClass().getSimpleName() + '{' +
"alreadySaved=" + alreadySaved +
", alreadyLogged=" + alreadyLogged +
", registered=" + registered +
"} " + super.toString();
}
}

View File

@ -0,0 +1,79 @@
/*
* SPDX-License-Identifier: MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2021 <Your name and contributors>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.games647.fastlogin.bungee;
import com.github.games647.fastlogin.core.shared.LoginSource;
import java.net.InetSocketAddress;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.event.PreLoginEvent;
public class BungeeLoginSource implements LoginSource {
private final PendingConnection connection;
private final PreLoginEvent preLoginEvent;
public BungeeLoginSource(PendingConnection connection, PreLoginEvent preLoginEvent) {
this.connection = connection;
this.preLoginEvent = preLoginEvent;
}
@Override
public void enableOnlinemode() {
connection.setOnlineMode(true);
}
@Override
public void kick(String message) {
preLoginEvent.setCancelled(true);
if (message == null) {
preLoginEvent.setCancelReason(new ComponentBuilder("Kicked").color(ChatColor.WHITE).create());
} else {
preLoginEvent.setCancelReason(TextComponent.fromLegacyText(message));
}
}
@Override
public InetSocketAddress getAddress() {
return connection.getAddress();
}
public PendingConnection getConnection() {
return connection;
}
@Override
public String toString() {
return this.getClass().getSimpleName() + '{' +
"connection=" + connection +
'}';
}
}

View File

@ -0,0 +1,188 @@
/*
* SPDX-License-Identifier: MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2021 <Your name and contributors>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.games647.fastlogin.bungee;
import com.github.games647.fastlogin.bungee.hook.BungeeAuthHook;
import com.github.games647.fastlogin.bungee.hook.BungeeCordAuthenticatorBungeeHook;
import com.github.games647.fastlogin.bungee.hook.SodionAuthHook;
import com.github.games647.fastlogin.bungee.listener.ConnectListener;
import com.github.games647.fastlogin.bungee.listener.PluginMessageListener;
import com.github.games647.fastlogin.core.AsyncScheduler;
import com.github.games647.fastlogin.core.CommonUtil;
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
import com.github.games647.fastlogin.core.message.ChangePremiumMessage;
import com.github.games647.fastlogin.core.message.ChannelMessage;
import com.github.games647.fastlogin.core.message.NamespaceKey;
import com.github.games647.fastlogin.core.message.SuccessMessage;
import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.shared.PlatformPlugin;
import com.google.common.collect.MapMaker;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadFactory;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.PluginManager;
import net.md_5.bungee.api.scheduler.GroupedThreadFactory;
import org.slf4j.Logger;
/**
* BungeeCord version of FastLogin. This plugin keeps track on online mode connections.
*/
public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSender> {
private final ConcurrentMap<PendingConnection, BungeeLoginSession> session = new MapMaker().weakKeys().makeMap();
private FastLoginCore<ProxiedPlayer, CommandSender, FastLoginBungee> core;
private AsyncScheduler scheduler;
private Logger logger;
@Override
public void onEnable() {
logger = CommonUtil.createLoggerFromJDK(getLogger());
scheduler = new AsyncScheduler(logger, getThreadFactory());
core = new FastLoginCore<>(this);
core.load();
if (!core.setupDatabase()) {
return;
}
//events
PluginManager pluginManager = getProxy().getPluginManager();
ConnectListener connectListener = new ConnectListener(this, core.getRateLimiter());
pluginManager.registerListener(this, connectListener);
pluginManager.registerListener(this, new PluginMessageListener(this));
//this is required to listen to incoming messages from the server
getProxy().registerChannel(NamespaceKey.getCombined(getName(), ChangePremiumMessage.CHANGE_CHANNEL));
getProxy().registerChannel(NamespaceKey.getCombined(getName(), SuccessMessage.SUCCESS_CHANNEL));
registerHook();
}
@Override
public void onDisable() {
if (core != null) {
core.close();
}
}
public FastLoginCore<ProxiedPlayer, CommandSender, FastLoginBungee> getCore() {
return core;
}
public ConcurrentMap<PendingConnection, BungeeLoginSession> getSession() {
return session;
}
private void registerHook() {
try {
List<Class<? extends AuthPlugin<ProxiedPlayer>>> hooks = Arrays.asList(
BungeeAuthHook.class, BungeeCordAuthenticatorBungeeHook.class, SodionAuthHook.class);
for (Class<? extends AuthPlugin<ProxiedPlayer>> clazz : hooks) {
String pluginName = clazz.getSimpleName();
pluginName = pluginName.substring(0, pluginName.length() - "Hook".length());
//uses only member classes which uses AuthPlugin interface (skip interfaces)
Plugin plugin = getProxy().getPluginManager().getPlugin(pluginName);
if (plugin != null) {
logger.info("Hooking into auth plugin: {}", pluginName);
core.setAuthPluginHook(
clazz.getDeclaredConstructor(FastLoginBungee.class).newInstance(this));
break;
}
}
} catch (ReflectiveOperationException ex) {
logger.error("Couldn't load the auth hook class", ex);
}
}
public void sendPluginMessage(Server server, ChannelMessage message) {
if (server != null) {
ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
message.writeTo(dataOutput);
NamespaceKey channel = new NamespaceKey(getName(), message.getChannelName());
server.sendData(channel.getCombinedName(), dataOutput.toByteArray());
}
}
@Override
public String getName() {
return getDescription().getName();
}
@Override
public Path getPluginFolder() {
return getDataFolder().toPath();
}
@Override
public Logger getLog() {
return logger;
}
@Override
public void sendMessage(CommandSender receiver, String message) {
receiver.sendMessage(TextComponent.fromLegacyText(message));
}
@Override
@SuppressWarnings("deprecation")
public ThreadFactory getThreadFactory() {
return new ThreadFactoryBuilder()
.setNameFormat(getName() + " Pool Thread #%1$d")
//Hikari create daemons by default
.setDaemon(true)
.setThreadFactory(new GroupedThreadFactory(this, getName()))
.build();
}
@Override
public AsyncScheduler getScheduler() {
return scheduler;
}
@Override
public boolean isPluginInstalled(String name) {
return getProxy().getPluginManager().getPlugin(name) != null;
}
}

View File

@ -0,0 +1,64 @@
/*
* SPDX-License-Identifier: MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2021 <Your name and contributors>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.games647.fastlogin.bungee.event;
import com.github.games647.fastlogin.core.StoredProfile;
import com.github.games647.fastlogin.core.shared.LoginSession;
import com.github.games647.fastlogin.core.shared.event.FastLoginAutoLoginEvent;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;
public class BungeeFastLoginAutoLoginEvent extends Event implements FastLoginAutoLoginEvent, Cancellable {
private final LoginSession session;
private final StoredProfile profile;
private boolean cancelled;
public BungeeFastLoginAutoLoginEvent(LoginSession session, StoredProfile profile) {
this.session = session;
this.profile = profile;
}
@Override
public LoginSession getSession() {
return session;
}
@Override
public StoredProfile getProfile() {
return profile;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -0,0 +1,59 @@
/*
* SPDX-License-Identifier: MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2021 <Your name and contributors>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.games647.fastlogin.bungee.event;
import com.github.games647.fastlogin.core.StoredProfile;
import com.github.games647.fastlogin.core.shared.LoginSource;
import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent;
import net.md_5.bungee.api.plugin.Event;
public class BungeeFastLoginPreLoginEvent extends Event implements FastLoginPreLoginEvent {
private final String username;
private final LoginSource source;
private final StoredProfile profile;
public BungeeFastLoginPreLoginEvent(String username, LoginSource source, StoredProfile profile) {
this.username = username;
this.source = source;
this.profile = profile;
}
@Override
public String getUsername() {
return username;
}
@Override
public LoginSource getSource() {
return source;
}
@Override
public StoredProfile getProfile() {
return profile;
}
}

View File

@ -0,0 +1,51 @@
/*
* SPDX-License-Identifier: MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2021 <Your name and contributors>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.games647.fastlogin.bungee.event;
import com.github.games647.fastlogin.core.StoredProfile;
import com.github.games647.fastlogin.core.shared.event.FastLoginPremiumToggleEvent;
import net.md_5.bungee.api.plugin.Event;
public class BungeeFastLoginPremiumToggleEvent extends Event implements FastLoginPremiumToggleEvent {
private final StoredProfile profile;
private final PremiumToggleReason reason;
public BungeeFastLoginPremiumToggleEvent(StoredProfile profile, PremiumToggleReason reason) {
this.profile = profile;
this.reason = reason;
}
@Override
public StoredProfile getProfile() {
return profile;
}
@Override
public FastLoginPremiumToggleEvent.PremiumToggleReason getReason() {
return reason;
}
}

View File

@ -0,0 +1,65 @@
/*
* SPDX-License-Identifier: MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2021 <Your name and contributors>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and