mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-28 03:19:12 +00:00
Fix some bugs
This commit is contained in:
@@ -137,7 +137,7 @@ public class Competition implements FishingCompetition {
|
||||
while (iterator.hasNext()) {
|
||||
Pair<String, Double> competitionPlayer = iterator.next();
|
||||
this.publicContext.arg(ContextKeys.of(i + "_player", String.class), competitionPlayer.left());
|
||||
this.publicContext.arg(ContextKeys.of(i + "_score", String.class), String.format("%.2f", competitionPlayer.right()));
|
||||
this.publicContext.arg(ContextKeys.of(i + "_score", String.class), String.format("%.2f", goal.isReversed() ? -competitionPlayer.right() : competitionPlayer.right()));
|
||||
if (i < rewardsMap.size()) {
|
||||
Player player = Bukkit.getPlayer(competitionPlayer.left());
|
||||
if (player != null) {
|
||||
@@ -187,7 +187,7 @@ public class Competition implements FishingCompetition {
|
||||
Optional<String> player = Optional.ofNullable(this.rankingProvider.getPlayerAt(i));
|
||||
if (player.isPresent()) {
|
||||
this.publicContext.arg(ContextKeys.of(i + "_player", String.class), player.get());
|
||||
this.publicContext.arg(ContextKeys.of(i + "_score", String.class), String.format("%.2f", this.rankingProvider.getScoreAt(i)));
|
||||
this.publicContext.arg(ContextKeys.of(i + "_score", String.class), String.format("%.2f", goal.isReversed() ? -this.rankingProvider.getScoreAt(i) : this.rankingProvider.getScoreAt(i)));
|
||||
} else {
|
||||
this.publicContext.arg(ContextKeys.of(i + "_player", String.class), TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_PLAYER.build().key()));
|
||||
this.publicContext.arg(ContextKeys.of(i + "_score", String.class), TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_SCORE.build().key()));
|
||||
|
||||
@@ -65,8 +65,8 @@ public class ActionBarSender {
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
private void updatePrivatePlaceholders() {
|
||||
double score = competition.getRanking().getPlayerScore(player.getName());
|
||||
this.privateContext.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", score));
|
||||
this.privateContext.arg(ContextKeys.SCORE, score);
|
||||
this.privateContext.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", competition.getGoal().isReversed() ? -score : score));
|
||||
this.privateContext.arg(ContextKeys.SCORE, competition.getGoal().isReversed() ? -score : score);
|
||||
int rank = competition.getRanking().getPlayerRank(player.getName());
|
||||
this.privateContext.arg(ContextKeys.RANK, rank != -1 ? String.valueOf(rank) : TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_RANK.build().key()));
|
||||
this.privateContext.combine(competition.getPublicContext());
|
||||
|
||||
@@ -75,8 +75,8 @@ public class BossBarSender {
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
private void updatePrivatePlaceholders() {
|
||||
double score = competition.getRanking().getPlayerScore(player.getName());
|
||||
this.privateContext.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", score));
|
||||
this.privateContext.arg(ContextKeys.SCORE, score);
|
||||
this.privateContext.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", competition.getGoal().isReversed() ? -score : score));
|
||||
this.privateContext.arg(ContextKeys.SCORE, competition.getGoal().isReversed() ? -score : score);
|
||||
int rank = competition.getRanking().getPlayerRank(player.getName());
|
||||
this.privateContext.arg(ContextKeys.RANK, rank != -1 ? String.valueOf(rank) : TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_RANK.build().key()));
|
||||
this.privateContext.combine(competition.getPublicContext());
|
||||
|
||||
@@ -249,6 +249,11 @@ public class BukkitFishingManager implements FishingManager, Listener {
|
||||
PersistentDataType.STRING
|
||||
) != null) {
|
||||
event.setCancelled(true);
|
||||
Optional<GamingPlayer> gamingPlayer = hook.get().getGamingPlayer();
|
||||
if (gamingPlayer.isPresent()) {
|
||||
((AbstractGamingPlayer) gamingPlayer.get()).internalRightClick();
|
||||
return;
|
||||
}
|
||||
hook.get().onReelIn();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user