X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FFCPPluginReply.java;h=f9dbc7f6c1642900d6e861394d80ee08d4552b17;hb=4654ee7f03bd580815c1387b4da26eaa6ea3f367;hp=84faa540b2e66a07771d7cc6e863ff73cb6d536d;hpb=80d0435162508dc161adb7c0f8b7c2c644ef217c;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/FCPPluginReply.java b/src/net/pterodactylus/fcp/FCPPluginReply.java index 84faa54..f9dbc7f 100644 --- a/src/net/pterodactylus/fcp/FCPPluginReply.java +++ b/src/net/pterodactylus/fcp/FCPPluginReply.java @@ -20,6 +20,9 @@ package net.pterodactylus.fcp; import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; /** * The “FCPPluginReply” is sent by a plugin as a response to a @@ -85,6 +88,24 @@ public class FCPPluginReply extends BaseMessage { } /** + * Returns all replies from the plugin. The plugin sends replies as normal + * message fields prefixed by “Replies.”. The keys of the returned map do + * not contain this prefix! + * + * @return All replies from the plugin + */ + public Map getReplies() { + Map fields = getFields(); + Map replies = new HashMap(); + for (Entry field : fields.entrySet()) { + if (field.getKey().startsWith("Replies.")) { + replies.put(field.getKey().substring(8), field.getValue()); + } + } + return replies; + } + + /** * Returns the optional payload. * * @return The payload of the reply, or null if there is no