Fix plot grant

This commit is contained in:
dordsor21 2020-09-20 19:42:13 +01:00
parent 8547533210
commit ff83931a3f
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -36,6 +36,7 @@ import com.plotsquared.core.util.Permissions;
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 java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -76,8 +77,8 @@ public class Grant extends Command {
} else if (throwable != null || uuids.size() != 1) { } else if (throwable != null || uuids.size() != 1) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER); MainUtil.sendMessage(player, Captions.INVALID_PLAYER);
} else { } else {
final UUID uuid = uuids.toArray(new UUID[0])[0]; final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0];
MainUtil.getPersistentMeta(uuid, MainUtil.getPersistentMeta(uuid.getUuid(),
"grantedPlots", new RunnableVal<byte[]>() { "grantedPlots", new RunnableVal<byte[]>() {
@Override public void run(byte[] array) { @Override public void run(byte[] array) {
if (arg0.equals("check")) { // check if (arg0.equals("check")) { // check
@ -99,11 +100,11 @@ public class Grant extends Command {
String key = "grantedPlots"; String key = "grantedPlots";
byte[] rawData = Ints.toByteArray(amount); byte[] rawData = Ints.toByteArray(amount);
PlotPlayer online = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); PlotPlayer online = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid.getUuid());
if (online != null) { if (online != null) {
online.setPersistentMeta(key, rawData); online.setPersistentMeta(key, rawData);
} else { } else {
DBFunc.addPersistentMeta(uuid, key, rawData, replace); DBFunc.addPersistentMeta(uuid.getUuid(), key, rawData, replace);
} }
} }
} }