use correct type

This commit is contained in:
SirYwell 2022-08-03 20:42:32 +02:00
parent aeb4350ccb
commit 9207c1868f

View File

@ -32,7 +32,6 @@ import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import java.util.Collection; import java.util.Collection;
@ -40,6 +39,7 @@ import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -88,8 +88,8 @@ public class Grant extends Command {
Template.of("value", String.valueOf(uuids)) Template.of("value", String.valueOf(uuids))
); );
} else { } else {
final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0]; final UUID uuid = uuids.iterator().next();
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuid.getUuid()); PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (pp != null) { if (pp != null) {
try (final MetaDataAccess<Integer> access = pp.accessPersistentMetaData( try (final MetaDataAccess<Integer> access = pp.accessPersistentMetaData(
PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) { PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
@ -103,7 +103,7 @@ public class Grant extends Command {
} }
} }
} else { } else {
DBFunc.getPersistentMeta(uuid.getUuid(), new RunnableVal<>() { DBFunc.getPersistentMeta(uuid, new RunnableVal<>() {
@Override @Override
public void run(Map<String, byte[]> value) { public void run(Map<String, byte[]> value) {
final byte[] array = value.get("grantedPlots"); final byte[] array = value.get("grantedPlots");
@ -128,7 +128,7 @@ public class Grant extends Command {
boolean replace = array != null; boolean replace = array != null;
String key = "grantedPlots"; String key = "grantedPlots";
byte[] rawData = Ints.toByteArray(amount); byte[] rawData = Ints.toByteArray(amount);
DBFunc.addPersistentMeta(uuid.getUuid(), key, rawData, replace); DBFunc.addPersistentMeta(uuid, key, rawData, replace);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("grants.added"), TranslatableCaption.of("grants.added"),
Template.of("grants", String.valueOf(amount)) Template.of("grants", String.valueOf(amount))