NameChange
com.jsmacrosce.jsmacros.client.api.event.impl.world.EventNameChange
Fires when an entity's custom-name data changes. Cancelling prevents the update; otherwise,
listeners can replace newName, including setting it to null to clear the name.
Constructors
new EventNameChange
Wraps the entity and custom-name values for a name-change event; it does not apply the change or dispatch the event. Passing
null for entity causes a NullPointerException.Parameters:
entity: non-null entity to wrapoldName: previous raw custom-name component, ornullif none was setnewName: supplied raw custom-name component, ornullto clear the name
Fields
entity
Entity whose custom name is changing.
newName
newName: TextHelper#New custom name, or
null to clear it. A listener may replace the incoming value; cancellation prevents the update. Create replacement text with Chat.createTextHelperFromString(String).oldName
Previous custom name, or
null if none was set.Methods
toString
Returns a diagnostic string containing the event name and current name values. Each value is the corresponding helper's
getString() result, or the unquoted token null; newName therefore reflects its current, potentially listener-replaced value. This is not JSON serialization.Returns: a string in the form
eventName:{"oldName": oldValue, "newName": newValue}