Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PlayerConfigurationEvent #3762

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.md_5.bungee.api.event;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Event;

/**
* Called when the player enters or leaves configuration mode
*/
@Data
@AllArgsConstructor
@ToString(callSuper = false)
@EqualsAndHashCode(callSuper = false)
public class PlayerConfigurationEvent extends Event
{
/**
* The player that has entered or left the configuration mode
*/
private final ProxiedPlayer player;
/**
* The status of the players configuration state
*/
private final Status status;

public enum Status
{
INITIAL_START, // used for the first configuration after login
START,
FINISH
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.event.PlayerConfigurationEvent;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.event.SettingsChangedEvent;
Expand Down Expand Up @@ -343,12 +344,14 @@ public void handle(PluginMessage pluginMessage) throws Exception
@Override
public void handle(LoginAcknowledged loginAcknowledged) throws Exception
{
bungee.getPluginManager().callEvent( new PlayerConfigurationEvent( con, PlayerConfigurationEvent.Status.INITIAL_START ) );
configureServer();
}

@Override
public void handle(StartConfiguration startConfiguration) throws Exception
{
bungee.getPluginManager().callEvent( new PlayerConfigurationEvent( con, PlayerConfigurationEvent.Status.START ) );
configureServer();
}

Expand All @@ -370,6 +373,7 @@ private void configureServer()
@Override
public void handle(FinishConfiguration finishConfiguration) throws Exception
{
bungee.getPluginManager().callEvent( new PlayerConfigurationEvent( con, PlayerConfigurationEvent.Status.FINISH ) );
con.sendQueuedPackets();
}

Expand Down