From d27f6b8574d29c6bee49c47bb6eaccd6f20e8789 Mon Sep 17 00:00:00 2001 From: liujiahua123123 Date: Wed, 21 Aug 2019 11:19:04 +0800 Subject: [PATCH] YAML supported --- .../utils/config/MiraiConfigSection.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfigSection.java b/mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfigSection.java index cea0be010..256c005a4 100644 --- a/mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfigSection.java +++ b/mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfigSection.java @@ -27,4 +27,31 @@ public class MiraiConfigSection extends ConcurrentSkipListMap { return (D)(this.getOrDefault(key,defaultV)); } + public Integer getInt(String key){ + return Integer.valueOf(this.get(key).toString()); + } + + public Double getDouble(String key){ + return Double.valueOf(this.get(key).toString()); + } + + public Float getFloat(String key){ + return Float.valueOf(this.get(key).toString()); + } + + public String getString(String key){ + return String.valueOf(this.get(key)); + } + + @SuppressWarnings("unchecked") + public MiraiConfigSection getTypedSection(String key){ + return (MiraiConfigSection) this.getAs(key); + } + + @SuppressWarnings("unchecked") + public MiraiConfigSection getSection(String key){ + return (MiraiConfigSection) this.getAs(key); + } + + }