public interface NucleusPrivateMessagingService
| Modifier and Type | Method and Description |
|---|---|
boolean |
canSpyOn(org.spongepowered.api.entity.living.player.User spyingUser,
org.spongepowered.api.command.CommandSource... sourcesToSpyOn)
Returns whether the specified user can spy on all of the specified sources.
|
boolean |
canSpySameLevel()
If using social spy levels, this returns whether those on the same social spy level as the participants of a message can read a message.
|
<T extends org.spongepowered.api.command.CommandSource & org.spongepowered.api.util.Identifiable> |
clearCommandSourceReplyTo(T user)
Removes the
CommandSource that the specified CommandSource will reply to if /r is used. |
void |
clearConsoleReplyTo()
Removes the
CommandSource that the console will reply to if /r is used. |
void |
clearReplyTo(org.spongepowered.api.entity.living.player.User user)
Removes the
CommandSource that the specified User will reply to if /r is used. |
org.spongepowered.api.util.Tristate |
forcedSocialSpyState(org.spongepowered.api.entity.living.player.User user)
Returns whether the specified user can toggle social spy
Tristate.UNDEFINED, or whether they are forced to use social spy Tristate.TRUE, or do not have permission to do so Tristate.FALSE. |
<T extends org.spongepowered.api.command.CommandSource & org.spongepowered.api.util.Identifiable> |
getCommandSourceReplyTo(T from)
Gets the
CommandSource that the specified T will reply to if /r is used, if any. |
java.util.Optional<org.spongepowered.api.command.CommandSource> |
getConsoleReplyTo()
Gets the
CommandSource that the console will reply to if /r is used, if any. |
int |
getCustomTargetLevel()
Gets the social spy level for any message targets registered using
registerMessageTarget(UUID, String, Text, Supplier). |
java.util.Optional<org.spongepowered.api.command.CommandSource> |
getReplyTo(org.spongepowered.api.entity.living.player.User from)
Gets the
CommandSource that the specified User will reply to if /r is used, if any. |
int |
getServerLevel()
Gets the social spy level the server is assigned.
|
int |
getSocialSpyLevel(org.spongepowered.api.entity.living.player.User user)
Gets the social spy level the user is assigned.
|
boolean |
isSocialSpy(org.spongepowered.api.entity.living.player.User user)
Returns whether the user is able to see all private messages sent on the server.
|
boolean |
isUsingSocialSpyLevels()
Returns whether the server is using social spy levels.
|
java.util.Set<org.spongepowered.api.command.CommandSource> |
onlinePlayersCanSpyOn(boolean includeConsole,
org.spongepowered.api.command.CommandSource... sourcesToSpyOn)
Returns the
CommandSources that are online and can spy on all of the specified sources. |
<T extends org.spongepowered.api.command.CommandSource & org.spongepowered.api.util.Identifiable> |
registerMessageTarget(java.util.UUID uniqueId,
java.lang.String targetName,
org.spongepowered.api.text.Text displayName,
java.util.function.Supplier<T> target)
Registers a message target.
|
boolean |
sendMessage(org.spongepowered.api.command.CommandSource sender,
org.spongepowered.api.command.CommandSource receiver,
java.lang.String message)
Sends a message as the sender to the receiver.
|
<T extends org.spongepowered.api.command.CommandSource & org.spongepowered.api.util.Identifiable> |
setCommandSourceReplyTo(T source,
org.spongepowered.api.command.CommandSource replyTo)
Sets the
CommandSource that the specified CommandSource will reply to if /r is used. |
void |
setConsoleReplyTo(org.spongepowered.api.command.CommandSource toReplyTo)
Sets the
CommandSource that the console will reply to if /r is used. |
void |
setReplyTo(org.spongepowered.api.entity.living.player.User user,
org.spongepowered.api.command.CommandSource toReplyTo)
Sets the
CommandSource that the specified User will reply to if /r is used. |
boolean |
setSocialSpy(org.spongepowered.api.entity.living.player.User user,
boolean isSocialSpy)
Sets whether the user is able to see all private messages on the server.
|
boolean isSocialSpy(org.spongepowered.api.entity.living.player.User user)
user - The User to check.true if the user has Social Spy enabled.boolean isUsingSocialSpyLevels()
true if so.boolean canSpySameLevel()
In the following scenarios, Alice has a social spy level of 5, and Bob a social spy level of 10.
If this method returns true, and Alice sends a message to Bob, Eve must have a level of 10 or above, to see the message. If
Eve has a level of 9 or below, then because Bob's level is higher than hers, she cannot see the message.
If this method returns false, and Alice sends a message to Bob, Eve must have a level of 11 or above, to see
the message. If Eve has a level of 10 or below, then because Bob's level is the same than hers, she cannot see
the message.
int getCustomTargetLevel()
registerMessageTarget(UUID, String, Text, Supplier).int getServerLevel()
Integer.MAX_VALUE, or zero if levels aren't
enabled.int getSocialSpyLevel(org.spongepowered.api.entity.living.player.User user)
user - The user to check.org.spongepowered.api.util.Tristate forcedSocialSpyState(org.spongepowered.api.entity.living.player.User user)
Tristate.UNDEFINED, or whether they are forced to use social spy Tristate.TRUE, or do not have permission to do so Tristate.FALSE.user - The use to check.Tristate that indicates what state the user might be forced into.boolean setSocialSpy(org.spongepowered.api.entity.living.player.User user,
boolean isSocialSpy)
user - The UserisSocialSpy - true to turn Social Spy on, false otherwise.true if the change was fulfilled, false if the user does not have permissionboolean canSpyOn(org.spongepowered.api.entity.living.player.User spyingUser,
org.spongepowered.api.command.CommandSource... sourcesToSpyOn)
throws java.lang.IllegalArgumentException
This will return false if the spying user is also in the list of users to spy on.
spyingUser - The user that will be spying.sourcesToSpyOn - The CommandSources to spy upon.true if the user can spy on all the users.java.lang.IllegalArgumentException - thrown if no CommandSources are supplied.java.util.Set<org.spongepowered.api.command.CommandSource> onlinePlayersCanSpyOn(boolean includeConsole,
org.spongepowered.api.command.CommandSource... sourcesToSpyOn)
throws java.lang.IllegalArgumentException
CommandSources that are online and can spy on all of the specified sources.
This will not return players in the list of users to spy on.
includeConsole - Whether to include the console in the returned Set.sourcesToSpyOn - The CommandSources to spy upon.Set of CommandSources that can spy upon the specified users.java.lang.IllegalArgumentException - thrown if no CommandSources are supplied.boolean sendMessage(org.spongepowered.api.command.CommandSource sender,
org.spongepowered.api.command.CommandSource receiver,
java.lang.String message)
sender - The sender.receiver - The reciever.message - The message to send.true if the message was sent, false otherwise.java.util.Optional<org.spongepowered.api.command.CommandSource> getConsoleReplyTo()
CommandSource that the console will reply to if /r is used, if any.CommandSource.java.util.Optional<org.spongepowered.api.command.CommandSource> getReplyTo(org.spongepowered.api.entity.living.player.User from)
CommandSource that the specified User will reply to if /r is used, if any.from - The User to inspect.CommandSource.<T extends org.spongepowered.api.command.CommandSource & org.spongepowered.api.util.Identifiable> java.util.Optional<org.spongepowered.api.command.CommandSource> getCommandSourceReplyTo(T from)
CommandSource that the specified T will reply to if /r is used, if any.T - The Identifiable CommandSource type.from - The T to inspect.CommandSource.void setReplyTo(org.spongepowered.api.entity.living.player.User user,
org.spongepowered.api.command.CommandSource toReplyTo)
CommandSource that the specified User will reply to if /r is used.user - The User to modify.toReplyTo - The CommandSource.void setConsoleReplyTo(org.spongepowered.api.command.CommandSource toReplyTo)
CommandSource that the console will reply to if /r is used.toReplyTo - The CommandSource.<T extends org.spongepowered.api.command.CommandSource & org.spongepowered.api.util.Identifiable> void setCommandSourceReplyTo(T source,
org.spongepowered.api.command.CommandSource replyTo)
CommandSource that the specified CommandSource will reply to if /r is used.
If the CommandSource in both cases isn't a normal target or isn't registered, this will fail silently.
T - The Identifiable CommandSource type.source - The T to modify.replyTo - The CommandSource to now reply to.void clearReplyTo(org.spongepowered.api.entity.living.player.User user)
CommandSource that the specified User will reply to if /r is used.user - The User to modify.<T extends org.spongepowered.api.command.CommandSource & org.spongepowered.api.util.Identifiable> void clearCommandSourceReplyTo(T user)
CommandSource that the specified CommandSource will reply to if /r is used.T - The Identifiable CommandSource type.user - The User to modify.void clearConsoleReplyTo()
CommandSource that the console will reply to if /r is used.<T extends org.spongepowered.api.command.CommandSource & org.spongepowered.api.util.Identifiable> void registerMessageTarget(java.util.UUID uniqueId,
java.lang.String targetName,
@Nullable
org.spongepowered.api.text.Text displayName,
java.util.function.Supplier<T> target)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.IllegalStateException
A message target is, perhaps unsurprisingly, a valid target for messaging. Players can message this target using
/m <targetName> [message]
Message targets cannot be ignored. They are mostly intended for bot use.
T - The type that implements both CommandSource and Identifiable.uniqueId - The UUID of the target.targetName - The name of the target in commands.displayName - The display name of the target. If null, CommandSource.getName() is used.target - A Supplier of the message target, which must implement both CommandSource and Identifiable.java.lang.NullPointerException - thrown if any non Nullable parameter is null.java.lang.IllegalArgumentException - thrown if the UUID is the zero UUID.java.lang.IllegalStateException - thrown if the UUID has already been registered.