-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/request-plugins-for-free/Sp…
…eedBridge into main
- Loading branch information
Showing
26 changed files
with
603 additions
and
295 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
24 changes: 24 additions & 0 deletions
24
api/src/main/java/me/tofpu/speedbridge/api/leaderboard/Leaderboard.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,24 @@ | ||
package me.tofpu.speedbridge.api.leaderboard; | ||
|
||
public interface Leaderboard { | ||
/** | ||
* @return the leaderboard identifier | ||
*/ | ||
String identifier(); | ||
|
||
/** | ||
* Fetches the position from this leaderboard to a string. | ||
* | ||
* @param position the position that you would like to fetch from the leaderboard | ||
* | ||
* @return nicely formatted string position, will return "N/A" if the postiion was filled | ||
*/ | ||
String parse(final int position); | ||
|
||
/** | ||
* A nicely formatted string from this leaderboard. | ||
* | ||
* @return nicely formatted leaderboard | ||
*/ | ||
String print(); | ||
} |
24 changes: 24 additions & 0 deletions
24
api/src/main/java/me/tofpu/speedbridge/api/leaderboard/LeaderboardService.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,24 @@ | ||
package me.tofpu.speedbridge.api.leaderboard; | ||
|
||
|
||
import java.util.function.Consumer; | ||
import java.util.function.Predicate; | ||
|
||
public interface LeaderboardService { | ||
/** | ||
* Retrieves a leaderboard that associates with the type. | ||
* | ||
* @param type the leaderboard type | ||
* | ||
* @return the leaderboard instance that associates with the type, otherwise null. | ||
*/ | ||
Leaderboard get(final LeaderboardType type); | ||
|
||
/** | ||
* This method allows you to run a method across all the leaderboard within a single method, so long it wasn't filtered. | ||
* | ||
* @param filter filter | ||
* @param consumer the consumer value | ||
*/ | ||
void compute(final Predicate<Leaderboard> filter, Consumer<Leaderboard> consumer); | ||
} |
13 changes: 13 additions & 0 deletions
13
api/src/main/java/me/tofpu/speedbridge/api/leaderboard/LeaderboardType.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,13 @@ | ||
package me.tofpu.speedbridge.api.leaderboard; | ||
|
||
public enum LeaderboardType { | ||
GLOBAL, SEASONAL; | ||
|
||
public static LeaderboardType match(final String identifier) { | ||
for (LeaderboardType type : values()){ | ||
if (type.name().equalsIgnoreCase(identifier)) | ||
return type; | ||
} | ||
return null; | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
api/src/main/java/me/tofpu/speedbridge/api/lobby/Leaderboard.java
This file was deleted.
Oops, something went wrong.
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
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.