org.bukkit.inventory.Inventory.getTitle()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.bukkit.inventory.Inventory.getTitle()方法的一些代码示例,展示了Inventory.getTitle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inventory.getTitle()方法的具体详情如下:
包路径:org.bukkit.inventory.Inventory
类名称:Inventory
方法名:getTitle

Inventory.getTitle介绍

[英]Returns the title of this inventory.
[中]返回此资源清册的标题。

代码示例

代码示例来源:origin: Bukkit/Bukkit

/**
   * Get the title of this inventory window.
   *
   * @return The title.
   */
  public final String getTitle() {
    return getTopInventory().getTitle();
  }
}

代码示例来源:origin: EngineHub/CommandHelper

@Override
  public String getTitle() {
    return i.getTitle();
  }
}

代码示例来源:origin: SpigotMC/Spigot-API

/**
   * Get the title of this inventory window.
   *
   * @return The title.
   */
  public final String getTitle() {
    return getTopInventory().getTitle();
  }
}

代码示例来源:origin: DRE2N/DungeonsXL

/**
 * @param gui the gui
 * @return the announcer that has the GUI
 */
public Announcer getByGUI(Inventory gui) {
  for (Announcer announcer : announcers) {
    if ((ChatColor.DARK_RED + announcer.getName()).equals(gui.getTitle())) {
      return announcer;
    }
  }
  return null;
}

代码示例来源:origin: FunnyGuilds/FunnyGuilds

public void unregister() {
  windows.remove(this.wrap().getTitle());
  this.items.clear();
}

代码示例来源:origin: eccentricdevotion/TARDIS

@EventHandler(ignoreCancelled = true)
  public void onPlayerInventoryViewClick(InventoryClickEvent event) {
    String title = event.getInventory().getTitle();
    if (title.startsWith(ChatColor.DARK_RED + "") && title.endsWith("'s Inventory")) {
      event.setCancelled(true);
    }
  }
}

代码示例来源:origin: eccentricdevotion/TARDIS

@EventHandler
public void onWallMenuOpen(InventoryOpenEvent event) {
  String name = event.getInventory().getTitle();
  if (name.equals(ChatColor.DARK_RED + "TARDIS Wall Menu") || name.equals(ChatColor.DARK_RED + "TARDIS Floor Menu")) {
    Player p = (Player) event.getPlayer();
    scroll.put(p.getUniqueId(), 0);
  }
}

代码示例来源:origin: eccentricdevotion/TARDIS

@EventHandler
public void onWallFloorMenuOpen(InventoryOpenEvent event) {
  if (event.getInventory().getTitle().equals(ChatColor.DARK_RED + "TARDIS Wall & Floor Menu")) {
    Player p = (Player) event.getPlayer();
    scroll.put(p.getUniqueId(), 0);
  }
}

代码示例来源:origin: eccentricdevotion/TARDIS

@EventHandler
public void onChameleonWallMenuOpen(InventoryOpenEvent event) {
  if (event.getInventory().getTitle().equals(ChatColor.DARK_RED + "Police Box Wall Menu")) {
    Player p = (Player) event.getPlayer();
    scroll.put(p.getUniqueId(), 0);
  }
}

代码示例来源:origin: eccentricdevotion/TARDIS

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onChameleonConstructorOpen(InventoryOpenEvent event) {
  Inventory inv = event.getInventory();
  String inv_name = inv.getTitle();
  if (inv_name.equals(ChatColor.DARK_RED + "Chameleon Construction")) {
    Player player = ((Player) event.getPlayer());
    plugin.getTrackerKeeper().getConstructors().add(player.getUniqueId());
  }
}

代码示例来源:origin: FunnyGuilds/FunnyGuilds

@EventHandler
public void onClose(final InventoryCloseEvent e) {
  GuiWindow window = GuiWindow.getWindow(e.getInventory().getTitle());
  if (window != null) {
    window.handleClose(e);
  }
}

代码示例来源:origin: FunnyGuilds/FunnyGuilds

@EventHandler
public void onOpen(final InventoryOpenEvent e) {
  GuiWindow window = GuiWindow.getWindow(e.getInventory().getTitle());
  if (window != null) {
    window.handleOpen(e);
  }
}

代码示例来源:origin: jiongjionger/NeverLag

@EventHandler(priority = EventPriority.LOWEST)
public void onGUIClose(InventoryCloseEvent e) {
  Inventory inv = e.getInventory();
  if (inv == null) {
    return;
  }
  if (i18n.tr("title").equals(inv.getTitle())) {
    GUISortPingHolder.clear(e.getPlayer().getName());
  }
}

代码示例来源:origin: jiongjionger/NeverLag

public GUIMaker(Inventory inv) {
  if (inv.getType() == InventoryType.CHEST) { // 自定义大小的 Inventory
    this.inv = Bukkit.createInventory(inv.getHolder(), inv.getSize(), inv.getTitle());
  } else { // 自定义类型的 Inventory
    this.inv = Bukkit.createInventory(inv.getHolder(), inv.getType(), inv.getTitle());
  }
  this.inv.setContents(inv.getContents());
}

代码示例来源:origin: SkyWars/SkyWars

private boolean isKitGuiInvolved(InventoryEvent evt) {
  Inventory inventory = evt.getInventory();
  InventoryHolder holder = inventory.getHolder();
  if (holder instanceof Player) {
    if (((Player) holder).getOpenInventory().getTitle().equals(plugin.getKitGui().getKitGuiTitle())) {
      // This ensure that a player is unable to manipulate their own items when a kit GUI is open.
      return true;
    }
  }
  return inventory.getTitle().equals(plugin.getKitGui().getKitGuiTitle());
}

代码示例来源:origin: eccentricdevotion/TARDIS

@EventHandler(ignoreCancelled = true)
public void onHandlesProgramClose(InventoryCloseEvent event) {
  Inventory inv = event.getInventory();
  String title = inv.getTitle();
  if (!title.equals(ChatColor.DARK_RED + "Handles Program")) {
    return;
  }
  Player p = (Player) event.getPlayer();
  ItemStack item = p.getItemOnCursor();
  if (item != null && item.getType().equals(Material.BOWL)) {
    p.setItemOnCursor(null);
  }
}

代码示例来源:origin: BuycraftPlugin/BuycraftX

@Override
  public void run() {
    if ((event.getPlayer().getOpenInventory().getTopInventory() == null ||
        !event.getPlayer().getOpenInventory().getTopInventory().getTitle().startsWith("Buycraft: ")) &&
        settingUpSigns.remove(event.getPlayer().getUniqueId()) != null &&
        event.getPlayer() instanceof Player) {
      ((Player) event.getPlayer()).sendMessage(ChatColor.RED + "Buy sign set up cancelled.");
    }
  }
}, 3);

代码示例来源:origin: FunnyGuilds/FunnyGuilds

public void open(HumanEntity entity) {
  Inventory inv = Bukkit.createInventory(entity, this.wrap().getSize(), this.wrap().getTitle());
  inv.setContents(this.wrap().getContents());
  entity.openInventory(inv);
}

代码示例来源:origin: FunnyGuilds/FunnyGuilds

@EventHandler
  public void onInteract(final InventoryInteractEvent e) {
    if (GuiWindow.getWindow(e.getInventory().getTitle()) != null) {
      if (e.getInventory().getType().equals(InventoryType.CHEST)) {
        e.setResult(Event.Result.DENY);
        e.setCancelled(true);
      }
    }
  }
}

代码示例来源:origin: FunnyGuilds/FunnyGuilds

@EventHandler
public void onClick(final InventoryClickEvent e) {
  if (e.getInventory() != null && e.getInventory().getType().equals(InventoryType.CHEST)) {
    GuiWindow window = GuiWindow.getWindow(e.getInventory().getTitle());
    if (window != null) {
      GuiItem item = window.getItem(e.getSlot());
      if (item != null) {
        item.handleClick(e);
      }
      
      e.setResult(Event.Result.DENY);
      e.setCancelled(true);
    }
  }
}

相关文章