StringUtils
基本信息
| 属性 | 值 |
|---|---|
| 类名 | myessentials.utils.StringUtils |
| 用途 | 安全的类型解析 |
| public 方法 | 3 |
| 启用版本 | Minecraft 1.7.10 |
功能
把字符串安全地解析为 int / float / boolean。
实现要点
tryParseInt、tryParseFloat、tryParseBoolean- 三者不抛异常,解析失败时返回默认值/零值
- 是 ConfigTemplate 读取配置值的容错基础
- 与 FormatException 配套—— 本类用「返回默认值」而非抛异常的方式规避格式错误
utils包共 11 个类(10 个工具类 + 本类 DelayedThread)。- 全部为静态工具方法,不注册任何游戏内容。
相关条目
- PlayerUtils - 同包,玩家相关
- WorldUtils - 同包,世界相关
- EntityUtils - 同包,实体相关
- ItemUtils - 同包,物品相关
- StringUtils - 同包,字符串相关
- ClassUtils - 同包,类加载相关
- ChatUtils - 同包,聊天相关
- MathUtils - 同包,数学相关
- BlockUtils - 同包,方块相关
- ColorUtils - 同包,颜色相关
- DelayedThread - 同包,线程相关