mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
PlayerChatEvent.setFormat validation
This commit is contained in:
parent
f35b3e98f9
commit
e44bb33109
1 changed files with 9 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
package org.bukkit.event.player;
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
|
import java.util.IllegalFormatException;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
@ -80,6 +81,14 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||||
* @param format String.Format compatible format string
|
* @param format String.Format compatible format string
|
||||||
*/
|
*/
|
||||||
public void setFormat(final String format) {
|
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;
|
this.format = format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue