-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2414c69
commit 0899bf8
Showing
17 changed files
with
306 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: JavaDocs Generation | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- name: Build with Gradle | ||
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7 | ||
with: | ||
arguments: :api:javadoc | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: 'api/build/docs/javadoc' | ||
|
||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
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
15 changes: 15 additions & 0 deletions
15
api/src/main/java/us/ajg0702/queue/api/events/Cancellable.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,15 @@ | ||
package us.ajg0702.queue.api.events; | ||
|
||
public interface Cancellable { | ||
/** | ||
* Whether this event is canceled. | ||
* @return True if canceled. False if not. | ||
*/ | ||
boolean isCancelled(); | ||
|
||
/** | ||
* Allows you to cancel or un-cancel this event | ||
* @param cancelled True to cancel the event, false to un-cancel | ||
*/ | ||
void setCancelled(boolean cancelled); | ||
} |
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,4 @@ | ||
package us.ajg0702.queue.api.events; | ||
|
||
public interface Event { | ||
} |
51 changes: 51 additions & 0 deletions
51
api/src/main/java/us/ajg0702/queue/api/events/PositionChangeEvent.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,51 @@ | ||
package us.ajg0702.queue.api.events; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
import us.ajg0702.queue.api.players.AdaptedPlayer; | ||
import us.ajg0702.queue.api.players.QueuePlayer; | ||
import us.ajg0702.queue.api.queues.QueueServer; | ||
|
||
/** | ||
* Called when someone is added or removed from a queue that the player is in, causing the player's position to change | ||
*/ | ||
public class PositionChangeEvent implements Event { | ||
private final QueuePlayer player; | ||
private final int position; | ||
|
||
public PositionChangeEvent(QueuePlayer player) { | ||
this.player = player; | ||
position = player.getPosition(); | ||
} | ||
|
||
/** | ||
* Gets the QueuePlayer object that represents this player | ||
* @return the QueuePlayer object | ||
*/ | ||
public QueuePlayer getQueuePlayer() { | ||
return player; | ||
} | ||
|
||
/** | ||
* Gets the AdaptedPlayer that this event is about. May return null! | ||
* @return The AdaptedPlayer that this event is about. Returns null if the player is offline. | ||
*/ | ||
public @Nullable AdaptedPlayer getPlayer() { | ||
return player.getPlayer(); | ||
} | ||
|
||
/** | ||
* Gets the player's new position in the queue | ||
* @return The player's new position. 1 being 1st, 2 being 2nd, etc | ||
*/ | ||
public int getPosition() { | ||
return position; | ||
} | ||
|
||
/** | ||
* Gets the queue that this event is from | ||
* @return The QueueServer that the player is in that their position changed | ||
*/ | ||
public QueueServer getQueue() { | ||
return player.getQueueServer(); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
api/src/main/java/us/ajg0702/queue/api/events/PreQueueEvent.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,45 @@ | ||
package us.ajg0702.queue.api.events; | ||
|
||
import us.ajg0702.queue.api.players.AdaptedPlayer; | ||
import us.ajg0702.queue.api.queues.QueueServer; | ||
|
||
/** | ||
* Called after all checks are made, right before a player is actually added to the queue. | ||
* If canceled, the player will not be added to the queue. | ||
* If you cancel this event, it is up to you to send a message telling the player why they were not added to the queue. | ||
*/ | ||
public class PreQueueEvent implements Event, Cancellable { | ||
private final AdaptedPlayer player; | ||
private final QueueServer target; | ||
|
||
private boolean cancelled = false; | ||
|
||
public PreQueueEvent(AdaptedPlayer player, QueueServer target) { | ||
this.player = player; | ||
this.target = target; | ||
} | ||
|
||
/** | ||
* Gets the player that is joining the queue | ||
* @return | ||
*/ | ||
public AdaptedPlayer getPlayer() { | ||
return player; | ||
} | ||
|
||
/** | ||
* Gets the target QueueServer that the player is trying to queue for | ||
* @return The QueueServer that the player is trying to queue for | ||
*/ | ||
public QueueServer getTarget() { | ||
return target; | ||
} | ||
|
||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
public void setCancelled(boolean cancelled) { | ||
this.cancelled = cancelled; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
api/src/main/java/us/ajg0702/queue/api/events/SuccessfulSendEvent.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,34 @@ | ||
package us.ajg0702.queue.api.events; | ||
|
||
import us.ajg0702.queue.api.players.AdaptedPlayer; | ||
import us.ajg0702.queue.api.players.QueuePlayer; | ||
import us.ajg0702.queue.api.server.AdaptedServer; | ||
|
||
/** | ||
* Called after a player is successfully sent to a server. | ||
*/ | ||
public class SuccessfulSendEvent implements Event { | ||
private final QueuePlayer player; | ||
private final AdaptedServer server; | ||
|
||
public SuccessfulSendEvent(QueuePlayer player, AdaptedServer server) { | ||
this.player = player; | ||
this.server = server; | ||
} | ||
|
||
/** | ||
* Gets the player that was sent | ||
* @return the player that was sent | ||
*/ | ||
public AdaptedPlayer getPlayer() { | ||
return player.getPlayer(); | ||
} | ||
|
||
/** | ||
* Gets the server that the player was sent to | ||
* @return The server that the player was sent to | ||
*/ | ||
public AdaptedServer getServer() { | ||
return server; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
api/src/main/java/us/ajg0702/queue/api/events/utils/EventReceiver.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,6 @@ | ||
package us.ajg0702.queue.api.events.utils; | ||
|
||
@FunctionalInterface | ||
public interface EventReceiver<E> { | ||
void execute(E event); | ||
} |
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
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.