X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2Fmemory%2FMemoryPost.java;h=451b6b50c04517c3ca3c21d62c12732737a6a8f2;hp=acf23741a0f3efc98ec379246b5fc5973af12a80;hb=438378deab1514f0f608d975ef65f5b7aea44ccb;hpb=c4ae226ec5052116cefc542ae2017036a7bc6332 diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java index acf2374..451b6b5 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java @@ -1,5 +1,5 @@ /* - * Sone - MemoryPost.java - Copyright © 2010–2016 David Roden + * Sone - MemoryPost.java - Copyright © 2010–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 @@ -17,6 +17,8 @@ package net.pterodactylus.sone.database.memory; +import static com.google.common.base.Optional.fromNullable; + import java.util.UUID; import net.pterodactylus.sone.data.Post; @@ -28,8 +30,6 @@ import com.google.common.base.Optional; /** * A post is a short message that a user writes in his Sone to let other users * know what is going on. - * - * @author David ‘Bombe’ Roden */ class MemoryPost implements Post { @@ -104,7 +104,7 @@ class MemoryPost implements Post { */ @Override public Sone getSone() { - return soneProvider.getSone(soneId).get(); + return soneProvider.getSone(soneId); } /** @@ -112,7 +112,7 @@ class MemoryPost implements Post { */ @Override public Optional getRecipientId() { - return Optional.fromNullable(recipientId); + return fromNullable(recipientId); } /** @@ -120,7 +120,7 @@ class MemoryPost implements Post { */ @Override public Optional getRecipient() { - return soneProvider.getSone(recipientId); + return recipientId == null ? Optional.absent() : fromNullable(soneProvider.getSone(recipientId)); } /**