API for Plugins Running on Bungeecord or Velocity - Simonsator/BungeecordPartyAndFriends GitHub Wiki
Add this line into your plugin.yml:
depends: [PartyAndFriends]
<repositories>
<repository>
<id>simonsators Repo</id>
<url>https://simonsator.de/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>de.simonsator</groupId>
<artifactId>BungeecordPartyAndFriends</artifactId>
<version>1.0.92</version>
<scope>provided</scope>
</dependency>
</dependencies>
Party and Friends uses PAFPlayer objects to simulate a player. A PAFPlayer can either be online or offline. If a PAFPlayer is online, the object can be cast to an OnlinePAFPlayer. To retrieve a PAFPlayer use the PAFPlayerManager.getInstance().getPlayer() methods.
To retrieve data of a party, use the methods of the class PartyManager. Using PartyManager.getInstance().getParty(pPlayer: OnlinePAFPlayer)
you may retrieve an PlayerParty object, which has methods to access all kinds of data of the party.
For friend subcommands there is the abstract class FriendSubCommand. You can find it inside the package de.simonsator.partyandfriends.api.friends.abstractcommands. Your own command needs to extend this class. The JavaDoc explains how to use the class. You need to register the generated object by Friends.getInstance().addCommand(pCommand: FriendSubCommand)
For party subcommands there is the abstract class PartySubCommand. You can find it inside the package de.simonsator.partyandfriends.api.party.abstractcommands. Your own command needs to extend this class. The Javadoc explains how to use the class. You need to register the generated object by PartyCommand.getInstance().addCommand(pCommand: PartySubCommand)
With the server connector API, you can let support your multiple lobby system Party and Friends. This works on all Bungeecord versions in the same way. How to use it, you can see best at this example:
package de.simonsator.partyandfriends;
import de.simonsator.partyandfriends.api.friends.ServerConnector;
import de.simonsator.partyandfriends.api.pafplayers.PAFPlayerClass;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin;
public class MyServerConnector extends Plugin implements ServerConnector {
@Override
public void onEnable() {
// This sets the ServeConnector to this one during boot
PAFPlayerClass.setServerConnector(this);
}
@Override
public void connect(ProxiedPlayer pPlayer, ServerInfo pServer) {
// Here you need to enter your code which lets the player connect to the desired server
pPlayer.connect(pServer);
}
}
You should view the following Javadocs: ServerConnector Interface, Jump class
The Velocity version uses the same API. The only two differences are that all classes have been moved from de.simonsator.partyandfriends
to de.simonsator.partyandfriends.velocity
and instead of the Bungeecord classes like ProxiedPlayer
the Velocity equivalent classes like Player
are used. The maven dependency is:
<repositories>
<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>
</dependencies>