mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 14:33:09 +01:00
PlayerChatEvent.setFormat validation
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
f0f2768937
commit
845e8fbc2e
1 changed files with 9 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import java.util.IllegalFormatException;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
|
@ -80,6 +81,14 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
|||
* @param format String.Format compatible format string
|
||||
*/
|
||||
public void setFormat(final String format) {
|
||||
// Oh for a better way to do this!
|
||||
try {
|
||||
String.format(format, player, message);
|
||||
} catch (RuntimeException ex) {
|
||||
ex.fillInStackTrace();
|
||||
throw ex;
|
||||
}
|
||||
|
||||
this.format = format;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue