X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FUnlockSoneCommand.java;h=dc6058d3251ae0d399c1698c4358f249f3dbaca3;hb=30ef483c663ded175b66b50b652a0497e04bd493;hp=a18757652f10025896bbb2e84ea1ff940fdd1f24;hpb=5511ae2f1e50fa19f73edecd028a19bec376a3e2;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java b/src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java index a187576..dc6058d 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java @@ -18,13 +18,15 @@ package net.pterodactylus.sone.fcp; import net.pterodactylus.sone.core.Core; -import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.data.LocalSone; import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder; import net.pterodactylus.sone.freenet.fcp.FcpException; import freenet.support.SimpleFieldSet; import freenet.support.api.Bucket; +import com.google.common.base.Optional; + /** * Implements the “UnlockSone” FCP command. If a valid local Sone was given as * parameter “Sone,” this command will always unlock the Sone and reply with @@ -50,9 +52,9 @@ public class UnlockSoneCommand extends AbstractSoneCommand { @Override public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { - Sone sone = getSone(parameters, "Sone", true, true); - getCore().unlockSone(sone); - return new Response("SoneUnlocked", new SimpleFieldSetBuilder().put("Sone", sone.getId()).get()); + Optional sone = getLocalSone(parameters, "Sone", true); + getCore().unlockSone(sone.get()); + return new Response("SoneUnlocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get()); } }