Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Events): Improve management of Player connections and skin parts…
… with new events.
- Loading branch information
1 parent
8d46a21
commit 1768d28
Showing
15 changed files
with
265 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.../main/java/com/georgev22/skinoverlay/event/events/player/PlayerObjectConnectionEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.georgev22.skinoverlay.event.events.player; | ||
|
||
import com.georgev22.skinoverlay.event.Cancellable; | ||
import com.georgev22.skinoverlay.event.HandlerList; | ||
import com.georgev22.skinoverlay.utilities.player.PlayerObject; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class PlayerObjectConnectionEvent extends PlayerObjectEvent implements Cancellable { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final ConnectionType connectionType; | ||
|
||
/** | ||
* Constructs a {@code PlayerObjectConnectionEvent} with the specified player object, connection type and asynchronous status. | ||
* | ||
* @param playerObject the player object associated with this event | ||
* @param connectionType the player connection type | ||
* @param async whether this event should be run asynchronously | ||
*/ | ||
public PlayerObjectConnectionEvent(PlayerObject playerObject, ConnectionType connectionType, boolean async) { | ||
super(playerObject, async); | ||
this.connectionType = connectionType; | ||
} | ||
|
||
public ConnectionType getConnectionType() { | ||
return connectionType; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
public enum ConnectionType { | ||
CONNECT, | ||
DISCONNECT | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...java/com/georgev22/skinoverlay/event/events/player/PlayerSkinPartOptionsChangedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.georgev22.skinoverlay.event.events.player; | ||
|
||
import com.georgev22.skinoverlay.event.HandlerList; | ||
import com.georgev22.skinoverlay.utilities.player.PlayerObject; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class PlayerSkinPartOptionsChangedEvent extends PlayerObjectEvent { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
private final boolean hasSkinPartsChanged; | ||
|
||
/** | ||
* Constructs a {@code PlayerSkinPartOptionsChangedEvent} with the specified player object and asynchronous status. | ||
* | ||
* @param playerObject the player object associated with this event | ||
* @param async whether this event should be run asynchronously | ||
*/ | ||
public PlayerSkinPartOptionsChangedEvent(PlayerObject playerObject, boolean hasSkinPartsChanged, boolean async) { | ||
super(playerObject, async); | ||
this.hasSkinPartsChanged = hasSkinPartsChanged; | ||
} | ||
|
||
public boolean hasSkinPartsChanged() { | ||
return hasSkinPartsChanged; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.