X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FLockSoneCommand.java;h=fbceb9a2bf755a2ecd70dc14e9e3f5267e8b37ed;hp=2a0c81a6f3e42e6b737386944d41076af0d70f1e;hb=438378deab1514f0f608d975ef65f5b7aea44ccb;hpb=f65328fb92d16e568b869bf5f2771dd4114d8abc diff --git a/src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java b/src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java index 2a0c81a..fbceb9a 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java @@ -1,5 +1,5 @@ /* - * Sone - LockSoneCommand.java - Copyright © 2013 David Roden + * Sone - LockSoneCommand.java - Copyright © 2013–2020 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,14 +23,13 @@ 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 “LockSone” FCP command. If a valid local Sone was given as * parameter “Sone,” this command will always lock the Sone and reply with * “SoneLocked.” - * - * @author David ‘Bombe’ Roden */ public class LockSoneCommand extends AbstractSoneCommand { @@ -49,10 +48,10 @@ public class LockSoneCommand extends AbstractSoneCommand { // @Override - public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { - Sone sone = getSone(parameters, "Sone", true, true); - getCore().lockSone(sone); - return new Response("SoneLocked", new SimpleFieldSetBuilder().put("Sone", sone.getId()).get()); + public Response execute(SimpleFieldSet parameters) throws FcpException { + Optional sone = getSone(parameters, "Sone", true, true); + getCore().lockSone(sone.get()); + return new Response("SoneLocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get()); } }