Record Class CommandLogger
-
Constructor Summary
ConstructorDescriptionCommandLogger
(Command command, CommandSender sender, String commandLabel, String[] args) CommandLogger
(Command command, CommandSender sender, String commandLabel, String[] args, CommandOutputContainer outputContainer) CommandLogger
(Command command, CommandSender sender, String commandLabel, String[] args, CommandOutputContainer outputContainer, Plugin plugin) Creates an instance of aCommandLogger
record class.CommandLogger
(Command command, CommandSender sender, String commandLabel, String[] args, Plugin plugin) -
Method Summary
Modifier and TypeMethodDescriptionaddDoubleTooBig
(int errorIndex, double maximum) 添加一条Double参数过大的错误信息,会提示命令发送者指定位置的参数最大值不能超过maximumaddDoubleTooSmall
(int errorIndex, double minimum) 添加一条Double参数过小的错误信息,会提示命令发送者指定位置的参数最小值不能低于minimum添加一条命令错误执行的消息,参数可以是纯文本,也可以是客戶端的多语言文本key.
默认输出颜色红色添加一条命令执行失败的错误消息,参数可以是纯文本,也可以是客戶端的多语言文本key.
默认输出颜色红色addMessage
(String key) 添加一条消息,参数可以是纯文本,也可以是客户端,服务端,以及PluginI18n
中的多语言文本,默认输出颜色红色addMessage
(String key, String... params) 添加一条消息,参数可以是纯文本,也可以是客户端,服务端,以及PluginI18n
中的多语言文本,默认输出颜色红色添加一条目标选择器没有匹配目标的错误信息addNumTooSmall
(int errorIndex, int minimum) 添加一条参数过小的错误信息,会提示命令发送者指定位置的参数最小值不能低于minimum添加一条无法访问世界外的方块的错误信息addSuccess
(String message) addSuccess
(String key, String... params) 添加一条命令成功执行的消息,参数可以是纯文本,也可以是客戶端的多语言文本key.
默认输出颜色白色addSuccess
(String key, List<String> params) addSyntaxErrors
(int errorIndex) 添加一条默认的命令格式错误信息,会提示命令发送者在指定索引处发生错误添加一条目标选择器匹配目标过多的错误信息String[]
args()
Returns the value of theargs
record component.command()
Returns the value of thecommand
record component.Returns the value of thecommandLabel
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.void
output()
输出outputContainer
中的所有信息.void
output
(boolean broadcast) 输出outputContainer
中的所有信息.Returns the value of theoutputContainer
record component.void
outputObjectWhisper
(Player receiver, String rawtext, Object... params) 输出给指定目标一条反馈信息void
outputObjectWhisper
(Player receiver, String key, String... params) 输出给指定目标一条反馈信息plugin()
Returns the value of theplugin
record component.sender()
Returns the value of thesender
record component.successCount
(int successCount) 标记outputContainer
的成功数量final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
CommandLogger
-
CommandLogger
public CommandLogger(Command command, CommandSender sender, String commandLabel, String[] args, CommandOutputContainer outputContainer) -
CommandLogger
public CommandLogger(Command command, CommandSender sender, String commandLabel, String[] args, Plugin plugin) -
CommandLogger
public CommandLogger(Command command, CommandSender sender, String commandLabel, String[] args, CommandOutputContainer outputContainer, Plugin plugin) Creates an instance of aCommandLogger
record class.- Parameters:
command
- the value for thecommand
record componentsender
- the value for thesender
record componentcommandLabel
- the value for thecommandLabel
record componentargs
- the value for theargs
record componentoutputContainer
- the value for theoutputContainer
record componentplugin
- the value for theplugin
record component
-
-
Method Details
-
addSuccess
-
addSuccess
-
addSuccess
添加一条命令成功执行的消息,参数可以是纯文本,也可以是客戶端的多语言文本key.
默认输出颜色白色Add a message that the command was successfully executed, the parameters can be plain text or the client's multilingual text key.
Default output color white- Parameters:
key
- the keyparams
- the params
-
addError
添加一条命令错误执行的消息,参数可以是纯文本,也可以是客戶端的多语言文本key.
默认输出颜色红色Add a command error message, either plain text or the client's multilingual text key.
Default output color red- Parameters:
message
- the message- Returns:
- the command logger
-
addError
添加一条命令执行失败的错误消息,参数可以是纯文本,也可以是客戶端的多语言文本key.
默认输出颜色红色Add a command execution failure error message, either plain text or the client's multilingual text key.
Default output color red- Parameters:
key
- 语言文本key/错误信息params
- 语言文本参数/空- Returns:
- the command logger
-
addMessage
添加一条消息,参数可以是纯文本,也可以是客户端,服务端,以及PluginI18n
中的多语言文本,默认输出颜色红色Add a message, the parameters can be plain text, or client-side, server-side, and multilingual text in
PluginI18n
, default output color red- Parameters:
key
- the key- Returns:
- the command logger
-
addMessage
添加一条消息,参数可以是纯文本,也可以是客户端,服务端,以及PluginI18n
中的多语言文本,默认输出颜色红色Add a message, the parameters can be plain text, or client-side, server-side, and multilingual text in
PluginI18n
, default output color red- Parameters:
key
- the keyparams
- the params- Returns:
- the command logger
-
addSyntaxErrors
添加一条默认的命令格式错误信息,会提示命令发送者在指定索引处发生错误Add a default command format error message that will alert the command sender of an error at the specified index
- Parameters:
errorIndex
- 发生错误的参数索引
-
addNoTargetMatch
添加一条目标选择器没有匹配目标的错误信息Add an error message that the target selector matches too many targets
-
addTooManyTargets
添加一条目标选择器匹配目标过多的错误信息 -
addNumTooSmall
添加一条参数过小的错误信息,会提示命令发送者指定位置的参数最小值不能低于minimumAdd an error message that the parameter is too small, prompting the command sender to specify a location where the minimum value of the parameter cannot be less than minimum
- Parameters:
errorIndex
- 发生错误的参数索引minimum
- 允许的最小值
-
addDoubleTooBig
添加一条Double参数过大的错误信息,会提示命令发送者指定位置的参数最大值不能超过maximumAdd a Double parameter too large error message, which will prompt the command sender to specify that the maximum value of the parameter at the location cannot exceed maximum
- Parameters:
errorIndex
- 发生错误的参数索引maximum
- 允许的最大值
-
addDoubleTooSmall
添加一条Double参数过小的错误信息,会提示命令发送者指定位置的参数最小值不能低于minimumAdd a Double parameter is too small error message, which will prompt the command sender to specify the minimum value of the parameter at the location cannot be less than minimum
- Parameters:
errorIndex
- 发生错误的参数索引minimum
- 允许的最小值
-
addOutOfWorld
添加一条无法访问世界外的方块的错误信息Add an error message about not being able to access squares outside the world
- Returns:
- the command logger
-
output
public void output()输出outputContainer
中的所有信息. -
output
public void output(boolean broadcast) 输出outputContainer
中的所有信息.- Parameters:
broadcast
- the broadcast
-
successCount
标记outputContainer
的成功数量- Parameters:
successCount
- the success count- Returns:
- the command logger
-
outputObjectWhisper
输出给指定目标一条反馈信息Output a feedback message to the specified receiver
- Parameters:
receiver
- 命令目标key
- the keyparams
- 给命令目标的反馈信息参数
-
outputObjectWhisper
输出给指定目标一条反馈信息Output a feedback message to the specified receiver
- Parameters:
rawtext
- 给命令目标的反馈信息receiver
- 命令目标params
- 给命令目标的反馈信息参数
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
command
Returns the value of thecommand
record component.- Returns:
- the value of the
command
record component
-
sender
Returns the value of thesender
record component.- Returns:
- the value of the
sender
record component
-
commandLabel
Returns the value of thecommandLabel
record component.- Returns:
- the value of the
commandLabel
record component
-
args
Returns the value of theargs
record component.- Returns:
- the value of the
args
record component
-
outputContainer
Returns the value of theoutputContainer
record component.- Returns:
- the value of the
outputContainer
record component
-
plugin
Returns the value of theplugin
record component.- Returns:
- the value of the
plugin
record component
-