use of com.alessiodp.parties.velocity.events.VelocityEventManager in project Parties by AlessioDP.
the class VelocityPartiesPlugin method postHandle.
@Override
protected void postHandle() {
addonManager = new VelocityPartiesAddonManager(this);
economyManager = new VelocityEconomyManager(this);
eventManager = new VelocityEventManager(this);
super.postHandle();
new VelocityMetricsHandler(this);
((VelocityPartiesConfigurationManager) getConfigurationManager()).makeConfigsSync();
}
use of com.alessiodp.parties.velocity.events.VelocityEventManager in project Parties by AlessioDP.
the class VelocityFollowListener method onConnected.
@Subscribe
public void onConnected(ServerConnectedEvent event) {
if (!VelocityConfigMain.ADDITIONAL_FOLLOW_ENABLE)
return;
// Not connected to the network yet
if (!event.getPlayer().getCurrentServer().isPresent())
return;
plugin.getScheduler().scheduleAsyncLater(() -> {
if (allowedServer(event.getPlayer().getCurrentServer().get().getServerInfo().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()))) {
RegisteredServer server = event.getPlayer().getCurrentServer().get().getServer();
// Calling API event
VelocityPartiesPartyFollowEvent partyFollowEvent = ((VelocityEventManager) plugin.getEventManager()).preparePartyFollowEvent(party, server);
plugin.getEventManager().callEvent(partyFollowEvent);
if (!partyFollowEvent.isCancelled()) {
// Let other players follow him
sendMembers(party, player, server);
}
}
}
}, ConfigMain.ADDITIONAL_FOLLOW_DELAY, TimeUnit.MILLISECONDS);
}
Aggregations