Fixed #572 GP Data erasure (Removed calls & Added delays)

Addresses https://github.com/TechFortress/GriefPrevention/issues/279
This commit is contained in:
Rsl1122 2018-05-24 15:22:28 +03:00
parent efb3c6ef86
commit ecd56a1bf7
6 changed files with 28 additions and 24 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>
<artifactId>Plan</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
<build>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
@ -174,11 +174,11 @@
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
<exclusion>
<artifactId>asm-commons</artifactId>
<exclusion>
<artifactId>asm-commons</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
</exclusions>
@ -325,10 +325,10 @@
<artifactId>jsr305</artifactId>
<groupId>com.google.code.findbugs</groupId>
</exclusion>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>
<artifactId>Plan</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
<packaging>jar</packaging>
<repositories>
<repository>
@ -35,7 +35,7 @@
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>PlanPluginBridge</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</dependency>
<!-- Paper API -->
<dependency>

View File

@ -2,6 +2,9 @@ package com.djrapitops.plan.system.processing.processors.info;
import com.djrapitops.plan.system.info.InfoSystem;
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.task.RunnableFactory;
import java.util.UUID;
@ -15,8 +18,17 @@ public class PlayerPageUpdateProcessor implements Runnable {
@Override
public void run() {
WebExceptionLogger.logIfOccurs(this.getClass(),
() -> InfoSystem.getInstance().generateAndCachePlayerPage(uuid)
);
RunnableFactory.createNew("Generate Inspect page: " + uuid, new AbsRunnable() {
@Override
public void run() {
try {
WebExceptionLogger.logIfOccurs(PlayerPageUpdateProcessor.class,
() -> InfoSystem.getInstance().generateAndCachePlayerPage(uuid)
);
} finally {
cancel();
}
}
}).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 20);
}
}

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>
<artifactId>PlanPluginBridge</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
@ -75,7 +75,7 @@
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>Plan</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Paper API -->

View File

@ -13,7 +13,6 @@ import com.djrapitops.plan.utilities.analysis.MathUtils;
import com.djrapitops.plugin.utilities.FormatUtils;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.DataStore;
import me.ryanhamshire.GriefPrevention.PlayerData;
import java.util.*;
import java.util.stream.Collectors;
@ -43,15 +42,12 @@ public class GriefPreventionData extends PluginData {
claim -> FormatUtils.formatLocation(claim.getGreaterBoundaryCorner()),
Claim::getArea)
);
PlayerData data = dataStore.getPlayerData(uuid);
int blocks = data.getAccruedClaimBlocks() + data.getBonusClaimBlocks() + dataStore.getGroupBonusBlocks(uuid);
String softMuted = dataStore.isSoftMuted(uuid) ? "Yes" : "No";
long totalArea = MathUtils.sumLong(claims.values().stream().map(i -> (long) i));
inspectContainer.addValue(getWithIcon("SoftMuted", "bell-slash-o", "deep-orange"), softMuted);
inspectContainer.addValue(getWithIcon("Claims", "map-marker", "blue-grey"), claims.size());
inspectContainer.addValue(getWithIcon("Claimed Area", "map-o", "light-green"), totalArea);
inspectContainer.addValue(getWithIcon("Claim Blocks Available", "map-o", "light-green"), blocks);
TableContainer claimsTable = new TableContainer(getWithIcon("Claim", "map-marker"), getWithIcon("Area", "map-o"));
claimsTable.setColor("blue-grey");

View File

@ -13,7 +13,6 @@ import com.djrapitops.plan.utilities.analysis.MathUtils;
import com.djrapitops.plugin.utilities.FormatUtils;
import net.kaikk.mc.gpp.Claim;
import net.kaikk.mc.gpp.DataStore;
import net.kaikk.mc.gpp.PlayerData;
import java.util.*;
import java.util.stream.Collectors;
@ -43,13 +42,10 @@ public class GriefPreventionPlusData extends PluginData {
claim -> FormatUtils.formatLocation(claim.getGreaterBoundaryCorner()),
Claim::getArea)
);
PlayerData data = dataStore.getPlayerData(uuid);
int blocks = data.getAccruedClaimBlocks() + data.getBonusClaimBlocks();
long totalArea = MathUtils.sumLong(claims.values().stream().map(i -> (long) i));
inspectContainer.addValue(getWithIcon("Claims", "map-marker", "blue-grey"), claims.size());
inspectContainer.addValue(getWithIcon("Claimed Area", "map-o", "light-green"), totalArea);
inspectContainer.addValue(getWithIcon("Claim Blocks Available", "map-o", "light-green"), blocks);
TableContainer claimsTable = new TableContainer(getWithIcon("Claim", "map-marker"), getWithIcon("Area", "map-o"));
claimsTable.setColor("blue-grey");