当前位置: 首页>>代码示例>>Java>>正文


Java Bukkit.getOnlineMode方法代码示例

本文整理汇总了Java中org.bukkit.Bukkit.getOnlineMode方法的典型用法代码示例。如果您正苦于以下问题:Java Bukkit.getOnlineMode方法的具体用法?Java Bukkit.getOnlineMode怎么用?Java Bukkit.getOnlineMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.Bukkit的用法示例。


在下文中一共展示了Bukkit.getOnlineMode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Gets the server specific data.
 *
 * @return The server specific data.
 */
private JSONObject getServerData() {
    // Minecraft specific data
    int playerAmount = Bukkit.getOnlinePlayers().size();
    int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
    String bukkitVersion = org.bukkit.Bukkit.getVersion();
    bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);

    // OS/Java specific data
    String javaVersion = System.getProperty("java.version");
    String osName = System.getProperty("os.name");
    String osArch = System.getProperty("os.arch");
    String osVersion = System.getProperty("os.version");
    int coreCount = Runtime.getRuntime().availableProcessors();

    JSONObject data = new JSONObject();

    data.put("serverUUID", serverUUID);

    data.put("playerAmount", playerAmount);
    data.put("onlineMode", onlineMode);
    data.put("bukkitVersion", bukkitVersion);

    data.put("javaVersion", javaVersion);
    data.put("osName", osName);
    data.put("osArch", osArch);
    data.put("osVersion", osVersion);
    data.put("coreCount", coreCount);

    return data;
}
 
开发者ID:Ladinn,项目名称:JavaShell,代码行数:36,代码来源:Metrics.java

示例2: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Gets the server specific data.
 *
 * @return The server specific data.
 */
private JSONObject getServerData() {
    // Minecraft specific data
    int playerAmount=Bukkit.getServer().getOnlinePlayers().size();
    int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
    String bukkitVersion = org.bukkit.Bukkit.getVersion();
    bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);

    // OS/Java specific data
    String javaVersion = System.getProperty("java.version");
    String osName = System.getProperty("os.name");
    String osArch = System.getProperty("os.arch");
    String osVersion = System.getProperty("os.version");
    int coreCount = Runtime.getRuntime().availableProcessors();

    JSONObject data = new JSONObject();

    data.put("serverUUID", serverUUID);

    data.put("playerAmount", playerAmount);
    data.put("onlineMode", onlineMode);
    data.put("bukkitVersion", bukkitVersion);

    data.put("javaVersion", javaVersion);
    data.put("osName", osName);
    data.put("osArch", osArch);
    data.put("osVersion", osVersion);
    data.put("coreCount", coreCount);

    return data;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:36,代码来源:BMetrics.java

示例3: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
    * Gets the server specific data.
    *
    * @return The server specific data.
    */
   @SuppressWarnings("unchecked")
private JSONObject getServerData() {
       // Minecraft specific data
       int playerAmount = Bukkit.getOnlinePlayers().size();
       int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
       String bukkitVersion = org.bukkit.Bukkit.getVersion();
       bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);

       // OS/Java specific data
       String javaVersion = System.getProperty("java.version");
       String osName = System.getProperty("os.name");
       String osArch = System.getProperty("os.arch");
       String osVersion = System.getProperty("os.version");
       int coreCount = Runtime.getRuntime().availableProcessors();

       JSONObject data = new JSONObject();

       data.put("serverUUID", serverUUID);

       data.put("playerAmount", playerAmount);
       data.put("onlineMode", onlineMode);
       data.put("bukkitVersion", bukkitVersion);

       data.put("javaVersion", javaVersion);
       data.put("osName", osName);
       data.put("osArch", osArch);
       data.put("osVersion", osVersion);
       data.put("coreCount", coreCount);

       return data;
   }
 
开发者ID:EverCraft,项目名称:SayNoToMcLeaks,代码行数:37,代码来源:Metrics.java

示例4: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Gets the server specific data.
 *
 * @return The server specific data.
 */
private JSONObject getServerData() {
    // Minecraft specific data
    int playerAmount = Bukkit.getOnlinePlayers().size();
    int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
    String bukkitVersion = Bukkit.getVersion();
    bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);

    // OS/Java specific data
    String javaVersion = System.getProperty("java.version");
    String osName = System.getProperty("os.name");
    String osArch = System.getProperty("os.arch");
    String osVersion = System.getProperty("os.version");
    int coreCount = Runtime.getRuntime().availableProcessors();

    JSONObject data = new JSONObject();

    data.put("serverUUID", serverUUID);

    data.put("playerAmount", playerAmount);
    data.put("onlineMode", onlineMode);
    data.put("bukkitVersion", bukkitVersion);

    data.put("javaVersion", javaVersion);
    data.put("osName", osName);
    data.put("osArch", osArch);
    data.put("osVersion", osVersion);
    data.put("coreCount", coreCount);

    return data;
}
 
开发者ID:Soldier233,项目名称:ArchersBattle,代码行数:36,代码来源:Metrics.java

示例5: checkOnline

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void checkOnline() {
	if (!Bukkit.getOnlineMode()) {
		Bukkit.getConsoleSender().sendMessage("§6[!] §f이 서버는 오프라인 서버입니다.");
		Bukkit.getConsoleSender().sendMessage("§6[!] §f온라인으로 바꾸는 것을 권장드립니다.");
	}
}
 
开发者ID:SkyLightQP,项目名称:ItemUtility,代码行数:7,代码来源:Util.java

示例6: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Gets the server specific data.
 *
 * @return The server specific data.
 */
private JSONObject getServerData() {
    // Minecraft specific data
    int playerAmount;
    try {
        // Around MC 1.8 the return type was changed to a collection from an array,
        // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
        Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
        playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
                ? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
                : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
    } catch (Exception e) {
        playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
    }
    int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
    String bukkitVersion = org.bukkit.Bukkit.getVersion();
    bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);

    // OS/Java specific data
    String javaVersion = System.getProperty("java.version");
    String osName = System.getProperty("os.name");
    String osArch = System.getProperty("os.arch");
    String osVersion = System.getProperty("os.version");
    int coreCount = Runtime.getRuntime().availableProcessors();

    JSONObject data = new JSONObject();

    data.put("serverUUID", serverUUID);

    data.put("playerAmount", playerAmount);
    data.put("onlineMode", onlineMode);
    data.put("bukkitVersion", bukkitVersion);

    data.put("javaVersion", javaVersion);
    data.put("osName", osName);
    data.put("osArch", osArch);
    data.put("osVersion", osVersion);
    data.put("coreCount", coreCount);

    return data;
}
 
开发者ID:Slaymd,项目名称:CaulCrafting,代码行数:46,代码来源:Metrics.java

示例7: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Gets the server specific data.
 *
 * @return The server specific data.
 */
private JSONObject getServerData() {
    // Minecraft specific data
    int playerAmount;
    try {
        // Around MC 1.8 the return type was changed to a collection from an array,
        // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
        final Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
        playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
                ? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
                : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
    } catch (final Exception e) {
        playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
    }
    final int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
    String bukkitVersion = org.bukkit.Bukkit.getVersion();
    bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);

    // OS/Java specific data
    final String javaVersion = System.getProperty("java.version");
    final String osName = System.getProperty("os.name");
    final String osArch = System.getProperty("os.arch");
    final String osVersion = System.getProperty("os.version");
    final int coreCount = Runtime.getRuntime().availableProcessors();

    final JSONObject data = new JSONObject();

    data.put("serverUUID", serverUUID);

    data.put("playerAmount", playerAmount);
    data.put("onlineMode", onlineMode);
    data.put("bukkitVersion", bukkitVersion);

    data.put("javaVersion", javaVersion);
    data.put("osName", osName);
    data.put("osArch", osArch);
    data.put("osVersion", osVersion);
    data.put("coreCount", coreCount);

    return data;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:46,代码来源:Metrics.java

示例8: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Gets the server specific data.
 *
 * @return The server specific data.
 */
private JSONObject getServerData() {
    // Minecraft specific data
    int playerAmount;
    try {
        // Around MC 1.8 the return type was changed to a collection from an array,
        // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
        Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
        playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
                ? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
                : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
    } catch (Exception e) {
        playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
    }
    int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
    String bukkitVersion = Bukkit.getVersion();
    bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);

    // OS/Java specific data
    String javaVersion = System.getProperty("java.version");
    String osName = System.getProperty("os.name");
    String osArch = System.getProperty("os.arch");
    String osVersion = System.getProperty("os.version");
    int coreCount = Runtime.getRuntime().availableProcessors();

    JSONObject data = new JSONObject();

    data.put("serverUUID", serverUUID);

    data.put("playerAmount", playerAmount);
    data.put("onlineMode", onlineMode);
    data.put("bukkitVersion", bukkitVersion);

    data.put("javaVersion", javaVersion);
    data.put("osName", osName);
    data.put("osArch", osArch);
    data.put("osVersion", osVersion);
    data.put("coreCount", coreCount);

    return data;
}
 
开发者ID:BtoBastian,项目名称:bStats-Metrics,代码行数:46,代码来源:MetricsLite.java

示例9: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Gets the server specific data.
 *
 * @return The server specific data.
 */
private JSONObject getServerData() {
	// Minecraft specific data
	int playerAmount;
	try {
		// Around MC 1.8 the return type was changed to a collection from an array,
		// This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
		Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
		playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
				? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
				: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
	} catch (Exception e) {
		playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
	}
	int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
	String bukkitVersion = org.bukkit.Bukkit.getVersion();
	bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);
	
	// OS/Java specific data
	String javaVersion = System.getProperty("java.version");
	String osName = System.getProperty("os.name");
	String osArch = System.getProperty("os.arch");
	String osVersion = System.getProperty("os.version");
	int coreCount = Runtime.getRuntime().availableProcessors();
	
	JSONObject data = new JSONObject();
	
	data.put("serverUUID", serverUUID);
	
	data.put("playerAmount", playerAmount);
	data.put("onlineMode", onlineMode);
	data.put("bukkitVersion", bukkitVersion);
	
	data.put("javaVersion", javaVersion);
	data.put("osName", osName);
	data.put("osArch", osArch);
	data.put("osVersion", osVersion);
	data.put("coreCount", coreCount);
	
	return data;
}
 
开发者ID:RadBuilder,项目名称:EmojiChat,代码行数:46,代码来源:Metrics.java

示例10: getServerData

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Gets the server specific data.
 *
 * @return The server specific data.
 */
private JSONObject getServerData() {
    // Minecraft specific data
    int playerAmount;
    try {
        // Around MC 1.8 the return type was changed to a collection from an array,
        // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
        final Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
        playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
                ? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
                : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
    } catch (final Exception e) {
        playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
    }
    final int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
    String bukkitVersion = Bukkit.getVersion();
    bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);

    // OS/Java specific data
    final String javaVersion = System.getProperty("java.version");
    final String osName = System.getProperty("os.name");
    final String osArch = System.getProperty("os.arch");
    final String osVersion = System.getProperty("os.version");
    final int coreCount = Runtime.getRuntime().availableProcessors();

    final JSONObject data = new JSONObject();

    data.put("serverUUID", serverUUID);

    data.put("playerAmount", playerAmount);
    data.put("onlineMode", onlineMode);
    data.put("bukkitVersion", bukkitVersion);

    data.put("javaVersion", javaVersion);
    data.put("osName", osName);
    data.put("osArch", osArch);
    data.put("osVersion", osVersion);
    data.put("coreCount", coreCount);

    return data;
}
 
开发者ID:Shynixn,项目名称:AstralEdit,代码行数:46,代码来源:Metrics.java


注:本文中的org.bukkit.Bukkit.getOnlineMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。