Skip to content

Commit

Permalink
Add optional parameter so specify private message sender name
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed May 3, 2024
1 parent 7f39b64 commit 846cbc0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/games/stendhal/server/entity/RPEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2705,6 +2705,32 @@ public void sendPrivateText(final NotificationType type, final String text) {
// does nothing in this implementation.
}

/**
* Sends a message that only this entity can read.
*
* @param sender
* Name of entity sending message.
* @param text
* Message contents.
*/
public void sendPrivateText(final String sender, final String text) {
// does nothing in this implementation.
}

/**
* Sends a message that only this entity can read.
*
* @param type
* NotificationType.
* @param sender
* Name of entity sending message.
* @param text
* Message contents.
*/
public void sendPrivateText(final NotificationType type, final String sender, final String text) {
// does nothing in this implementation.
}

/**
* Retrieves total ATK value of held weapons.
*/
Expand Down
35 changes: 34 additions & 1 deletion src/games/stendhal/server/entity/player/Player.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* $Id$ */
/***************************************************************************
* (C) Copyright 2003-2023 - Arianne *
* (C) Copyright 2003-2024 - Arianne *
***************************************************************************
***************************************************************************
* *
Expand Down Expand Up @@ -1032,6 +1032,39 @@ public void sendPrivateText(final NotificationType type, final String text) {
this.notifyWorldAboutChanges();
}

/**
* Sends a message that only this entity can read.
*
* @param sender
* Name of entity sending message.
* @param text
* Message contents.
*/
@Override
public void sendPrivateText(final String sender, final String text) {
sendPrivateText(getServerNotificationType(clientVersion), sender, text);
}

/**
* Sends a message that only this entity can read.
*
* @param type
* NotificationType.
* @param sender
* Name of entity sending message.
* @param text
* Message contents.
*/
@Override
public void sendPrivateText(final NotificationType type, final String sender, final String text) {
/*
RPEvent event = new PrivateTextEvent(type, sender, text);
this.addEvent(event);
this.notifyWorldAboutChanges();
*/
sendPrivateText(type, sender + " tells you: " + text);
}

/**
* Sets the name of the last player who privately talked to this player
* using the /tell command. It needs to be stored non-persistently so that
Expand Down

0 comments on commit 846cbc0

Please sign in to comment.