Skip to content

Commit 4904447

Browse files
authored
Merge pull request #11 from JavaJava19/develop
Develop
2 parents e1d030d + 68a0427 commit 4904447

File tree

5 files changed

+35
-12
lines changed

5 files changed

+35
-12
lines changed

src/main/java/com/github/elic0de/thejpspit/command/PitCommand.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
import co.aikar.commands.BaseCommand;
44
import co.aikar.commands.annotation.CommandAlias;
55
import co.aikar.commands.annotation.CommandPermission;
6+
import co.aikar.commands.annotation.Optional;
67
import co.aikar.commands.annotation.Subcommand;
8+
import co.aikar.commands.bukkit.contexts.OnlinePlayer;
79
import com.github.elic0de.thejpspit.TheJpsPit;
810
import com.github.elic0de.thejpspit.player.PitPlayer;
911
import com.github.elic0de.thejpspit.player.PitPlayerManager;
@@ -16,10 +18,15 @@ public class PitCommand extends BaseCommand {
1618

1719
@Subcommand("data")
1820
@CommandPermission("tjp.data")
19-
public void onCommand(Player player) {
21+
public void onCommand(Player player, @Optional OnlinePlayer onlinePlayer) {
2022
final PitPlayer pitPlayer = PitPlayerManager.getPitPlayer(player);
2123

22-
pitPlayer.sendStatus();
24+
if (onlinePlayer == null) {
25+
pitPlayer.sendStatus();
26+
return;
27+
}
28+
29+
pitPlayer.sendStatus(PitPlayerManager.getPitPlayer(onlinePlayer.getPlayer()));
2330
}
2431

2532
@Subcommand("reset")

src/main/java/com/github/elic0de/thejpspit/database/SqLiteDatabase.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,12 @@ public CompletableFuture<Optional<Integer>> getPlayerRanking(PitPlayer player, R
201201
try {
202202
try (PreparedStatement statement = getConnection().prepareStatement(
203203
formatStatementTables("""
204-
SELECT RANK() OVER(ORDER BY ? DESC)
205-
AS rank
206-
FROM `%players_table%`
207-
WHERE `uuid`=?"""))) {
204+
SELECT uuid, rank
205+
FROM(SELECT `uuid`,
206+
RANK()
207+
OVER(ORDER BY ? DESC)
208+
AS rank FROM `%players_table%`)
209+
WHERE uuid=?;"""))) {
208210

209211
statement.setString(1, type.name().toLowerCase(Locale.ROOT));
210212
statement.setString(2, player.getUniqueId().toString());

src/main/java/com/github/elic0de/thejpspit/player/PitPlayer.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,30 @@ public void sendMessage(String message) {
108108
}
109109

110110
public void sendStatus() {
111+
sendStatus(this);
112+
}
113+
114+
public void sendStatus(PitPlayer player) {
111115
final TheJpsPit pit = TheJpsPit.getInstance();
112116
Stream.of(
113117
"+ -----< %playerName% >----- +",
114118
"Kills >> &e%kills% (#%kills_ranking%)",
119+
"Best Kill Streaks >> &e%best_streaks%",
115120
"Deaths >> &c%deaths% (#%deaths_ranking%)",
116-
"Rating >> &a%rating% (#%rating_ranking%)"
121+
"Rating >> &a%rating% (#%rating_ranking%)",
122+
"Best Rating >> &e%best_rating%"
117123
).map(s ->
118124
s.replaceAll("%playerName%", getName())
119125
.replaceAll("%kills%",
120126
kills + "")
127+
.replaceAll("%best_streaks%",
128+
bestStreaks + "")
121129
.replaceAll("%deaths%",
122130
deaths + "")
123131
.replaceAll("%rating%",
124132
rating + "%")
133+
.replaceAll("%best_rating%",
134+
bestRating + "")
125135
.replaceAll("%kills_ranking%",
126136
pit.getDatabase().getPlayerRanking(this, Database.RankType.KILLS).join()
127137
.orElse(0)
@@ -134,7 +144,7 @@ public void sendStatus() {
134144
pit.getDatabase().getPlayerRanking(this, Database.RankType.RATING).join()
135145
.orElse(0)
136146
+ "")
137-
).forEach(this::sendMessage);
147+
).forEach(player::sendMessage);
138148
}
139149

140150
private void updateXpBar() {
@@ -224,7 +234,7 @@ public void increaseXP() {
224234

225235
public void increaseHealth() {
226236
player.setHealth(Math.min(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(),
227-
player.getHealth() + 4));
237+
player.getHealth() + 2));
228238
}
229239

230240
public void resetStreaks() {

src/main/java/com/github/elic0de/thejpspit/scoreboard/GameScoreboard.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.elic0de.thejpspit.scoreboard;
22

3+
import com.github.elic0de.thejpspit.TheJpsPit;
34
import com.github.elic0de.thejpspit.leveler.Levels;
45
import com.github.elic0de.thejpspit.player.PitPlayer;
56
import com.github.elic0de.thejpspit.player.PitPlayerManager;
@@ -24,10 +25,12 @@ public List<String> boardLines(PitPlayer player) {
2425

2526
return Stream.of(
2627
"",
27-
"レベル:[%level%]",
28-
"最高レート: &b%bestRating%",
28+
"レベル: [%level%]",
29+
"JP: [%coins%]",
2930
"",
3031
"K/Dレート: &c%rating%",
32+
"最高レート: &b%bestRating%",
33+
"",
3134
"次のレベルまで:&a%neededXp%",
3235
"",
3336
"連続キル数: &a%streaks%",
@@ -41,6 +44,7 @@ public List<String> boardLines(PitPlayer player) {
4144
.replaceAll("%bestRating%", player.getBestRating() + "%")
4245
.replaceAll("%streaks%", player.getStreaks() + "")
4346
.replaceAll("%bestStreaks%", player.getBestStreaks() + "")
47+
.replaceAll("%coins%", "0")
4448
).collect(Collectors.toList());
4549
}
4650

src/main/java/com/github/elic0de/thejpspit/task/GameTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public GameTask() {
2020
public void run() {
2121
pit.getGame().getScoreboard().update();
2222
repeats.getAndIncrement();
23-
if (repeats.get() >= 10) {
23+
if (repeats.get() >= 5) {
2424
pit.getGame().getPitPlayers().forEach(PitPlayer::increaseHealth);
2525
repeats.set(0);
2626
}

0 commit comments

Comments
 (0)