DISCLAIMER |
---|
The following is a feature only available in Mythic Dungeons 1.3.0+! |
Mythic Dungeons provides a simple way to add compatibility for other party plugins. After following the instructions outlined in the introduction page, there are only two steps needed to make your party plugin compatible.
After that, server owners need to tell Mythic Dungeons to use your plugin as a party provider! This is done through the PartyPlugin
option in the Mythic Dungeons config.
Step 1 - Implement the IDungeonParty Interface
Mythic Dungeons provides an interface that comes with all the necessary methods to make a party system compatible. All you have to do is implement the IDungeonParty interface into your existing party object and ensure it includes the necessary methods:
-
void addPlayer(Player)
- Allows Mythic Dungeons to add players to the party. -
void removePlayer(Player)
- Allows Mythic Dungeons to remove players from the party. -
List<Player> getPlayers()
- Allows Mythic Dungeons to retrieve a list of players currently in the party. -
Player getLeader()
- Allows Mythic Dungeons to retrieve the current owner of the party.
See the party class below for a full example.
Step 2 - Call the initDungeonParty Method
In order for Mythic Dungeons to track the party, it needs to be informed that it exists upon creation. This can be achieved by simply calling initDungeonParty(Plugin)
. The plugin is used to verify that the server owner has configured their Mythic Dungeons to use your party system. (You can also use initDungeonParty(String...)
if you want to provide multiple possible names for your party system.)
Example Party Class
Example Party Class (click to expand)
class ExampleParty implements IDungeonParty {
private UUID leader;
private List<UUID> playerUUIDs = new ArrayList<>();
public ExampleParty(Player leader) {
this.leader = leader.getUniqueId();
// REQUIRED!! Init the party with your plugin instance here, or enter a list of names for the party system.
// It's recommended to do this after you've finished everything else in your constructor.
initDungeonParty(plugin);
}
// Allows Mythic Dungeons to easily add players to your party object.
@Override
public void addPlayer(Player player) {
playerUUIDs.add(player.getUniqueId());
}
// Allows Mythic Dungeons to easily remove players from your party object.
@Override
public void removePlayer(Player player) {
playerUUIDs.remove(player.getUniqueId());
}
// Allows Mythic Dungeons to easily retrieve a list of players in the party.
// NOTE: It's advised to store players using UUIDs and then convert them to Players in the getPlayers method.
@Override
public List<Player> getPlayers() {
List<Player> players = new ArrayList<>();
for (UUID uuid : playerUUIDs) {
Player player = Bukkit.getPlayer(uuid);
if (player == null) continue;
players.add(player);
}
return players;
}
// Allows Mythic Dungeons to easily retrieve the leader or owner of the party object.
@Override
public Player getLeader() {
return Bukkit.getPlayer(leader);
}
}
And that's it! This system is still relatively experimental, but should allow easy integration with Mythic Dungeons using your own party system.
DISCLAIMER: This system currently doesn't work with Mythic Dungeons' built in recruitment/party-finder system. In order to support the recruitment system, Mythic Dungeons must natively support your plugin. If there is enough demand, we will explore making the recruit system compatible with the IDungeonParty interface.