Merge pull request #46 from HappyAreaBean/feat/paf-addon-velocity

This commit is contained in:
Stephan 2024-07-01 14:57:47 -07:00 committed by GitHub
commit c191abaf9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 130 additions and 0 deletions

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bghddevelopment.partyandfriendsaddon</groupId>
<artifactId>PBServerConnector-Velocity</artifactId>
<version>2.3.5</version>
<packaging>jar</packaging>
<name>PartyAndFriendsAddon-Velocity</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>simonsators Repo</id>
<url>https://simonsator.de/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>de.simonsator</groupId>
<artifactId>VelocityPoweredPartyAndFriends</artifactId>
<version>1.0.91</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>3.3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jaimemartz</groupId>
<artifactId>playerbalancer-velocity</artifactId>
<version>2.3.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,39 @@
package com.bghddevelopment.partyandfriendsaddon;
import com.google.inject.Inject;
import com.jaimemartz.playerbalancer.velocity.helper.PlayerLocker;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import de.simonsator.partyandfriends.velocity.api.friends.ServerConnector;
import de.simonsator.partyandfriends.velocity.api.pafplayers.PAFPlayerClass;
import java.util.logging.Logger;
public class PBServerConnector implements ServerConnector {
private final Logger logger;
@Inject
public PBServerConnector(Logger logger) {
this.logger = logger;
}
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
PAFPlayerClass.setServerConnector(this);
logger.info("Enabled PBServerConnector connection for PlayerBalancer!");
}
@Override
public void connect(Player player, RegisteredServer registeredServer) {
PlayerLocker.lock(player);
player.createConnectionRequest(registeredServer)
.connectWithIndication()
.whenComplete((result, throwable) -> {
PlayerLocker.unlock(player);
});
}
}

View File

@ -0,0 +1,20 @@
{
"id": "playerbalancerpartyandfriendsaddon",
"name": "PlayerBalancerPartyAndFriendsAddon",
"version": "${version}",
"authors": [
"BGHDDevelopmentLLC",
"HappyAreaBean"
],
"dependencies": [
{
"id": "partyandfriends",
"optional": false
},
{
"id": "playerbalancer",
"optional": false
}
],
"main": "com.bghddevelopment.partyandfriendsaddon.PBServerConnector"
}

View File

@ -14,6 +14,7 @@
<module>balancer-velocity</module>
<module>addon</module>
<module>partyandfriendsaddon</module>
<module>partyandfriendsaddon-velocity</module>
</modules>
<name>PlayerBalancerParent</name>