mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 09:42:06 -07:00
[ci skip] Cleanup events (#10202)
This commit is contained in:
@@ -103,6 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.MainHand;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Map;
|
||||
@@ -112,7 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+public class PlayerClientOptionsChangeEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final String locale;
|
||||
+ private final int viewDistance;
|
||||
@@ -136,6 +137,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.textFilteringEnabled = false;
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerClientOptionsChangeEvent(@NotNull Player player, @NotNull Map<ClientOption<?>, ?> options) {
|
||||
+ super(player);
|
||||
+
|
||||
@@ -151,81 +153,81 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getLocale() {
|
||||
+ return locale;
|
||||
+ return this.locale;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasLocaleChanged() {
|
||||
+ return !locale.equals(player.getClientOption(ClientOption.LOCALE));
|
||||
+ return !this.locale.equals(this.player.getClientOption(ClientOption.LOCALE));
|
||||
+ }
|
||||
+
|
||||
+ public int getViewDistance() {
|
||||
+ return viewDistance;
|
||||
+ return this.viewDistance;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasViewDistanceChanged() {
|
||||
+ return viewDistance != player.getClientOption(ClientOption.VIEW_DISTANCE);
|
||||
+ return this.viewDistance != this.player.getClientOption(ClientOption.VIEW_DISTANCE);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ChatVisibility getChatVisibility() {
|
||||
+ return chatVisibility;
|
||||
+ return this.chatVisibility;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatVisibilityChanged() {
|
||||
+ return chatVisibility != player.getClientOption(ClientOption.CHAT_VISIBILITY);
|
||||
+ return this.chatVisibility != this.player.getClientOption(ClientOption.CHAT_VISIBILITY);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabled() {
|
||||
+ return chatColors;
|
||||
+ return this.chatColors;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabledChanged() {
|
||||
+ return chatColors != player.getClientOption(ClientOption.CHAT_COLORS_ENABLED);
|
||||
+ return this.chatColors != this.player.getClientOption(ClientOption.CHAT_COLORS_ENABLED);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public SkinParts getSkinParts() {
|
||||
+ return skinparts;
|
||||
+ return this.skinparts;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasSkinPartsChanged() {
|
||||
+ return skinparts.getRaw() != player.getClientOption(ClientOption.SKIN_PARTS).getRaw();
|
||||
+ return this.skinparts.getRaw() != this.player.getClientOption(ClientOption.SKIN_PARTS).getRaw();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public MainHand getMainHand() {
|
||||
+ return mainHand;
|
||||
+ return this.mainHand;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasMainHandChanged() {
|
||||
+ return mainHand != player.getClientOption(ClientOption.MAIN_HAND);
|
||||
+ return this.mainHand != this.player.getClientOption(ClientOption.MAIN_HAND);
|
||||
+ }
|
||||
+
|
||||
+ public boolean allowsServerListings() {
|
||||
+ return allowsServerListings;
|
||||
+ return this.allowsServerListings;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasAllowServerListingsChanged() {
|
||||
+ return allowsServerListings != player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS);
|
||||
+ return this.allowsServerListings != this.player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasTextFilteringEnabled() {
|
||||
+ return textFilteringEnabled;
|
||||
+ return this.textFilteringEnabled;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasTextFilteringChanged() {
|
||||
+ return textFilteringEnabled != player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED);
|
||||
+ return this.textFilteringEnabled != this.player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
|
Reference in New Issue
Block a user