PlayerChatEvent.setFormat validation
This commit is contained in:
parent
f35b3e98f9
commit
e44bb33109
@ -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…
x
Reference in New Issue
Block a user