Skip to content

Commit

Permalink
fix: use correct uuid type in /grant (#3759)
Browse files Browse the repository at this point in the history
use correct type
  • Loading branch information
SirYwell committed Aug 7, 2022
1 parent 0bdeeea commit e0eff15
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Core/src/main/java/com/plotsquared/core/command/Grant.java
Expand Up @@ -32,14 +32,14 @@
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template;

import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -88,8 +88,8 @@ public CompletableFuture<Boolean> execute(
Template.of("value", String.valueOf(uuids))
);
} else {
final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0];
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuid.getUuid());
final UUID uuid = uuids.iterator().next();
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (pp != null) {
try (final MetaDataAccess<Integer> access = pp.accessPersistentMetaData(
PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
Expand All @@ -103,7 +103,7 @@ public CompletableFuture<Boolean> execute(
}
}
} else {
DBFunc.getPersistentMeta(uuid.getUuid(), new RunnableVal<>() {
DBFunc.getPersistentMeta(uuid, new RunnableVal<>() {
@Override
public void run(Map<String, byte[]> value) {
final byte[] array = value.get("grantedPlots");
Expand All @@ -128,7 +128,7 @@ public void run(Map<String, byte[]> value) {
boolean replace = array != null;
String key = "grantedPlots";
byte[] rawData = Ints.toByteArray(amount);
DBFunc.addPersistentMeta(uuid.getUuid(), key, rawData, replace);
DBFunc.addPersistentMeta(uuid, key, rawData, replace);
player.sendMessage(
TranslatableCaption.of("grants.added"),
Template.of("grants", String.valueOf(amount))
Expand Down

0 comments on commit e0eff15

Please sign in to comment.