com.gmail.filoghost.holographicdisplays.util.Utils.join()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(106)

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

Utils.join介绍

暂无

代码示例

代码示例来源:origin: filoghost/HolographicDisplays

public static String join(String[] elements, String separator) {
  return join(elements, separator, 0, elements.length);
}

代码示例来源:origin: filoghost/HolographicDisplays

public static String join(List<String> elements, String separator) {
  return join(elements, separator, 0, elements.size());
}

代码示例来源:origin: filoghost/HolographicDisplays

public static String join(List<String> elements, String separator, int startIndex, int size) {
  return join(elements.toArray(new String[elements.size()]), separator, startIndex, size);
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
  NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase());
  CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase()));
  String line = Utils.join(args, " ", 1, args.length);
  
  // Check material validity
  if (line.toLowerCase().startsWith("icon:")) {
    String iconMaterial = ItemUtils.stripSpacingChars(line.substring("icon:".length(), line.length()));
    
    if (iconMaterial.contains(":")) {
      iconMaterial = iconMaterial.split(":")[0];
    }
    
    Material mat = ItemUtils.matchMaterial(iconMaterial);
    CommandValidator.notNull(mat, "Invalid icon material.");
  }
  hologram.getLinesUnsafe().add(HologramDatabase.readLineFromString(line, hologram));
  hologram.refreshAll();
    
  HologramDatabase.saveHologram(hologram);
  HologramDatabase.trySaveToDisk();
  sender.sendMessage(Colors.PRIMARY + "Line added!");
  Bukkit.getPluginManager().callEvent(new NamedHologramEditedEvent(hologram));
}

代码示例来源:origin: filoghost/HolographicDisplays

NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase());
CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase()));
String line = Utils.join(args, " ", 2, args.length);

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
  NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase());
  CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase()));
  
  int insertAfter = CommandValidator.getInteger(args[1]);
  int oldLinesAmount = hologram.size();
  
  CommandValidator.isTrue(insertAfter >= 0 && insertAfter <= oldLinesAmount, "The number must be between 0 and " + hologram.size() + "(amount of lines of the hologram).");
  hologram.getLinesUnsafe().add(insertAfter, HologramDatabase.readLineFromString(Utils.join(args, " ", 2, args.length), hologram));
  hologram.refreshAll();
    
  HologramDatabase.saveHologram(hologram);
  HologramDatabase.trySaveToDisk();
  
  if (insertAfter == 0) {
    sender.sendMessage(Colors.PRIMARY + "Line inserted before line n.1!");
  } else if (insertAfter == oldLinesAmount) {
    sender.sendMessage(Colors.PRIMARY + "Line appended at the end!");
    sender.sendMessage(Strings.TIP_PREFIX + "Next time use /" + label + " addline to add a line at the end.");
  } else {
    sender.sendMessage(Colors.PRIMARY + "Line inserted between lines " + insertAfter + " and " + (insertAfter + 1) + "!");
  }
  Bukkit.getPluginManager().callEvent(new NamedHologramEditedEvent(hologram));
}

代码示例来源:origin: filoghost/HolographicDisplays

.color(ChatColor.AQUA)
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, usage))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Utils.join(help, "\n"))))
.create());

代码示例来源:origin: filoghost/HolographicDisplays

String text = Utils.join(args, " ", 1, args.length);
CommandValidator.isTrue(!text.equalsIgnoreCase("{empty}"), "The first line should not be empty.");

代码示例来源:origin: filoghost/HolographicDisplays

.color(ChatColor.AQUA)
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, usage))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Utils.join(help, "\n"))))
.create());

代码示例来源:origin: filoghost/HolographicDisplays

config.options().header(Utils.join(new String[] {
    ".",
    ".  Read the tutorial at: http://dev.bukkit.org/bukkit-plugins/holographic-displays/",

相关文章