0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MinecraftのPaperPluginでGUIを作りたい

Posted at

テンプレ

これをコピペで作れる

Inventory gui = Bukkit.createInventory(null, 9, Component.text("GUIタイトル"));

中身を覗いてみた

createInventory(...)の中身↓

public static org.bukkit.inventory.@org.jetbrains.annotations.NotNull Inventory createInventory(@org.jetbrains.annotations.Nullable org.bukkit.inventory.@org.jetbrains.annotations.Nullable InventoryHolder owner, @org.jetbrains.annotations.NotNull org.bukkit.event.inventory.@org.jetbrains.annotations.NotNull InventoryType type, net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component title) { /* compiled code */ }

分かりづらいので、要するに

public static Inventory createInventory(@Nullable owner, int size, @NotNull Component title)
// つまり...
createInventory({GUIの所有者}, {GUIのサイズ}, {GUIのタイトル})

これだけ

ちなみに、Inventoryのクラスには結構引数があって、

int getSize(); //←GUIのサイズ取得
int getMaxStackSize(); //←GUIの最大スタックサイズ(???)取得
void setMaxStackSize(int i); //←GUIの最大スタックサイズ(???)を設定
ItemStack getItem(int i); //←(???)
addItem(itemStacks); //GUIにアイテム(itemStacks)を追加
removeItem(itemStacks); //GUIからアイテム(itemStacks)を削除
setItem(int, itemStacks); //GUIにアイテム(itemStacks)を追加(特定のスロットint)

とかあった

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?