#2372: Add SettingsChangedEvent for client-side settings
This commit is contained in:
parent
d7eef6ff2e
commit
272258cf5a
@ -0,0 +1,32 @@
|
|||||||
|
package net.md_5.bungee.api.event;
|
||||||
|
|
||||||
|
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 after a {@link ProxiedPlayer} changed one or more of the following
|
||||||
|
* (client-side) settings:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>View distance</li>
|
||||||
|
* <li>Locale</li>
|
||||||
|
* <li>Displayed skin parts</li>
|
||||||
|
* <li>Chat visibility</li>
|
||||||
|
* <li>Chat colors</li>
|
||||||
|
* <li>Main hand side (left or right)</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = false)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class SettingsChangedEvent extends Event
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Player who changed the settings.
|
||||||
|
*/
|
||||||
|
private final ProxiedPlayer player;
|
||||||
|
}
|
@ -12,6 +12,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|||||||
import net.md_5.bungee.api.event.ChatEvent;
|
import net.md_5.bungee.api.event.ChatEvent;
|
||||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
|
import net.md_5.bungee.api.event.SettingsChangedEvent;
|
||||||
import net.md_5.bungee.api.event.TabCompleteEvent;
|
import net.md_5.bungee.api.event.TabCompleteEvent;
|
||||||
import net.md_5.bungee.forge.ForgeConstants;
|
import net.md_5.bungee.forge.ForgeConstants;
|
||||||
import net.md_5.bungee.netty.ChannelWrapper;
|
import net.md_5.bungee.netty.ChannelWrapper;
|
||||||
@ -175,6 +176,9 @@ public class UpstreamBridge extends PacketHandler
|
|||||||
public void handle(ClientSettings settings) throws Exception
|
public void handle(ClientSettings settings) throws Exception
|
||||||
{
|
{
|
||||||
con.setSettings( settings );
|
con.setSettings( settings );
|
||||||
|
|
||||||
|
SettingsChangedEvent settingsEvent = new SettingsChangedEvent( con );
|
||||||
|
bungee.getPluginManager().callEvent( settingsEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user