X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2Fquelaton%2FModifyPeerCommandImpl.java;h=35d6d571ed158ee99d6c086588306c1f7ed17cb5;hb=a79a4fd515bc8eaa50c7d551fc2f47c941b99c02;hp=189e2e2a0b3d6ac27026d99ab52409d121fc0fb4;hpb=a04b60f09eb2e6c4a7264db26789740ddb6e0637;p=jFCPlib.git diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ModifyPeerCommandImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/ModifyPeerCommandImpl.java index 189e2e2..35d6d57 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ModifyPeerCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ModifyPeerCommandImpl.java @@ -26,6 +26,7 @@ public class ModifyPeerCommandImpl implements ModifyPeerCommand { private final ConnectionSupplier connectionSupplier; private final AtomicReference nodeIdentifier = new AtomicReference<>(); private final AtomicReference enabled = new AtomicReference<>(); + private final AtomicReference allowLocalAddresses = new AtomicReference<>(); public ModifyPeerCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier) { this.threadPool = MoreExecutors.listeningDecorator(threadPool); @@ -45,6 +46,12 @@ public class ModifyPeerCommandImpl implements ModifyPeerCommand { } @Override + public ModifyPeerCommand allowLocalAddresses() { + allowLocalAddresses.set(true); + return this; + } + + @Override public Executable> byName(String name) { nodeIdentifier.set(name); return this::execute; @@ -69,6 +76,7 @@ public class ModifyPeerCommandImpl implements ModifyPeerCommand { private Optional executeSequence() throws IOException, ExecutionException, InterruptedException { ModifyPeer modifyPeer = new ModifyPeer(new RandomIdentifierGenerator().generate(), nodeIdentifier.get()); Optional.ofNullable(enabled.get()).ifPresent(enabled -> modifyPeer.setEnabled(enabled)); + Optional.ofNullable(allowLocalAddresses.get()).ifPresent(allowed -> modifyPeer.setAllowLocalAddresses(allowed)); try (ModifyPeerDialog modifyPeerDialog = new ModifyPeerDialog()) { return modifyPeerDialog.send(modifyPeer).get(); }