Skip to content

Commit

Permalink
Update to v2.6c
Browse files Browse the repository at this point in the history
  • Loading branch information
Efnilite committed Oct 14, 2021
1 parent af90623 commit e4700b0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>dev.efnilite</groupId>
<artifactId>WITP</artifactId>
<version>2.6b</version>
<version>2.6c</version>
<build>
<plugins>
<plugin>
Expand Down
32 changes: 22 additions & 10 deletions src/main/java/dev/efnilite/witp/generator/DefaultGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,37 @@ public void run() {
if (!stopwatch.hasStarted()) {
stopwatch.start();
}
// update scores
score++;
totalScore++;
score();
checkRewards();

latestLocation = current.getLocation();

new PlayerScoreEvent(player).call();
List<String> locations = new ArrayList<>(buildLog.keySet());
int lastIndex = locations.indexOf(last) + 1;
int size = locations.size();
for (int i = lastIndex; i < size; i++) {
Block block = Util.parseLocation(locations.get(i)).getBlock();
if (block.getType() != Material.AIR) {
if (Option.ALL_POINTS) {
if (score == 0) {
score++;
block.setType(Material.AIR);
totalScore++;
score();
checkRewards();
}
for (int i = lastIndex; i < size; i++) {
Block block = Util.parseLocation(locations.get(i)).getBlock();
if (block.getType() != Material.AIR) {
score++;
totalScore++;
score();
checkRewards();
block.setType(Material.AIR);
}
}
} else {
score++;
totalScore++;
score();
checkRewards();
}

new PlayerScoreEvent(player).call();
if (deleteStructure) {
deleteStructure();
}
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/dev/efnilite/witp/player/ParkourPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -365,21 +365,21 @@ public void menu() {
}

builder.setItem(18, WITP.getConfiguration().getFromItemData(locale, "options.gamemode"), (t2, e2) -> {
if (checkOptions("gamemode", "witp.gamemode")) {
if (alertCheckOptions("gamemode", "witp.gamemode")) {
gamemode();
}
});
Integer score = highScores.get(uuid);
builder.setItem(19, WITP.getConfiguration().getFromItemData(locale, "options.leaderboard",
getTranslated("your-rank", Integer.toString(getRank(uuid)),
Integer.toString(score == null ? 0 : score))), (t2, e2) -> {
if (checkOptions("leaderboard", "witp.leaderboard")) {
if (alertCheckOptions("leaderboard", "witp.leaderboard")) {
leaderboard(this, player, 1);
player.closeInventory();
}
});
builder.setItem(22, WITP.getConfiguration().getFromItemData(locale, "options.language", locale), (t2, e2) -> {
if (checkOptions("language", "witp.language")) {
if (alertCheckOptions("language", "witp.language")) {
List<String> langs = Option.LANGUAGES;
InventoryBuilder.DynamicInventory dynamic1 = new InventoryBuilder.DynamicInventory(langs.size(), 1);
for (String langName : langs) {
Expand Down Expand Up @@ -500,7 +500,7 @@ public void confirmReset(String item) {
return possibleStyles;
}

private boolean checkOptions(String option, @Nullable String perm) {
private boolean alertCheckOptions(String option, @Nullable String perm) {
boolean enabled = WITP.getConfiguration().getFile("items").getBoolean("items.options." + option + ".enabled");
if (!enabled) {
sendTranslated("cant-do");
Expand All @@ -510,6 +510,15 @@ private boolean checkOptions(String option, @Nullable String perm) {
}
}

private boolean checkOptions(String option, @Nullable String perm) {
boolean enabled = WITP.getConfiguration().getFile("items").getBoolean("items.options." + option + ".enabled");
if (!enabled) {
return false;
} else {
return checkPermission(perm);
}
}

private void saveStats() {
save(true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'WITP'
description: 'Automatically generating, infinitely long parkour plugin. The sky, and your time, is the limit. The further you go, the harder it gets. Should be a walk in the park, right?'
author: Efnilite, Ice_Pancake
version: 2.6b
version: 2.6c
api-version: 1.16
main: dev.efnilite.witp.WITP
softdepend: [Vault, PlaceholderAPI, ProtocolAPI, Multiverse-Core, WVoidGen, VoidGen]
Expand Down

0 comments on commit e4700b0

Please sign in to comment.