提供: Minecraft Modding Wiki
この編集を取り消せます。
下記の差分を確認して、本当に取り消していいか検証してください。よろしければ変更を保存して取り消しを完了してください。
最新版 | 編集中の文章 | ||
122行目: | 122行目: | ||
利用例: <blockquote><source lang="java"> | 利用例: <blockquote><source lang="java"> | ||
− | // | + | // setting a boolean value |
this.getConfig().set("path.to.boolean", true); | this.getConfig().set("path.to.boolean", true); | ||
− | // | + | // setting a String |
− | this.getConfig().set("path.to.string", | + | String string = "Hello World!"; |
+ | this.getConfig().set("path.to.string", stringValue); | ||
− | // | + | // Setting a List of Strings |
− | // | + | // The List of Strings is first defined in this array |
− | String[] listOfStrings = {" | + | String[] listOfStrings = {"Hello World", "Welcome to Bukkit", "Have a Good Day!"}; |
− | this.getConfig().set("path.to.list", Arrays.asList(listOfStrings | + | this.getConfig().set("path.to.list", Arrays.asList(listOfStrings); |
− | // | + | // Setting a vector |
+ | // event is assumed to be an existing event inside an "onEvent" method. | ||
Vector vector = event.getPlayer().getLocation().toVector(); | Vector vector = event.getPlayer().getLocation().toVector(); | ||
this.getConfig().set("path.to.vector", vector); | this.getConfig().set("path.to.vector", vector); | ||
− | // | + | // Erasing a value |
− | this.getConfig().set("path.to. | + | this.getConfig().set("path.to.value", null);</source></blockquote><br> |
− | </source></blockquote> | + | |
==== HashMapの活用 ==== | ==== HashMapの活用 ==== | ||
145行目: | 147行目: | ||
また、HashMapはキーがString型、値が''ConfigurationSerializable''を実装したデータ型でなければなりません。 | また、HashMapはキーがString型、値が''ConfigurationSerializable''を実装したデータ型でなければなりません。 | ||
<blockquote><source lang="java">createSection (String path, Map< String, Object > map)</source></blockquote> | <blockquote><source lang="java">createSection (String path, Map< String, Object > map)</source></blockquote> | ||
+ | |||
=== コンフィグファイルのセーブ === | === コンフィグファイルのセーブ === |