Skip to content

Commit

Permalink
Fixed issue with Placeholders displaying blank values
Browse files Browse the repository at this point in the history
Hopefully fixed permission exception
Bump dependency versions
  • Loading branch information
A5H73Y committed Dec 24, 2023
1 parent fad5276 commit e724bbb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<version>2.11.5</version>
<scope>provided</scope>
</dependency>
<!-- Bountiful API -->
Expand Down Expand Up @@ -138,7 +138,7 @@
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>9.5.0</version>
<version>9.8.0</version>
<scope>compile</scope>
</dependency>
<!-- Version Compare -->
Expand All @@ -152,7 +152,7 @@
<dependency>
<groupId>com.github.simplix-softworks</groupId>
<artifactId>simplixstorage</artifactId>
<version>3.2.6</version>
<version>3.2.7</version>
</dependency>
<!-- Update to remove known vulnerabilities -->
<dependency>
Expand Down Expand Up @@ -187,7 +187,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.12.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand All @@ -206,7 +206,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
Expand Down Expand Up @@ -280,7 +280,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<configuration>
<configLocation>src/main/resources/parkourCheckstyles.xml</configLocation>
<consoleOutput>true</consoleOutput>
Expand All @@ -291,7 +291,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.9.1</version>
<version>10.12.6</version>
</dependency>
</dependencies>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,11 +568,7 @@ private String getCheckpointHologramMessage(ParkourSession session, String cours
private String getOrRetrieveCache(Supplier<String> callback, String... keys) {
String key = generateCacheKey(keys);
// check if the key exists or its 'get' is about to expire.
if (!cache.containsKey(key) || cache.get(key).isEmpty()) {
cache.put(key, callback.get());
}

return cache.get(key).orElse(NO_TIME_RECORDED);
return cache.computeIfAbsent(key, k -> cache.createCacheValue(callback.get()));
}

private String getTimeValue(long milliseconds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public static File getPlayerParkourSessionFile(OfflinePlayer player, String cour
}

public static boolean hasParkourSessionConfig(OfflinePlayer player, String courseName) {
return getPlayerParkourSessionFile(player, courseName).exists();
File file = getPlayerParkourSessionFile(player, courseName);
return file.exists() && file.canWrite();
}

public static ParkourSessionConfig getConfig(OfflinePlayer player, String courseName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -78,7 +79,11 @@ public void put(K key, V value) {
this.cacheMap.put(key, this.createCacheValue(value));
}

protected CacheValue<V> createCacheValue(V value) {
public V computeIfAbsent(K key, Function<K, CacheValue<V>> boop) {
return this.cacheMap.computeIfAbsent(key, boop).getValue();
}

public CacheValue<V> createCacheValue(V value) {
LocalDateTime now = LocalDateTime.now();
return new CacheValue<>() {
@Override
Expand Down

0 comments on commit e724bbb

Please sign in to comment.