diff --git a/agl-velocity/pom.xml b/agl-velocity/pom.xml deleted file mode 100644 index 2d6c3fc..0000000 --- a/agl-velocity/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - GreenAppleLogin - net.limework.plugins - 1.0.0-SNAPSHOT - ../pom.xml - - 4.0.0 - - agl-velocity - - - \ No newline at end of file diff --git a/agl-api/pom.xml b/gal-api/pom.xml similarity index 93% rename from agl-api/pom.xml rename to gal-api/pom.xml index c6f044e..7250018 100644 --- a/agl-api/pom.xml +++ b/gal-api/pom.xml @@ -9,8 +9,6 @@ ../pom.xml 4.0.0 - - agl-api - + gal-api \ No newline at end of file diff --git a/gal-api/src/main/java/net/limework/gal/utils/Messages.java b/gal-api/src/main/java/net/limework/gal/utils/Messages.java new file mode 100644 index 0000000..19fe77b --- /dev/null +++ b/gal-api/src/main/java/net/limework/gal/utils/Messages.java @@ -0,0 +1,27 @@ +package net.limework.gal.utils; + +/** + * @since 1.0.0 + * + * @// TODO: 12/14/21 move the messages into A Config file in yaml or json + */ +public class Messages { + // + public final static String FAILED_CONNECTION = """ + &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040 + &6- &a&lGovindas Limework&6 - + + &c&oYour connection has failed to authenticate and cracked mode was enabled! + + &7&o This could happen because: + 1. Mojang / Microsoft api is down\040\040\040\040\040\040\040\040\040 + 2. Using cracked minecraft (if you are using cracked Minecraft please relog!) + + &6If this a mistake and you own a Minecraft account\040 + &cPlease connect to &a&lreset.limework.net\040\040 + &7&oPro tip: use Direct connection + &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m &2&m""".replace("&", "ยง"); + + + +} diff --git a/gal-api/src/main/java/net/limework/gal/utils/config/AntiBot.java b/gal-api/src/main/java/net/limework/gal/utils/config/AntiBot.java new file mode 100644 index 0000000..6b97ac3 --- /dev/null +++ b/gal-api/src/main/java/net/limework/gal/utils/config/AntiBot.java @@ -0,0 +1,18 @@ +package net.limework.gal.utils.config; + +import java.util.concurrent.TimeUnit; + +public record AntiBot(int maxConnections, long reset, TimeUnit resetUnit) { + + public int getMaxConnections() { + return maxConnections; + } + + public long getReset() { + return reset; + } + + public TimeUnit getResetUnit() { + return resetUnit; + } +} diff --git a/gal-api/src/main/java/net/limework/gal/utils/config/Configuration.java b/gal-api/src/main/java/net/limework/gal/utils/config/Configuration.java new file mode 100644 index 0000000..bbae70a --- /dev/null +++ b/gal-api/src/main/java/net/limework/gal/utils/config/Configuration.java @@ -0,0 +1,13 @@ +package net.limework.gal.utils.config; + +public interface Configuration { + + String getCrackedChar(); + + + AntiBot getAntiBot(); + + + + +} diff --git a/gal-api/src/main/resources/config.json b/gal-api/src/main/resources/config.json new file mode 100644 index 0000000..1e8a247 --- /dev/null +++ b/gal-api/src/main/resources/config.json @@ -0,0 +1,7 @@ +{ + "default-cracked-char": "-", + "simple-anti-bot": { + "max-connections" : 590, + "reset" : 10 + } +} \ No newline at end of file diff --git a/gal-api/src/main/resources/config.yaml b/gal-api/src/main/resources/config.yaml new file mode 100644 index 0000000..5cf0cb5 --- /dev/null +++ b/gal-api/src/main/resources/config.yaml @@ -0,0 +1,16 @@ +# This message handles what type of char the system should use +# like if its - Cracked players will have it in the name +# example: +# Ham1255 is a cracked player want to join mc.limework.net +# when system checks if he is cracked then if the name does not contain - +# system will replace the name to -Ham1255 +default-cracked-char: "-" + + +# Just simple anti bot +# example: +# when a player joins a server it makes request to mojang api which has 600 per 10 mins +# if the server reach's the limits players can no longer join + possibility of getting banned by mojang api for a day! +simple-anti-bot: + max-connections: 590 + reset: 10 diff --git a/gal-velocity/pom.xml b/gal-velocity/pom.xml new file mode 100644 index 0000000..b209a10 --- /dev/null +++ b/gal-velocity/pom.xml @@ -0,0 +1,37 @@ + + + + GreenAppleLogin + net.limework.plugins + 1.0.0-SNAPSHOT + ../pom.xml + + 4.0.0 + gal-velocity + + + + velocitypowered + https://nexus.velocitypowered.com/repository/maven-public/ + + + + + + + com.velocitypowered + velocity-api + 3.1.0 + provided + + + gal-api + net.limework.plugins + ${version} + + + + + \ No newline at end of file diff --git a/gal-velocity/src/main/java/net/limework/gal/ConfigLoader.java b/gal-velocity/src/main/java/net/limework/gal/ConfigLoader.java new file mode 100644 index 0000000..301ad34 --- /dev/null +++ b/gal-velocity/src/main/java/net/limework/gal/ConfigLoader.java @@ -0,0 +1,34 @@ +package net.limework.gal; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import net.limework.gal.utils.config.AntiBot; +import net.limework.gal.utils.config.Configuration; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.util.concurrent.TimeUnit; + +public class ConfigLoader implements Configuration { + + private final String crackedChar; + private final AntiBot antiBot; + + public ConfigLoader(File file) throws FileNotFoundException { + JsonObject jsonObject = JsonParser.parseReader(new FileReader(file)).getAsJsonObject(); + this.crackedChar = jsonObject.get("default-cracked-char").getAsString(); + JsonObject antiBotJson = jsonObject.getAsJsonObject("simple-anti-bot"); + this.antiBot = new AntiBot(antiBotJson.get("max-connections").getAsInt(), antiBotJson.get("reset").getAsLong(), TimeUnit.MINUTES); + } + + @Override + public String getCrackedChar() { + return this.crackedChar; + } + + @Override + public AntiBot getAntiBot() { + return this.antiBot; + } +} diff --git a/gal-velocity/src/main/java/net/limework/gal/VelocityGalPlugin.java b/gal-velocity/src/main/java/net/limework/gal/VelocityGalPlugin.java new file mode 100644 index 0000000..b337f74 --- /dev/null +++ b/gal-velocity/src/main/java/net/limework/gal/VelocityGalPlugin.java @@ -0,0 +1,65 @@ +package net.limework.gal; + +import com.google.inject.Inject; +import com.velocitypowered.api.plugin.Plugin; +import com.velocitypowered.api.plugin.annotation.DataDirectory; +import com.velocitypowered.api.proxy.ProxyServer; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Objects; +import java.util.logging.Logger; + +@Plugin(name = "GreenAppleLogin", id = "greenapplelogin", version = "1.0.0", description = "Plugin that handle cracked + premium") +public class VelocityGalPlugin { + + private final ProxyServer proxyServer; + private final Logger logger; + private final File dataFolder; + private final ConfigLoader config; + + @Inject + public VelocityGalPlugin(ProxyServer proxyServer, Logger logger, @DataDirectory Path dataDirectory) { + this.proxyServer = proxyServer; + this.logger = logger; + this.dataFolder = dataDirectory.toFile(); + + if (this.dataFolder.mkdir()) { + getLogger().info("Created Plugin data folder."); + } + File file = new File(getDataFolder(), "config.json"); + if (!file.exists()) { + try (InputStream in = getClass().getClassLoader().getResourceAsStream("config.json")) { + Files.copy(Objects.requireNonNull(in), file.toPath()); + } catch (NullPointerException | IOException e) { + throw new RuntimeException("unable to load config file", e); + } + } + try { + this.config = new ConfigLoader(file); + } catch (FileNotFoundException e) { + throw new RuntimeException("unable to load config file", e); + } + + + + } + + + + public ProxyServer getProxyServer() { + return proxyServer; + } + + public Logger getLogger() { + return logger; + } + + public File getDataFolder() { + return dataFolder; + } +} diff --git a/pom.xml b/pom.xml index d882cfd..0865337 100644 --- a/pom.xml +++ b/pom.xml @@ -9,9 +9,29 @@ pom 1.0.0-SNAPSHOT - agl-api - agl-velocity + gal-api + gal-velocity - - + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 17 + 17 + + + + + + ${project.version} + \ No newline at end of file