Search in sources :

Example 1 with PlayerChangedMainHandEvent

use of org.bukkit.event.player.PlayerChangedMainHandEvent in project Glowstone by GlowstoneMC.

the class GlowPlayer method setSettings.

/**
 * Set this player's client settings.
 *
 * @param settings The settings to set.
 */
public void setSettings(ClientSettings settings) {
    String newLocale = settings.getLocale();
    if (!newLocale.equalsIgnoreCase(this.settings.getLocale())) {
        EventFactory.getInstance().callEvent(new PlayerLocaleChangeEvent(this, newLocale));
    }
    if (settings.getMainHand() != getMainHand().ordinal()) {
        EventFactory.getInstance().callEvent(new PlayerChangedMainHandEvent(this, settings.getMainHand() == 0 ? MainHand.LEFT : MainHand.RIGHT));
    }
    forceStream = settings.getViewDistance() != this.settings.getViewDistance() && settings.getViewDistance() + 1 <= server.getViewDistance();
    this.settings = settings;
    metadata.set(MetadataIndex.PLAYER_SKIN_PARTS, settings.getSkinFlags());
    metadata.set(MetadataIndex.PLAYER_MAIN_HAND, settings.getMainHand());
}
Also used : PlayerLocaleChangeEvent(org.bukkit.event.player.PlayerLocaleChangeEvent) PlayerChangedMainHandEvent(org.bukkit.event.player.PlayerChangedMainHandEvent)

Aggregations

PlayerChangedMainHandEvent (org.bukkit.event.player.PlayerChangedMainHandEvent)1 PlayerLocaleChangeEvent (org.bukkit.event.player.PlayerLocaleChangeEvent)1