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


Java FMLServerHandler类代码示例

本文整理汇总了Java中net.minecraftforge.fml.server.FMLServerHandler的典型用法代码示例。如果您正苦于以下问题:Java FMLServerHandler类的具体用法?Java FMLServerHandler怎么用?Java FMLServerHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: PlayerLoggedOut

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
 public void PlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent evt) {

if(Main.debug==1)System.out.println(evt.player.getName() + " called PlayentLoggedOut");
MinecraftServer minecraftServer = FMLServerHandler.instance().getServer();
String brut = minecraftServer.getPlayerList().getPlayerByUsername(evt.player.getName()).connection.getNetworkManager().getRemoteAddress().toString().replaceAll("/", "");
int lenght = brut.length();
brut = brut.substring(0, lenght-6);


if(Integer.parseInt((String) Main.config.get("iplogin")) > 0 && !Main.ips.containsKey(brut) && Main.logged.contains(evt.player.getName())){
	Main.ips.put(brut, 0);
	}


Main.logged.remove(evt.player.getName());
Main.posX.remove(evt.player.getName());
Main.posY.remove(evt.player.getName());
Main.posZ.remove(evt.player.getName());
Main.time.remove(evt.player.getName());
}
 
开发者ID:Fungie2134,项目名称:AuthMod,代码行数:22,代码来源:PlayerLoggedOut.java

示例2: getTabCompletionOptions

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@Override
public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) {
    if (args.length == 1) {
        return getListOfStringsMatchingLastWord(args, "set", "timeout", "reset", "reloadconfig");
    }
    else if (args.length == 2) {
        if (args[0].equals("set")) {
            return getListOfStringsMatchingLastWord(args, "breaktime", "maxtimeon", "globalmaxtimeon", "globalbreaktime");
        }
        else if (args[0].equals("timeout") || args[0].equals("reset")) {
            return getListOfStringsMatchingLastWord(args, FMLServerHandler.instance().getServer().getAllUsernames());
        }
    }
    else if (args.length == 3) {
        if (args[1].equals("breaktime") || args[1].equals("maxtimeon")) {
            return getListOfStringsMatchingLastWord(args, FMLServerHandler.instance().getServer().getAllUsernames());
        }
    }
    return super.getTabCompletionOptions(server, sender, args, pos);
}
 
开发者ID:kihira,项目名称:BeProductive,代码行数:21,代码来源:BeProductive.java

示例3: getTPSDetails

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
/**
 * Gets the world tps details from a provided dimensional ID.
 *
 * @param dimension Dimensional ID.
 * @return String[] containing relevant data.
 */
@SuppressWarnings("unchecked")
public String[] getTPSDetails(final int dimension) {
    List<String> list = new ArrayList<String>(0x10);

    WorldServer world = FMLServerHandler.instance().getServer().getWorld(dimension);
    List<Entity> entities = world.getLoadedEntityList();

    list.add("Uptime: " + NumberFormatter.millisecondsAsString((long) timeLapse.getEffectiveTimeSince()));
    list.add("Dimension [" + dimension + ']' + world.getProviderName());
    list.add("Players online: (" + world.playerEntities.size() + "): " + getPlayersForDimension(dimension));
    list.add("Item entity count: " + getAmountOfItemEntities(entities));
    list.add("Hostile entities: " + getAmountOfHostileEntity(entities));
    list.add("Friendly entities: " + getAmountOfPassiveEntity(entities));
    list.add("Living entities: " + getAmountOfLivingEntity(entities));
    list.add("Total entities: " + entities.size());
    list.add("Chunks loaded: " + world.getChunkProvider().getLoadedChunkCount());
    list.add("TPS: " + NumberFormatter.millisecondsAsString((long) getWorldTickTime(world)) + "ms[" + getWorldTPS(world) + ']');

    return list.toArray(new String[list.size()]);
}
 
开发者ID:hockeyhurd,项目名称:HCoreLib,代码行数:27,代码来源:SystemInfo.java

示例4: PlayerLoggedIn

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
  public void PlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent evt) {
	if(Main.debug==1)System.out.println(evt.player.getName() + " called PlayentLoggedIn");
	Main.posX.put(evt.player.getName(), evt.player.posX);
	Main.posY.put(evt.player.getName(), evt.player.posY);
	Main.posZ.put(evt.player.getName(), evt.player.posZ);
	Main.time.put(evt.player.getName(), 0);
	
	MinecraftServer minecraftServer = FMLServerHandler.instance().getServer();
	String brut = minecraftServer.getPlayerList().getPlayerByUsername(evt.player.getName()).connection.getNetworkManager().getRemoteAddress().toString().replaceAll("/", "");
	int lenght = brut.length();
	brut = brut.substring(0, lenght-6);
	
	if(Integer.parseInt((String) Main.config.get("iplogin")) > 0 && Main.ips.containsKey(brut)){
		Main.logged.add(evt.player.getName());
		evt.player.addChatMessage(new TextComponentString(TextFormatting.GREEN + (String)Main.config.get("iploginmessage")));	
		Main.ips.remove(brut);
		Main.time.remove(evt.player.getName());
	}
	
	if(!Main.logged.contains(evt.player.getName())){
	if(Main.passwords.containsKey(evt.player.getName())){
	evt.player.addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("loginmessage")));
	} else {
	evt.player.addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("registermessage")));
	}
	}
	
}
 
开发者ID:Fungie2134,项目名称:AuthMod,代码行数:30,代码来源:PlayerLoggedIn.java

示例5: onMessage

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@Override
public R onMessage(final M message, final MessageContext ctx) 
{
	if(ctx.side == Side.SERVER)
	{
		FMLServerHandler.instance().getServer().addScheduledTask(new Runnable() 
		{
			@Override
			public void run() 
			{
				processMessage(message, ctx);
			}
			
		});
	}
	else if(ctx.side == Side.CLIENT)
	{
		Minecraft.getMinecraft().addScheduledTask(new Runnable() 
		{
			@Override
			public void run() 
			{
				processMessage(message, ctx);
			}
			
		});
	}
	return null;
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:30,代码来源:PacketHandlerBase.java

示例6: handleServerSafe

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@Override
public void handleServerSafe(NetHandlerPlayServer netHandler) {
	EntityPlayerMP playerMP = FMLServerHandler.instance().getServer().getPlayerList().getPlayerByUUID(playerUUID);
	if(playerMP !=null){
		CrystalModNetwork.sendTo(new PacketDimensionNameRequest(dimension, StringUtils.getDimensionName(playerUUID, dimension)), playerMP);
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:8,代码来源:PacketDimensionNameRequest.java

示例7: getUnCachedProfile

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
private static GameProfile getUnCachedProfile(UUID uuid){
	GameProfile profile = new GameProfile(uuid, ProfileUtil.getUnCachedName(uuid));
	if(FMLCommonHandler.instance().getSide() == Side.CLIENT){
		FMLClientHandler.instance().getClient().getSessionService().fillProfileProperties(profile, true);
	} else {
		FMLServerHandler.instance().getServer().getMinecraftSessionService().fillProfileProperties(profile, true);
	}
	return profile;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:10,代码来源:ProfileUtil.java

示例8: queryNameFromUUID

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@Override
public String queryNameFromUUID(UUID uuid)
{
    PlayerList playerList = FMLServerHandler.instance().getServer().getPlayerList();
    if (playerList == null)
        return null;
    EntityPlayer player = playerList.getPlayerByUUID(uuid);
    if (player != null)
        return player.getName();
    return null;
}
 
开发者ID:gigaherz,项目名称:Enderthing,代码行数:12,代码来源:ServerProxy.java

示例9: getSkinInfoFormPlayerName

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@Nullable
public static SkinInfo getSkinInfoFormPlayerName(String name) {
	EntityPlayerMP playerMP = FMLServerHandler.instance().getServer().getPlayerList().getPlayerByUsername(name);
	if (playerMP != null) {
		SkinInfo info = playerMP.getCapability(skin_info, null);
		return info != null ? info : null;
	}
	NBTTagCompound nbt = NBTHelper.getNBTFromPlayerName(name);
	if (nbt != null) {
		
	}
	return null;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:14,代码来源:SkinCore.java

示例10: getWorldDirectory

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@Nullable
public static final File getWorldDirectory() {
	if (DimensionManager.getWorld(0) != null)
		return DimensionManager.getWorld(0).getSaveHandler().getWorldDirectory();
	else if (FMLServerHandler.instance().getServer() != null) {
		MinecraftServer server = FMLServerHandler.instance().getServer();
		return server.getActiveAnvilConverter().getSaveLoader(server.getFolderName(), false).getWorldDirectory();
	} else
		return null;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:11,代码来源:Always.java

示例11: finish

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
@Override
public void finish(TaskResult result) {
    if (result == TaskResult.SUCCESS) {
        MinecraftServer s = FMLCommonHandler.instance().getMinecraftServerInstance();
        PlayerList pl = s.getPlayerList();
        EntityPlayerMP p = pl.getPlayerByUUID(UUID.fromString(targetPlayerUUID));
        if (p != null && finishMsg != null)
            p.sendMessage(new TextComponentString("§2[IIDY]§r§e " + finishMsg + ""));
        else
            IsItDoneYet.proxy.log.error("Error while sending notifaction to player!");
    } else
        FMLServerHandler.instance().getServer().getPlayerList().getPlayerByUUID(UUID.fromString(targetPlayerUUID)).sendMessage(new TextComponentString(
                ITask.FORMAT_RED + "[IIDY Task Failed] " + ITask.FORMAT_YELLOW + finishMsg + ITask.FORMAT_RESET));
}
 
开发者ID:univrsal,项目名称:IIDY,代码行数:15,代码来源:BlockStateTask.java

示例12: getGameProfileForPlayer

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
private GameProfile getGameProfileForPlayer(String playerName) throws CommandException {
    GameProfile profile = FMLServerHandler.instance().getServer().getPlayerList().getPlayerByUsername(playerName).getGameProfile();
    if (profile == null) {
        throw new CommandException("Unable to find the profile for the player %s", playerName);
    }
    return profile;
}
 
开发者ID:kihira,项目名称:BeProductive,代码行数:8,代码来源:BeProductive.java

示例13: getDataDirectory

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
public File getDataDirectory() {
    final File file = FMLServerHandler.instance().getServer().getFile(".");
    try {
        return file.getCanonicalFile();
    } catch (final IOException e) {
        FMLLog.getLogger().info("Could not canonize path!", e);
    }
    return file;
}
 
开发者ID:Dark32,项目名称:NordMod,代码行数:10,代码来源:CommonProxy.java

示例14: broadcastChatMessage

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
/**
 * サーバー上にいる全てのプレイヤーのチャットにメッセージを出力する。<BR>
 * クライアントから呼び出すことは出来ない。
 * @param format 書式指定文字列
 * @param args   formatに書式指定文字がある時のみそれらを置き換える値
 */
public static void broadcastChatMessage(String format, Object ... args)
{
	FMLServerHandler fmlServer = FMLServerHandler.instance();
	if(fmlServer == null)
		return;
	MinecraftServer server = fmlServer.getServer();
	if((server == null) || (server.worlds == null))
		return;
	for(WorldServer w : server.worlds)
		if(w != null)
			ModLogger.chatNotify(w, format, args);
}
 
开发者ID:a1lic,项目名称:McMod-CubicVillager,代码行数:19,代码来源:ModLogger.java

示例15: HarshenTemplate

import net.minecraftforge.fml.server.FMLServerHandler; //导入依赖的package包/类
protected HarshenTemplate(ResourceLocation location) {
	String s = location.getResourceDomain();
       String s1 = location.getResourcePath();
       InputStream stream = null;
       boolean flag;
       try
       {
       	stream = getClass().getResourceAsStream("/assets/" + HarshenCastle.MODID + "/structures/" + s1 + ".nbt");
           NBTTagCompound compound = CompressedStreamTools.readCompressed(stream);
           if (!compound.hasKey("DataVersion", 99))
           {
           	compound.setInteger("DataVersion", 500);
           }
           Template template = new Template();
           DataFixer fixer;
           try
           {
           	fixer = Minecraft.getMinecraft().getDataFixer();
           }
           catch (Throwable e) {
			fixer = FMLServerHandler.instance().getDataFixer();
		}
           template.read(fixer.process(FixTypes.STRUCTURE, compound));
           this.blocks.clear();
           NBTTagList nbttaglist = compound.getTagList("size", 3);
           this.size = new BlockPos(nbttaglist.getIntAt(0), nbttaglist.getIntAt(1), nbttaglist.getIntAt(2));
           NBTTagList nbttaglist4 = compound.getTagList("pos", 3);
           if(nbttaglist4.hasNoTags())
           	this.pos = BlockPos.ORIGIN;
           else
               this.pos = new BlockPos(nbttaglist4.getIntAt(0), nbttaglist4.getIntAt(1), nbttaglist4.getIntAt(2));
           BasicPalette template$basicpalette = new BasicPalette();
           NBTTagList nbttaglist1 = compound.getTagList("palette", 10);

           for (int i = 0; i < nbttaglist1.tagCount(); ++i)
           {
               template$basicpalette.addMapping(NBTUtil.readBlockState(nbttaglist1.getCompoundTagAt(i)), i);
           }

           NBTTagList nbttaglist3 = compound.getTagList("blocks", 10);
           for (int j = 0; j < nbttaglist3.tagCount(); ++j)
           {
               NBTTagCompound nbttagcompound = nbttaglist3.getCompoundTagAt(j);
               NBTTagList nbttaglist2 = nbttagcompound.getTagList("pos", 3);
               BlockPos blockpos = new BlockPos(nbttaglist2.getIntAt(0), nbttaglist2.getIntAt(1), nbttaglist2.getIntAt(2));
               IBlockState iblockstate = template$basicpalette.stateFor(nbttagcompound.getInteger("state"));
               NBTTagCompound nbttagcompound1;

               if (nbttagcompound.hasKey("nbt"))
               {
                   nbttagcompound1 = nbttagcompound.getCompoundTag("nbt");
               }
               else
               {
                   nbttagcompound1 = null;
               }

               if(!(iblockstate.getBlock() instanceof BlockStructure))
               	this.blocks.add(new Template.BlockInfo(blockpos, iblockstate, nbttagcompound1));
           }
       }
       catch (Throwable var10)
       {
       }
       finally
       {
           IOUtils.closeQuietly(stream);
       }
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:70,代码来源:HarshenTemplate.java


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