提供: Minecraft Modding Wiki
この編集を取り消せます。
下記の差分を確認して、本当に取り消していいか検証してください。よろしければ変更を保存して取り消しを完了してください。
最新版 | 編集中の文章 | ||
100行目: | 100行目: | ||
[[Image:create_project4.png]] | [[Image:create_project4.png]] | ||
− | + | まず、Java実行環境(JRE)の参照設定をします。<br/> | |
一番最後の行に '''</project>''' というタグがありますが、その1行上に、次の内容を挿入してください。<br/> | 一番最後の行に '''</project>''' というタグがありますが、その1行上に、次の内容を挿入してください。<br/> | ||
− | (なお、これは Java 7 を参照してビルドするための設定です。もし Java 6 を参照してビルドしたい場合は、sourceタグとtargetタグに書かれている 1.7 のところを 1.6 | + | (なお、これは Java 7 を参照してビルドするための設定です。もし Java 6 を参照してビルドしたい場合は、sourceタグとtargetタグに書かれている 1.7 のところを 1.6 に変更してください。) |
− | < | + | <code> |
<build> | <build> | ||
<plugins> | <plugins> | ||
111行目: | 111行目: | ||
<artifactId>maven-compiler-plugin</artifactId> | <artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | <configuration> | ||
− | <source>1.7</source> | + | <nowiki><</nowiki>source>1.7</source> |
<target>1.7</target> | <target>1.7</target> | ||
</configuration> | </configuration> | ||
117行目: | 117行目: | ||
</plugins> | </plugins> | ||
</build> | </build> | ||
− | </ | + | </code> |
− | + | 次に、BukkitリポジトリのURL設定を追加します。<br/> | |
下記の内容を追記してください。 | 下記の内容を追記してください。 | ||
− | < | + | <code> |
<repositories> | <repositories> | ||
<repository> | <repository> | ||
129行目: | 129行目: | ||
</repository> | </repository> | ||
</repositories> | </repositories> | ||
− | </ | + | </code> |
最後に、Bukkit API の参照設定を追加します。<br/> | 最後に、Bukkit API の参照設定を追加します。<br/> | ||
下記の内容を追記してください。 | 下記の内容を追記してください。 | ||
− | < | + | <code> |
<dependencies> | <dependencies> | ||
<dependency> | <dependency> | ||
142行目: | 142行目: | ||
</dependency> | </dependency> | ||
</dependencies> | </dependencies> | ||
− | </ | + | </code> |
この設定では、Bukkit API 1.10.2-R0.1-SNAPSHOT が参照されます。<br/> | この設定では、Bukkit API 1.10.2-R0.1-SNAPSHOT が参照されます。<br/> | ||
150行目: | 150行目: | ||
ここまで編集をすると、pom.xmlは次のようになっているはずです。確認してみてください。 | ここまで編集をすると、pom.xmlは次のようになっているはずです。確認してみてください。 | ||
− | <pre | + | <pre> |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
163行目: | 163行目: | ||
<artifactId>maven-compiler-plugin</artifactId> | <artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | <configuration> | ||
− | <source>1.7</source> | + | <nowiki><</nowiki>source>1.7</source> |
<target>1.7</target> | <target>1.7</target> | ||
</configuration> | </configuration> | ||
232行目: | 232行目: | ||
完了 を押して、新規クラスが作成されたことを確認して下さい。ソースコードは次のようになっているはずです。 | 完了 を押して、新規クラスが作成されたことを確認して下さい。ソースコードは次のようになっているはずです。 | ||
− | < | + | <source lang="java"> |
package my.test.plugin.tutorialplugin; | package my.test.plugin.tutorialplugin; | ||
240行目: | 240行目: | ||
} | } | ||
− | </ | + | </source> |
{{warning}} メインクラスは、コンストラクタを実行したり、新しいインスタンスを作成したりしないでください。 | {{warning}} メインクラスは、コンストラクタを実行したり、新しいインスタンスを作成したりしないでください。 | ||
264行目: | 264行目: | ||
''plugin.yml'' に、下記の3行を書いてください。 | ''plugin.yml'' に、下記の3行を書いてください。 | ||
− | < | + | <source lang="yaml"> |
name: (あなたのプラグイン名) | name: (あなたのプラグイン名) | ||
main: (作成したパッケージ名).(作成したメインクラス) | main: (作成したパッケージ名).(作成したメインクラス) | ||
version: (あなたのプラグインのバージョン) | version: (あなたのプラグインのバージョン) | ||
− | </ | + | </source> |
このチュートリアルでは、次のように作成します。 | このチュートリアルでは、次のように作成します。 | ||
− | < | + | <source lang="yaml"> |
name: TutorialPlugin | name: TutorialPlugin | ||
main: my.test.plugin.tutorialplugin.TutorialPlugin | main: my.test.plugin.tutorialplugin.TutorialPlugin | ||
version: 0.0.1 | version: 0.0.1 | ||
− | </ | + | </source> |
{{note}} メインクラスの設定は、大文字小文字が区別されるので、大文字小文字に注意して設定してください。 | {{note}} メインクラスの設定は、大文字小文字が区別されるので、大文字小文字に注意して設定してください。 | ||
373行目: | 373行目: | ||
具体的には、"give"コマンドは既にいくつかのプラグインで利用されています。 | 具体的には、"give"コマンドは既にいくつかのプラグインで利用されています。 | ||
もし独自に"give"コマンドを実装した場合は、 | もし独自に"give"コマンドを実装した場合は、 | ||
− | "give"コマンドを実装している他のプラグインとの互換性は無くなります。 | + | "give"コマンドを実装している他のプラグインとの互換性は無くなります。 |
− | onCommand() | + | onCommand()は、常にboolean型の値としてtrue,falseのどちらかを戻り値として返さねばなりません。 |
trueを返した場合は、情報表示のためのイベントは発生しません。 | trueを返した場合は、情報表示のためのイベントは発生しません。 | ||
falseを返した場合は、プラグインファイルを"usage: property"に戻し、コマンドを実行したプレイヤーに、コマンドの利用方法を通知するメッセージを表示します。 | falseを返した場合は、プラグインファイルを"usage: property"に戻し、コマンドを実行したプレイヤーに、コマンドの利用方法を通知するメッセージを表示します。 | ||
384行目: | 384行目: | ||
* Command cmd - 実行されたコマンドの内容 | * Command cmd - 実行されたコマンドの内容 | ||
* String commandLabel - 利用されたコマンドエイリアス | * String commandLabel - 利用されたコマンドエイリアス | ||
− | * String[] args - コマンドの引数を格納した配列(例:/hello abc defコマンドが入力された場合の内容は、args[0]がabc、args[1]がdefとなる) | + | * String[] args - コマンドの引数を格納した配列(例:/hello abc defコマンドが入力された場合の内容は、args[0]がabc、args[1]がdefとなる) |
=== コマンドの設定 === | === コマンドの設定 === | ||
529行目: | 529行目: | ||
Player player = (Player) sender; | Player player = (Player) sender; | ||
// ここに、処理を実装する。 | // ここに、処理を実装する。 | ||
− | + | reutnr true; | |
} else { | } else { | ||
sender.sendMessage(ChatColor.RED + "ゲーム内から実行してください!"); | sender.sendMessage(ChatColor.RED + "ゲーム内から実行してください!"); | ||
586行目: | 586行目: | ||
== 権限 == | == 権限 == | ||
− | :'''Note''': | + | :'''Note''': 当記事の一部は原文の訳ではありません、日本語読者向けに独自の内容を記述しています。 |
Bukkitにおける権限の利用は、とっても簡単です! | Bukkitにおける権限の利用は、とっても簡単です! | ||
615行目: | 615行目: | ||
下記は、''plugin.yml''の最後に追加する形で設定する権限です: | 下記は、''plugin.yml''の最後に追加する形で設定する権限です: | ||
− | <blockquote> | + | <blockquote><code><source lang="yaml">permissions: |
− | < | ||
− | permissions: | ||
doorman.*: | doorman.*: | ||
description: Gives access to all doorman commands | description: Gives access to all doorman commands | ||
635行目: | 633行目: | ||
default: true | default: true | ||
doorman.denied: | doorman.denied: | ||
− | description: Prevents this user from entering the door | + | description: Prevents this user from entering the door</source> |
− | </ | + | </code></blockquote> |
− | </blockquote> | ||
659行目: | 656行目: | ||
高い柔軟性を提供しています。<br/> | 高い柔軟性を提供しています。<br/> | ||
下記はその実装例です: | 下記はその実装例です: | ||
− | <blockquote> | + | <blockquote><source lang="yaml">permissions: |
− | < | ||
− | permissions: | ||
doorman.*: | doorman.*: | ||
description: Gives access to all doorman commands | description: Gives access to all doorman commands | ||
669行目: | 664行目: | ||
doorman.knock: true | doorman.knock: true | ||
doorman.denied: false</source> | doorman.denied: false</source> | ||
− | + | ||
''doorman.*''権限は、いくつかの子権限を含んでいます。 | ''doorman.*''権限は、いくつかの子権限を含んでいます。 | ||
''doorman.*''権限がtrueである場合に、 | ''doorman.*''権限がtrueである場合に、 | ||
1,177行目: | 1,172行目: | ||
この内容について質問がある場合、遠慮なく[http://forums.bukkit.org/members/adamki11s.42417/ Adamki11s]か[http://wiki.bukkit.org/IRC BukkitDevのIRCチャンネル](当Wikiの原文を掲載しているサイトのIRCチャンネルです)で聞いてください。 | この内容について質問がある場合、遠慮なく[http://forums.bukkit.org/members/adamki11s.42417/ Adamki11s]か[http://wiki.bukkit.org/IRC BukkitDevのIRCチャンネル](当Wikiの原文を掲載しているサイトのIRCチャンネルです)で聞いてください。 | ||
:'''Note''': 当ページは訳文であるため、訳文自体に対する文責は原著者にありません。その点を考慮して必ず原文にも目を通してから質問して下さい。 | :'''Note''': 当ページは訳文であるため、訳文自体に対する文責は原著者にありません。その点を考慮して必ず原文にも目を通してから質問して下さい。 | ||
− | |||
− |