Yamler
该 API 让你能够轻松地将 Java 对象绑定到 YAML 中。它不依赖 Bukkit Configuration API,因此运行速度应该更快一些。(我使用它来构建基于 YML 的数据库)
Maven 仓库:
<dependency> <groupId>net.cubespace</groupId> <artifactId>Yamler-Core</artifactId> <version>1.5.1-SNAPSHOT</version> </dependency>
使用方法:
- 创建一个继承自 net.cubespace.Yamler.Config.Config 的类
- 创建字段,这些字段可以是 public 或 private(但不能是 final、transient 或 static)
- 创建构造函数并设置 CONFIG_FILE 和 CONFIG_HEADER(CONFIG_HEADER 为可选)
- 调用 Config.init() 以指示 Config 进行加载
最终你得到的 Config 类如下所示:
public class Database extends Config { public Database(Plugin plugin) { CONFIG_HEADER = new String[]{"Configuration of the Database"}; CONFIG_FILE = new File(plugin.getDataFolder(), "db.yml"); }@Comments({ "This is the URL of the Database", "Must be jdbc:<database engine>:<connection parameter>", "For H2 (which is the default file based DB): jdbc:h2:{DIR}thesuit.db", "For MySQL: jdbc:mysql://<host>:<port>/<database>" }) private String Url = "jdbc:h2:{DIR}thesuit.db";
@Comment("用于向数据库进行身份验证的用户名") private String Username = "test";
@Comment("用户的密码") private String Password = "test"; }
你可以这样使用它:
Database dbConfig = null; try { dbConfig = new Database(this); dbConfig.init(); } catch(InvalidConfigurationException ex) { System.out.println("你的配置文件 YML 有误"); ex.printStackTrace(); }
保存配置文件的方法如下:
try { dbConfig.save(); } catch(InvalidConfigurationException ex) { System.out.println("保存配置 YML 时出错"); ex.printStackTrace(); }

引用:本插件使用了 Hidendra 的插件指标(Metrics)系统,这意味着以下信息会被收集并发送至 mcstats.org:
- 唯一标识符
- 服务器的 Java 版本
- 服务器是处于离线模式还是在线模式
- 插件的版本
- 服务器的版本
- 操作系统版本/名称及架构
- CPU 的核心数
- 在线玩家数量
- Metrics 的版本
若要退出此服务,可编辑 plugins/Plugin Metrics/config.yml 文件,并将 opt-out 设置为 true。
Yamler
This API enables you the easy usage of Java Object bound into YAML. This does not rely on Bukkit Configuration API. So this should work a little bit faster. (I use it to build YML based Databases with it)
Maven Repository:
<dependency> <groupId>net.cubespace</groupId> <artifactId>Yamler-Core</artifactId> <version>1.5.1-SNAPSHOT</version> </dependency>
How to use it:
- Create a Class which extends net.cubespace.Yamler.Config.Config
- Create Fields which are either public or private (not final or transient or static)
- Create a Constructor and set the CONFIG_FILE and CONFIG_HEADER (CONFIG_HEADER is optional)
- To tell the Config to load invoke Config.init()
So you end up having a Config Class like this:
public class Database extends Config { public Database(Plugin plugin) { CONFIG_HEADER = new String[]{"Configuration of the Database"}; CONFIG_FILE = new File(plugin.getDataFolder(), "db.yml"); }@Comments({ "This is the URL of the Database", "Must be jdbc:<database engine>:<connection parameter>", "For H2 (which is the default file based DB): jdbc:h2:{DIR}thesuit.db", "For MySQL: jdbc:mysql://<host>:<port>/<database>" }) private String Url = "jdbc:h2:{DIR}thesuit.db";
@Comment("The Username which should be used to auth against the Database") private String Username = "test";
@Comment("The Password for the User") private String Password = "test"; }
You can use it with this:
Database dbConfig = null; try { dbConfig = new Database(this); dbConfig.init(); } catch(InvalidConfigurationException ex) { System.out.println("Your Config YML was wrong"); ex.printStackTrace(); }
To save a Config file:
try { dbConfig.save(); } catch(InvalidConfigurationException ex) { System.out.println("Error in saving the Config YML"); ex.printStackTrace(); }

Quote:This plugin utilises Hidendra's plugin metrics system, which means that the following information is collected and sent to mcstats.org:
- A unique identifier
- The server's version of Java
- Whether the server is in offline or online mode
- The plugin's version
- The server's version
- The OS version/name and architecture
- The core count for the CPU
- The number of players online
- The Metrics version
Opting out of this service can be done by editing plugins/Plugin Metrics/config.yml and changing opt-out to true.
下载 Yamler
下载 Yamler
下载 Yamler
下载 Yamler
下载 Yamler
下载 Yamler
下载 Yamler
下载 Yamler
下载 Yamler
下载 Yamler
我重新设计了 Yamler 的序列化/反序列化流程。现在你可以向 Yamler 添加自定义转换器,用于转换 Bukkit Location 或 BungeeCord Serverinfo 等对象。
同时移除了 FastLookupCache,并实现了普通的父节点 → 子节点结构。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
一个强大的 API,用于为你的 Minecraft 服务器创建自定义进度。
插件
SkyBlock、OneBlock、Boxed、SkyGrid、AcidIsland、CaveBlock、Poseidon、StrangerRealms——以及更多!这些只是由 BentoBox 支持的基于岛屿的游戏模式之一。来自原版 ASkyBlock 的作者。
评论 0
登录后参与评分
还没有评论,来抢沙发吧