mirror of
https://github.com/itHotL/PlayerStats.git
synced 2025-01-22 21:41:19 +01:00
Improved consistency with StatRequest and StatResult Type parameters
This commit is contained in:
parent
eeb164e194
commit
3c9e454ad4
@ -28,7 +28,7 @@ public final class PlayerStatsAPI implements PlayerStats, StatManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestGenerator<Integer> playerStatRequest(String playerName) {
|
||||
public PlayerStatRequest playerStatRequest(String playerName) {
|
||||
RequestSettings request = RequestHandler.getBasicPlayerStatRequest(playerName);
|
||||
return new PlayerStatRequest(request);
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.artemis.the.gr8.playerstats.statistic.request;
|
||||
import com.gmail.artemis.the.gr8.playerstats.Main;
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.result.PlayerStatResult;
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.result.StatResult;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
@ -20,25 +19,25 @@ public final class PlayerStatRequest extends StatRequest<Integer> implements Req
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatRequest<Integer> untyped(@NotNull Statistic statistic) {
|
||||
public PlayerStatRequest untyped(@NotNull Statistic statistic) {
|
||||
RequestSettings completedRequest = requestHandler.untyped(statistic);
|
||||
return new PlayerStatRequest(completedRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatRequest<Integer> blockOrItemType(@NotNull Statistic statistic, @NotNull Material material) {
|
||||
public PlayerStatRequest blockOrItemType(@NotNull Statistic statistic, @NotNull Material material) {
|
||||
RequestSettings completedRequest = requestHandler.blockOrItemType(statistic, material);
|
||||
return new PlayerStatRequest(completedRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatRequest<Integer> entityType(@NotNull Statistic statistic, @NotNull EntityType entityType) {
|
||||
public PlayerStatRequest entityType(@NotNull Statistic statistic, @NotNull EntityType entityType) {
|
||||
RequestSettings completedRequest = requestHandler.entityType(statistic, entityType);
|
||||
return new PlayerStatRequest(completedRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatResult<Integer> execute() {
|
||||
public PlayerStatResult execute() {
|
||||
return getStatResult(super.requestSettings);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.artemis.the.gr8.playerstats.statistic.request;
|
||||
import com.gmail.artemis.the.gr8.playerstats.Main;
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.result.ServerStatResult;
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.result.StatResult;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
@ -20,25 +19,25 @@ public final class ServerStatRequest extends StatRequest<Long> implements Reques
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatRequest<Long> untyped(@NotNull Statistic statistic) {
|
||||
public ServerStatRequest untyped(@NotNull Statistic statistic) {
|
||||
RequestSettings completedRequest = requestHandler.untyped(statistic);
|
||||
return new ServerStatRequest(completedRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatRequest<Long> blockOrItemType(@NotNull Statistic statistic, @NotNull Material material) {
|
||||
public ServerStatRequest blockOrItemType(@NotNull Statistic statistic, @NotNull Material material) {
|
||||
RequestSettings completedRequest = requestHandler.blockOrItemType(statistic, material);
|
||||
return new ServerStatRequest(completedRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatRequest<Long> entityType(@NotNull Statistic statistic, @NotNull EntityType entityType) {
|
||||
public ServerStatRequest entityType(@NotNull Statistic statistic, @NotNull EntityType entityType) {
|
||||
RequestSettings completedRequest = requestHandler.entityType(statistic, entityType);
|
||||
return new ServerStatRequest(completedRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatResult<Long> execute() {
|
||||
public ServerStatResult execute() {
|
||||
return getStatResult(requestSettings);
|
||||
}
|
||||
|
||||
|
@ -18,23 +18,23 @@ public abstract class StatRequest<T> {
|
||||
/** Don't call this from the Main Thread!*/
|
||||
public abstract StatResult<T> execute();
|
||||
|
||||
public Statistic getStatistic() {
|
||||
public Statistic getStatisticSetting() {
|
||||
return requestSettings.getStatistic();
|
||||
}
|
||||
|
||||
public @Nullable Material getBlock() {
|
||||
public @Nullable Material getBlockSetting() {
|
||||
return requestSettings.getBlock();
|
||||
}
|
||||
|
||||
public @Nullable Material getItem() {
|
||||
public @Nullable Material getItemSetting() {
|
||||
return requestSettings.getItem();
|
||||
}
|
||||
|
||||
public @Nullable EntityType getEntity() {
|
||||
public @Nullable EntityType getEntitySetting() {
|
||||
return requestSettings.getEntity();
|
||||
}
|
||||
|
||||
public Target getTarget() {
|
||||
public Target getTargetSetting() {
|
||||
return requestSettings.getTarget();
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package com.gmail.artemis.the.gr8.playerstats.statistic.request;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.Main;
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.result.StatResult;
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.result.TopStatResult;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
@ -22,7 +21,7 @@ public final class TopStatRequest extends StatRequest<LinkedHashMap<String, Inte
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatRequest<LinkedHashMap<String, Integer>> untyped(@NotNull Statistic statistic) {
|
||||
public TopStatRequest untyped(@NotNull Statistic statistic) {
|
||||
RequestSettings completedRequest = requestHandler.untyped(statistic);
|
||||
return new TopStatRequest(completedRequest);
|
||||
}
|
||||
@ -40,7 +39,7 @@ public final class TopStatRequest extends StatRequest<LinkedHashMap<String, Inte
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatResult<LinkedHashMap<String, Integer>> execute() {
|
||||
public TopStatResult execute() {
|
||||
return getStatResult(super.requestSettings);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user