Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
Updated GitHub repository. Added FoliaLib 0.2.4. Added PaperLib `1.…
Browse files Browse the repository at this point in the history
…0.8`. Added full Folia support. Added FloodgateAPI integration. Removed unused import statements. Added BedrockPlayerDetectedEvent to API. Changed plugin version to `2.5.7`.
  • Loading branch information
BuildTools committed Jun 22, 2023
1 parent fdb50e8 commit cd50a6d
Show file tree
Hide file tree
Showing 35 changed files with 394 additions and 151 deletions.
100 changes: 100 additions & 0 deletions ClientDetector.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?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>ADVENTURE</platformType>
<platformType>BUNGEECORD</platformType>
<platformType>SPIGOT</platformType>
<platformType>VELOCITY</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="McpModuleSettings">
<option name="srgType" value="SRG" />
</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" />
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" name="Maven: com.github.retrooper.packetevents:spigot:2.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.retrooper.packetevents:api:2.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-api:4.14.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-key:4.14.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:examination-api:1.3.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:examination-string:1.3.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-text-serializer-gson:4.14.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-text-serializer-json:4.14.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-text-serializer-legacy:4.14.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-nbt:4.14.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.26" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.11.3" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:23.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:3.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-base:3.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-bukkit:4.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-api:4.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-bungeecord:4.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-gson-legacy-impl:4.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-facet:4.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-viaversion:4.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.20-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-config:1.20-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-event:1.20-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-protocol:1.20-R0.1-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: io.netty:netty-codec:4.1.93.Final" 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: io.netty:netty-transport-native-unix-common:4.1.93.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-common:4.1.93.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-buffer:4.1.93.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport:4.1.93.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver:4.1.93.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:2.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:31.1-jre" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.11.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.joml:joml:1.10.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.velocitypowered:velocity-api:3.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.moandjiezana.toml:toml4j:0.7.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-plain:4.9.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.inject:guice:5.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.6.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.velocitypowered:velocity-brigadier:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:configurate-hocon:3.7.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:configurate-core:3.7.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.typesafe:config:1.4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:configurate-yaml:3.7.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:configurate-gson:3.7.2" level="project" />
<orderEntry type="library" name="Maven: com.tcoded:FoliaLib:0.2.4" level="project" />
<orderEntry type="library" name="Maven: io.papermc:paperlib:1.0.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc.floodgate:api:2.2.2-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc:common:2.0.7-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc.cumulus:cumulus:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.geysermc.event:events:1.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.lanternpowered:lmbda:2.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:7.1" level="project" />
</component>
</module>
75 changes: 66 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

<groupId>de.sportkanone123</groupId>
<artifactId>ClientDetector</artifactId>
<version>2.5.5</version>
<version>2.5.7</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -35,17 +36,26 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<version>3.4.1</version> <!-- Make sure to always use the latest version (https://maven.apache.org/plugins/maven-shade-plugin/) -->
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>de.sportkanone123.clientdetector.spigot.paperlib</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>com.tcoded.folialib</pattern>
<shadedPattern>de.sportkanone123.clientdetector.spigot.folialib</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
<finalName>ClientDetector</finalName>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -88,9 +98,28 @@
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>

<repository>
<id>devmart-other</id>
<url>https://nexuslite.gcnt.net/repos/other/</url>
</repository>

<repository>
<id>opencollab-snapshot-repo</id>
<url>https://repo.opencollab.dev/main/</url>
</repository>

</repositories>

<dependencies>

<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>com.github.retrooper.packetevents</groupId>
<artifactId>spigot</artifactId>
Expand All @@ -114,15 +143,22 @@
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<version>1.20-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<artifactId>spigot-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand All @@ -133,5 +169,26 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.tcoded</groupId>
<artifactId>FoliaLib</artifactId>
<version>0.2.4</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.8</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.geysermc.floodgate</groupId>
<artifactId>api</artifactId>
<version>2.2.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.event.EventHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.tcoded.folialib.FoliaLib;
import de.sportkanone123.clientdetector.spigot.bungee.BungeeManager;
import de.sportkanone123.clientdetector.spigot.client.Client;
import de.sportkanone123.clientdetector.spigot.clientcontrol.ClientControl;
Expand All @@ -33,10 +34,13 @@
import de.sportkanone123.clientdetector.spigot.manager.*;
import de.sportkanone123.clientdetector.spigot.mod.Mod;
import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.geysermc.floodgate.api.FloodgateApi;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -45,14 +49,18 @@


public class ClientDetector extends JavaPlugin {

public static Plugin plugin;
public static FoliaLib foliaLib;
private static FloodgateApi floodgateApi;
public static ArrayList<Client> CLIENTS = new ArrayList<Client>();
public static ArrayList<Mod> MODS = new ArrayList<Mod>();

public static HashMap<UUID, String> mcVersion = new HashMap<UUID, String>();
public static HashMap<UUID, ModList> forgeMods = new HashMap<UUID, ModList>();
public static HashMap<UUID, String> playerClient = new HashMap<UUID, String> ();
public static HashMap<UUID, String> clientVersion = new HashMap<UUID, String> ();
public static HashMap<UUID, String> connectedBedrockPlayers = new HashMap<>();
public static HashMap<UUID, ArrayList<String>> playerMods = new HashMap<UUID, ArrayList<String>> ();
public static HashMap<UUID, ArrayList<String>> playerLabymodMods = new HashMap<UUID, ArrayList<String>> ();
public static HashMap<UUID, ArrayList<String>> playerCommandsQueue = new HashMap<UUID, ArrayList<String>>();
Expand All @@ -71,11 +79,16 @@ public void onLoad() {
@Override
public void onEnable() {
plugin = this;
foliaLib = new FoliaLib((JavaPlugin) plugin);

if (foliaLib.isSpigot()||foliaLib.isUnsupported()){
PaperLib.suggestPaper(this);
}

new MetricsManager(this, 10745);

Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3ClientDetector&7] (&aVersion&7) &aDetected Version &c" + PacketEvents.getAPI().getServerManager().getVersion().name()));
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3ClientDetector&7] (&aVersion&7) &aLoading settings for Version &c" + PacketEvents.getAPI().getServerManager().getVersion().name()));
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3ClientDetector&7] (&aVersion&7) &aDetected Version &c" + Bukkit.getVersion()));
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3ClientDetector&7] (&aVersion&7) &aLoading settings for Version &c" + Bukkit.getVersion()));

Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3ClientDetector&7] (&aProtocol&7) &aLoading protocols..."));
PacketEvents.getAPI().getEventManager().registerListener(new NetworkListener());
Expand Down Expand Up @@ -125,6 +138,11 @@ public void onEnable() {
bungeeManager = new BungeeManager();
}

if (Bukkit.getServer().getPluginManager().isPluginEnabled("floodgate")||isFloodgateEnabled()){
floodgateApi = FloodgateApi.getInstance();
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3ClientDetector&7] (&aFloodgateAPI&7) &aDetected FloodgateAPI " + Bukkit.getPluginManager().getPlugin("floodgate").getDescription().getVersion()));
}

if(Bukkit.getServer().getPluginManager().isPluginEnabled("ViaVersion")){
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3ClientDetector&7] (&aViaVersion&7) &aDetected ViaVersion " + Bukkit.getPluginManager().getPlugin("ViaVersion").getDescription().getVersion()));
}
Expand Down Expand Up @@ -166,5 +184,26 @@ public void onDisable() {

ClientManager.unLoad();
ModManager.unLoad();

HandlerList.unregisterAll(this);

Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3ClientDetector&7] &aShutdown complete!"));
}

public boolean isFloodgateEnabled() {
try {
Class.forName("org.geysermc.floodgate.api.FloodgateApi");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}

public static FloodgateApi getFloodgateApi() {
return floodgateApi;
}

public static FoliaLib getFoliaLib() {
return foliaLib;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ClientDetectorAPI {
public static String getPlayerClient(Player player){
Expand Down
Loading

0 comments on commit cd50a6d

Please sign in to comment.