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


Java MinecraftServer.isSinglePlayer方法代码示例

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


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

示例1: clientConnectedtoServer

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@SubscribeEvent
public void clientConnectedtoServer(FMLNetworkEvent.ServerConnectionFromClientEvent event)
{
    if (!CreeperHost.instance.active)
        return;
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    if (server == null || server.isSinglePlayer() || discoverMode != Discoverability.PUBLIC)
        return;

    INetHandlerPlayServer handler = event.handler;
    if (handler instanceof NetHandlerPlayServer)
    {
        EntityPlayerMP entity = ((NetHandlerPlayServer) handler).playerEntity;
        playersJoined.add(entity.getUniqueID());
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:17,代码来源:CreeperHostServer.java

示例2: clientConnectedtoServer

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@SubscribeEvent
public void clientConnectedtoServer(FMLNetworkEvent.ServerConnectionFromClientEvent event)
{
    if (!CreeperHost.instance.active)
        return;
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    if (server == null || server.isSinglePlayer() || discoverMode != Discoverability.PUBLIC)
        return;

    INetHandlerPlayServer handler = event.getHandler();
    if (handler instanceof NetHandlerPlayServer)
    {
        EntityPlayerMP entity = ((NetHandlerPlayServer)handler).playerEntity;
        playersJoined.add(entity.getUniqueID());
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:17,代码来源:CreeperHostServer.java

示例3: getSaveFolder

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
public File getSaveFolder()
{
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    if (server != null && !server.isSinglePlayer())
        return server.getFile("");
    return DimensionManager.getCurrentSaveRootDirectory();
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:8,代码来源:CreeperHostServer.java

示例4: getStringUUIDFromName

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
public static String getStringUUIDFromName(String p_152719_0_)
{
    if (!StringUtils.isNullOrEmpty(p_152719_0_) && p_152719_0_.length() <= 16)
    {
        final MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(p_152719_0_);

        if (gameprofile != null && gameprofile.getId() != null)
        {
            return gameprofile.getId().toString();
        }
        else if (!minecraftserver.isSinglePlayer() && minecraftserver.isServerInOnlineMode())
        {
            final List<GameProfile> list = Lists.<GameProfile>newArrayList();
            ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback()
            {
                public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_)
                {
                    minecraftserver.getPlayerProfileCache().addEntry(p_onProfileLookupSucceeded_1_);
                    list.add(p_onProfileLookupSucceeded_1_);
                }
                public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_)
                {
                    PreYggdrasilConverter.LOGGER.warn((String)("Could not lookup user whitelist entry for " + p_onProfileLookupFailed_1_.getName()), (Throwable)p_onProfileLookupFailed_2_);
                }
            };
            lookupNames(minecraftserver, Lists.newArrayList(new String[] {p_152719_0_}), profilelookupcallback);
            return list.size() > 0 && ((GameProfile)list.get(0)).getId() != null ? ((GameProfile)list.get(0)).getId().toString() : "";
        }
        else
        {
            return EntityPlayer.getUUID(new GameProfile((UUID)null, p_152719_0_)).toString();
        }
    }
    else
    {
        return p_152719_0_;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:PreYggdrasilConverter.java

示例5: convertMobOwnerIfNeeded

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
public static String convertMobOwnerIfNeeded(final MinecraftServer server, String username)
{
    if (!StringUtils.isNullOrEmpty(username) && username.length() <= 16)
    {
        GameProfile gameprofile = server.getPlayerProfileCache().getGameProfileForUsername(username);

        if (gameprofile != null && gameprofile.getId() != null)
        {
            return gameprofile.getId().toString();
        }
        else if (!server.isSinglePlayer() && server.isServerInOnlineMode())
        {
            final List<GameProfile> list = Lists.<GameProfile>newArrayList();
            ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback()
            {
                public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_)
                {
                    server.getPlayerProfileCache().addEntry(p_onProfileLookupSucceeded_1_);
                    list.add(p_onProfileLookupSucceeded_1_);
                }
                public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_)
                {
                    PreYggdrasilConverter.LOGGER.warn("Could not lookup user whitelist entry for {}", new Object[] {p_onProfileLookupFailed_1_.getName(), p_onProfileLookupFailed_2_});
                }
            };
            lookupNames(server, Lists.newArrayList(new String[] {username}), profilelookupcallback);
            return !list.isEmpty() && ((GameProfile)list.get(0)).getId() != null ? ((GameProfile)list.get(0)).getId().toString() : "";
        }
        else
        {
            return EntityPlayer.getUUID(new GameProfile((UUID)null, username)).toString();
        }
    }
    else
    {
        return username;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:39,代码来源:PreYggdrasilConverter.java

示例6: initDimension

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
public static void initDimension(int dim)
{
    WorldServer overworld = getWorld(0);
    if (overworld == null)
    {
        throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!");
    }
    try
    {
        DimensionManager.getProviderType(dim);
    }
    catch (Exception e)
    {
        System.err.println("Cannot Hotload Dim: " + e.getMessage());
        return; // If a provider hasn't been registered then we can't hotload the dim
    }
    MinecraftServer mcServer = overworld.getMinecraftServer();
    ISaveHandler savehandler = overworld.getSaveHandler();
    //WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo());

    WorldServer world = (dim == 0 ? overworld : (WorldServer)(new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler).init()));
    world.addEventListener(new ServerWorldEventHandler(mcServer, world));
    MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
    if (!mcServer.isSinglePlayer())
    {
        world.getWorldInfo().setGameType(mcServer.getGameType());
    }

    mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:DimensionManager.java

示例7: checkPermission

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
/**
 * Check if the given ICommandSender has permission to execute this command
 */
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
{
    return server.isSinglePlayer() || super.checkPermission(server, sender);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:CommandShowSeed.java


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