more implemtaions
This commit is contained in:
@@ -18,6 +18,27 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.3</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -12,21 +12,40 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ConfigLoader implements Configuration {
|
||||
|
||||
private final String crackedChar;
|
||||
private final char crackedChar;
|
||||
private final boolean replaceSpacesWithUnderscore;
|
||||
private final boolean useTheContainMethod;
|
||||
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();
|
||||
this.crackedChar = (jsonObject.get("default-cracked-char").getAsString().charAt(0));
|
||||
this.replaceSpacesWithUnderscore = jsonObject.get("replace-spaces-with-underscore").getAsBoolean();
|
||||
this.useTheContainMethod = jsonObject.get("use-the-contain-method").getAsBoolean();
|
||||
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() {
|
||||
public char getCrackedChar() {
|
||||
return this.crackedChar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCrackedCharString() {
|
||||
return String.valueOf(this.crackedChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doReplaceSpacesWithUnderscore() {
|
||||
return this.replaceSpacesWithUnderscore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useTheContainMethod() {
|
||||
return this.useTheContainMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AntiBot getAntiBot() {
|
||||
return this.antiBot;
|
||||
|
||||
@@ -1,19 +1,31 @@
|
||||
package net.limework.gal;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.Continuation;
|
||||
import com.velocitypowered.api.event.PostOrder;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.PreLoginEvent;
|
||||
import com.velocitypowered.api.event.player.GameProfileRequestEvent;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.util.GameProfile;
|
||||
import net.limework.gal.utils.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static net.limework.gal.utils.PlayerUUIDUtils.*;
|
||||
import static net.limework.gal.utils.PlayerNamesUtils.*;
|
||||
@Plugin(name = "GreenAppleLogin", id = "greenapplelogin", version = "1.0.0", description = "Plugin that handle cracked + premium")
|
||||
public class VelocityGalPlugin {
|
||||
|
||||
@@ -49,6 +61,31 @@ public class VelocityGalPlugin {
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyInitializeEvent(ProxyInitializeEvent event) {
|
||||
//this.proxyServer.getEventManager().register(this, this);
|
||||
}
|
||||
|
||||
@Subscribe(order = PostOrder.FIRST)
|
||||
public void onPreLoginEvent(PreLoginEvent event) {
|
||||
if (isCrackedPlayer(event.getUsername(), config)){
|
||||
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOfflineMode());
|
||||
}else {
|
||||
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOnlineMode());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameProfileRequestEvent(GameProfileRequestEvent event) {
|
||||
if (!event.isOnlineMode()) {
|
||||
logger.info("handling " + event.getUsername());
|
||||
String username = getCorrectCrackedUsername(event.getUsername(), config);
|
||||
logger.info("new username -> " + username);
|
||||
List<GameProfile.Property> properties = event.getGameProfile().getProperties();
|
||||
UUID uuid = getCrackedPlayerUUIDByName(username);
|
||||
event.setGameProfile(new GameProfile(uuid, username, properties));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ProxyServer getProxyServer() {
|
||||
|
||||
Reference in New Issue
Block a user