org.bukkit.Server.getVersion()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(221)

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

Server.getVersion介绍

[英]Gets the version string of this server implementation.
[中]

代码示例

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

/**
 * @see Server#getVersion()
 */
public static String getVersion() {
  return server.getVersion();
}

代码示例来源:origin: webbukkit/dynmap

BukkitVersionHelperCB() {
  String bukkitver = DynmapPlugin.plugin.getServer().getVersion();
  String mcver = "1.0.0";
  int idx = bukkitver.indexOf("(MC: ");
  if(idx > 0) {
    mcver = bukkitver.substring(idx+5);
    idx = mcver.indexOf(")");
    if(idx > 0) mcver = mcver.substring(0, idx);
  }
  isBadUnload = HDBlockModels.checkVersionRange(mcver, "1.9-");
  Log.verboseinfo("MCVER=" + mcver + ", isBadUnload=" + isBadUnload);
}
@Override

代码示例来源:origin: webbukkit/dynmap

public static final BukkitVersionHelper getHelper() {
  if(helper == null) {
    Log.info("version=" + Bukkit.getServer().getVersion());
    if(Bukkit.getServer().getVersion().contains("MCPC")) {
      Log.severe("*********************************************************************************");
      Log.severe("* MCPC-Plus is no longer supported via the Bukkit version of Dynmap.            *");
      Log.severe("* Install the appropriate Forge version of Dynmap.                              *");
      Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
      Log.severe("*********************************************************************************");
    }
    else if(Bukkit.getServer().getVersion().contains("BukkitForge")) {
      Log.severe("*********************************************************************************");
      Log.severe("* BukkitForge is not supported via the Bukkit version of Dynmap.                *");
      Log.severe("* Install the appropriate Forge version of Dynmap.                              *"); 
      Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
      Log.severe("*********************************************************************************");
    }
    else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) {
      Log.info("Loading Glowstone support");
      helper = new BukkitVersionHelperGlowstone();
    }
    else {
      helper = new BukkitVersionHelperCB();
    }
  }
  return helper;
}
protected BukkitVersionHelper() {

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

/**
 * @see Server#getVersion()
 */
public static String getVersion() {
  return server.getVersion();
}

代码示例来源:origin: garbagemule/MobArena

private static String getMinecraftVersion(Server server) {
  // Same substring as the one bStats uses, so should be safe
  String version = server.getVersion();
  int start = version.indexOf("MC: ") + 4;
  int end = version.length() - 1;
  return version.substring(start, end);
}

代码示例来源:origin: webbukkit/dynmap

String bukkitver = getServer().getVersion();
String mcver = "1.0.0";
int idx = bukkitver.indexOf("(MC: ");

代码示例来源:origin: aadnk/ProtocolLib

/**
   * Whether or not this server is running Spigot or a Spigot fork. This works by checking
   * the server version for the Strings "Spigot" or "Paper".
   * @return True if it is, false if not.
   */
  public static boolean isUsingSpigot() {
    return Bukkit.getServer().getVersion().contains("Spigot") || Bukkit.getServer().getVersion().contains("Paper");
  }
}

代码示例来源:origin: aadnk/ProtocolLib

/**
 * Determine if we are running MCPC or Cauldron.
 * @return TRUE if we are, FALSE otherwise.
 */
private static boolean isCauldronOrMCPC() {
  String version = Bukkit.getServer().getVersion();
  return version.contains("MCPC") || version.contains("Cauldron");
}

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

@Override
  public boolean isAvailable() {
    return Bukkit.getServer().getVersion().contains(content);
  }
});

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public String getServerDescription() {
  String desc = Bukkit.getServer().getVersion();
  desc = desc.replace(" (MC: " + MC_VERSION + ")", "");
  return desc;
}

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

@Override
  public boolean isAvailable() {
    return Bukkit.getServer().getVersion().toLowerCase().contains(content.toLowerCase());
  }
});

代码示例来源:origin: aadnk/ProtocolLib

/**
 * Determine the current Minecraft version.
 * @param server - the Bukkit server that will be used to examine the MC version.
 */
public MinecraftVersion(Server server) {
  this(extractVersion(server.getVersion()));
}

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public String getServerVersion() {
  return Bukkit.getServer().getVersion();
}

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public String getServerDescription() {
  return Bukkit.getServer().getVersion();
}

代码示例来源:origin: gvlfm78/BukkitOldCombatMechanics

/**
   * Throws an exception indicating that the element wasn't found.
   *
   * @param name the name of the element
   */
  void throwNewElementNotFoundException(String name){
    throw new IllegalStateException(
        "Couldn't find " + name + ". Please report this on github. I am running server version "
            + Bukkit.getServer().getVersion()
    );
  }
}

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public boolean init() {
  if (!super.init()) {
    return false;
  }
  return Bukkit.getServer().getVersion().contains("SportBukkit");
}

代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common

public static String getServerVersion() {
 return BedwarsRel.getInstance().getServer().getVersion();
}

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

@Override
  public void run() {
    String fullPlatformVersion = getServer().getVersion();
    int start = fullPlatformVersion.indexOf("(MC:");
    String pv = fullPlatformVersion.substring(start + 5, fullPlatformVersion.length() - 1);
    try {
      AnalyticsSend.postServerInformation(httpClient, serverKey, platform, getServer().getOnlineMode());
    } catch (IOException e) {
      getLogger().log(Level.WARNING, "Can't send analytics", e);
    }
  }
}, 0, 20 * TimeUnit.DAYS.toSeconds(1));

代码示例来源:origin: Multiverse/Multiverse-Core

private void nullWorld(String name) {
  this.plugin.log(Level.SEVERE, "The world '" + name + "' could NOT be loaded because the server didn't like it!");
  this.plugin.log(Level.SEVERE, "We don't really know why this is. Contact the developer of your server software!");
  this.plugin.log(Level.SEVERE, "Server version info: " + Bukkit.getServer().getVersion());
}

代码示例来源:origin: Rsl1122/Plan-PlayerAnalytics

public BukkitServerProperties(Server server) {
  super(
      server.getServerId(),
      server.getName(),
      server.getPort(),
      server.getVersion(),
      server.getBukkitVersion(),
      server::getIp,
      server.getMaxPlayers(),
      () -> server.getOnlinePlayers().size()
  );
}

相关文章

Server类方法