use of com.alessiodp.parties.bungeecord.events.BungeeEventManager in project Parties by AlessioDP.
the class BungeePartiesPlugin method postHandle.
@Override
protected void postHandle() {
addonManager = new BungeePartiesAddonManager(this);
economyManager = new BungeeEconomyManager(this);
eventManager = new BungeeEventManager(this);
super.postHandle();
new BungeeMetricsHandler(this);
((BungeePartiesConfigurationManager) getConfigurationManager()).makeConfigsSync();
}
use of com.alessiodp.parties.bungeecord.events.BungeeEventManager in project Parties by AlessioDP.
the class BungeeFollowListener method onConnected.
@EventHandler
public void onConnected(ServerSwitchEvent event) {
if (!BungeeConfigMain.ADDITIONAL_FOLLOW_ENABLE)
return;
// Not connected to the network yet
if (event.getPlayer().getServer() == null)
return;
plugin.getScheduler().scheduleAsyncLater(() -> {
if (allowedServer(event.getPlayer().getServer().getInfo().getName())) {
PartyPlayerImpl player = plugin.getPlayerManager().getPlayer(event.getPlayer().getUniqueId());
PartyImpl party = plugin.getPartyManager().getParty(player.getPartyId());
if (party != null && party.isFollowEnabled() && (party.getLeader() != null && party.getLeader().equals(player.getPlayerUUID()))) {
String playerServer = event.getPlayer().getServer().getInfo().getName();
ServerInfo serverInfo = ((BungeePartiesBootstrap) plugin.getBootstrap()).getProxy().getServerInfo(playerServer);
// Calling API event
BungeePartiesPartyFollowEvent partyFollowEvent = ((BungeeEventManager) plugin.getEventManager()).preparePartyFollowEvent(party, playerServer);
plugin.getEventManager().callEvent(partyFollowEvent);
if (!partyFollowEvent.isCancelled()) {
// Let other players follow him
sendMembers(party, player, serverInfo);
}
}
}
}, ConfigMain.ADDITIONAL_FOLLOW_DELAY, TimeUnit.MILLISECONDS);
}
Aggregations