org.bukkit.Bukkit.getMotd()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(127)

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

Bukkit.getMotd介绍

暂无

代码示例

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

@Override
  public String update() {
    return Bukkit.getMotd();
  }
}));

代码示例来源:origin: dzikoysk/WildSkript

protected String[] get(Event event) {
  String motd = Bukkit.getMotd();
  if (Data.motd != null) {
    motd = Data.motd;
  }
  return new String[]{ motd };
}

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

public int getOnlinePlayersAmount() {
  try {
    ServerListPingEvent event = new ServerListPingEvent(InetAddress.getLocalHost(), Bukkit.getMotd(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
    Bukkit.getPluginManager().callEvent(event);
    return event.getNumPlayers();
  } catch (Exception e) {
    severe("Error while calling ServerListPingEvent: ");
    TimoCloudBukkit.getInstance().severe(e);
    return Bukkit.getOnlinePlayers().size();
  }
}

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

public int getMaxPlayersAmount() {
  try {
    ServerListPingEvent event = new ServerListPingEvent(InetAddress.getLocalHost(), Bukkit.getMotd(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
    Bukkit.getPluginManager().callEvent(event);
    return event.getMaxPlayers();
  } catch (Exception e) {
    severe("Error while calling ServerListPingEvent: ");
    TimoCloudBukkit.getInstance().severe(e);
    return Bukkit.getMaxPlayers();
  }
}

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

private void sendMotds() {
  try {
    ServerListPingEvent event = new ServerListPingEvent(InetAddress.getLocalHost(), Bukkit.getMotd(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
    Bukkit.getPluginManager().callEvent(event);
    getSocketMessageManager().sendMessage(Message.create().setType("SET_MOTD").setData(event.getMotd()));
    getStateByEventManager().setStateByMotd(event.getMotd().trim());
  } catch (Exception e) {
    severe("Error while sending MOTD: ");
    TimoCloudBukkit.getInstance().severe(e);
    getSocketMessageManager().sendMessage(Message.create().setType("SET_MOTD").setData(Bukkit.getMotd()));
  }
}

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

public static ServerPingResponseEvent createResponse(Channel channel) {
  Connection connection = ConnectionImpl.getFromChannel(channel);
  ArrayList<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers());
  String motd = Bukkit.getMotd();
  int maxPlayers = Bukkit.getMaxPlayers();
  InternalServerListPingEvent bevent = new InternalServerListPingEvent(connection.getAddress().getAddress(), motd, maxPlayers, players);
  bevent.setServerIcon(Bukkit.getServerIcon());
  Bukkit.getPluginManager().callEvent(bevent);
  ServerPingResponseEvent revent = new ServerPingResponseEvent(
    connection,
    new ProtocolInfo(connection.getVersion(), ServerPlatform.get().getMiscUtils().getModName() + " " + ServerPlatform.get().getMiscUtils().getVersionName()),
    bevent.getIcon() != null ? ServerPlatform.get().getMiscUtils().convertBukkitIconToBase64(bevent.getIcon()) : null,
    bevent.getMotd(), bevent.getMaxPlayers(),
    bevent.players.stream().map(Player::getName).collect(Collectors.toList())
  );
  Bukkit.getPluginManager().callEvent(revent);
  return revent;
}

相关文章