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


Java PlayerEvent.PlayerLoggedInEvent方法代码示例

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


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

示例1: onPlayerLoggedIn

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event)
{
	PlayerInformation playerInfo = (PlayerInformation) event.player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
	Stats statsCap = (Stats) event.player.getCapability(CapabilityPlayerStats.STATS, null);

	if (playerInfo != null && playerInfo.getPlayerClass() == 0 && statsCap != null && statsCap.getMaxMana() == 0)
	{
		// send Class Selection gui to client on first join.
		LootSlashConquer.network.sendTo(new PacketClassGui(), (EntityPlayerMP) event.player);
		
		// setup max mana + send it to client.
		statsCap.setMaxMana(100);
		statsCap.setMana(statsCap.getMaxMana());
		statsCap.setManaPerSecond(5);
		statsCap.setHealthPerSecond(1);
		LootSlashConquer.network.sendTo(new PacketUpdateStats(statsCap), (EntityPlayerMP) event.player);
	}
	else if (playerInfo != null && playerInfo.getPlayerClass() > 0)
		LootSlashConquer.network.sendTo(new PacketUpdatePlayerInformation(playerInfo), (EntityPlayerMP) event.player);
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:22,代码来源:EventPlayerLoggedIn.java

示例2: onPlayerLogin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event){
    if(DifficultyManager.enabled && ProgressiveDifficulty.oldConfigExists){
        TextComponentString linkComponent = new TextComponentString("[Progressive Difficulty Wiki]");
        ITextComponent[] chats = new ITextComponent[]{
                new TextComponentString("[ProgressiveDifficulty] It looks like you have a version 1.0 " +
                        "config file. Please check out the Progressive Difficulty Wiki for instructions on how" +
                        " to migrate to a version 2.0 config file."),
                linkComponent
        };
        ClickEvent goLinkEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,"https://github.com/talandar/ProgressiveDifficulty/wiki/2.0-Transition");
        linkComponent.getStyle().setClickEvent(goLinkEvent);
        linkComponent.getStyle().setColor(TextFormatting.BLUE);
        linkComponent.getStyle().setUnderlined(true);
        ChatUtil.sendChat(event.player,chats);
    }
}
 
开发者ID:talandar,项目名称:ProgressiveDifficulty,代码行数:18,代码来源:EventHandler.java

示例3: playerJoin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerJoin(PlayerEvent.PlayerLoggedInEvent event) {
    ItemStack guideBookStack = new ItemStack(Items.WRITTEN_BOOK, 1);
    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setString("title", new TextComponentTranslation("book.title.guide").getFormattedText());
    nbt.setString("author", new TextComponentTranslation("book.author.guide").getFormattedText());
    nbt.setInteger("generation", 2);
    NBTTagList nbtList = new NBTTagList();
    for (int index = 0; index <= 15; index++)
        nbtList.appendTag(new NBTTagString(String.format("{\"text\": \"%s\"}", new TextComponentTranslation(String.format("book.pages.guide.%d", index)).getFormattedText())));
    nbt.setTag("pages", nbtList);
    guideBookStack.setTagCompound(nbt);
    if (!event.player.getEntityData().getBoolean("genera.joined_before")) {
        event.player.getEntityData().setBoolean("genera.joined_before", true);
        event.player.getEntityData().setInteger("genera.sacrifices_made", 0);
        event.player.addItemStackToInventory(guideBookStack);
    }
}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:19,代码来源:EventHandler.java

示例4: onLogin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onLogin(PlayerEvent.PlayerLoggedInEvent event) {
	if (FMLCommonHandler.instance().getMinecraftServerInstance() != null)
		if (event.player instanceof EntityPlayerMP) {
			Overlord.logDebug("Sending " + event.player.getName() + " client their squads.");
			PacketDispatcher.sendTo(new SetSquadsMessage(Squads.getInstance().getSquadsFor(event.player.getUniqueID())), (EntityPlayerMP) event.player);
			if (ConfigValues.TEAMHACK) {
				ScorePlayerTeam team = event.player.getEntityWorld().getScoreboard().getTeam(event.player.getName());
				//noinspection ConstantConditions
				if (team == null) {
					team = event.player.getEntityWorld().getScoreboard().createTeam(event.player.getName());
					team.setColor(TextFormatting.values()[teamColor++ % 15]);
				}
				event.player.getEntityWorld().getScoreboard().addPlayerToTeam(event.player.getName(), team.getName());
			}
		}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:18,代码来源:CommonEvents.java

示例5: onPlayerLoggedInEvent

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerLoggedInEvent(PlayerEvent.PlayerLoggedInEvent e)
{
    if(!e.player.world.isRemote)
    {
        SavedData data = SavedData.get(e.player.world);
        if(data != null)
        {
            ChunkLoaders cl = data.getChunkLoaders();
            cl.updateLoginTimestamp(e.player.getUniqueID().toString(), System.currentTimeMillis());
            data.setChunkLoaders(cl);

            // Enable all of the chunk loaders this player owns
            for(ChunkLoaderPos loaderPos : cl.getLoaders())
            {
                ChunkLoaderTileEntity te = (ChunkLoaderTileEntity)e.player.world.getTileEntity(loaderPos.pos);
                if(te != null)
                {
                    te.enable();
                }
            }
        }
    }
}
 
开发者ID:CorwinJV,项目名称:AChunkLoader,代码行数:25,代码来源:PlayerActivity.java

示例6: onPlayerLogin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent e) {
	if (MCFlux.UPDATE_CHECK_FINISHED && !MCFlux.NEWER_VERSION.isEmpty() && e.player instanceof EntityPlayerMP)
		MCFluxNetwork.to(Msg.newVersion(MCFlux.NEWER_VERSION), (EntityPlayerMP) e.player);
	if (SpecialEventHandler.getEventStatus() == SpecialEventHandler.EventStatus.DOWNLOADED) {
		final SpecialEventReceiver ser = e.player.getCapability(SpecialEventReceiver.SELF_CAP, null);
		if (ser != null) {
			final int[] seids = SpecialEventHandler.getEventIDs();
			for (int l : seids) {
				if (ser.alreadyReceived(l))
					continue;
				final ItemStack is = new ItemStack(MCFluxResources.SPECIAL);
				is.setTagInfo("seid", new NBTTagInt(l));
				e.player.dropItem(is, false, true);
				ser.addReceived(l);
			}
		}
	}
}
 
开发者ID:Szewek,项目名称:Minecraft-Flux,代码行数:20,代码来源:MCFluxEvents.java

示例7: onJoin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onJoin(PlayerEvent.PlayerLoggedInEvent e) {
    if (e.player.getCapability(FTJFactoryProvider.FTJ_CAPABILITY, null).getFTJ()) {
        ISkillsCapability skills = e.player.getCapability(SkillsFactoryProvider.SKILLS_CAPABILITY, null);
        ILevelCapability lvl = e.player.getCapability(LEVEL_CAPABILITY, null);
        ISpechialCapability spe = e.player.getCapability(SpechialFactoryProvider.SPECHIAL_CAPABILITY, null);
        Item lvliningCrystal = ItemInit.lvlingCrystall;
        ItemStack lvlingcrystallS = new ItemStack(lvliningCrystal);
        lvlingcrystallS.setCount(1);
        e.player.inventory.addItemStackToInventory(lvlingcrystallS);
        e.player.getCapability(WaterFactoryProvider.WATER_CAPABILITY, null).setWater(100);
        lvl.initNewplayer();
        skills.setAll(10);
        spe.setAll(0);
        e.player.getCapability(FTJFactoryProvider.FTJ_CAPABILITY, null).setFTJ(false);
    }
    e.player.getCapability(IAdvProvider.Adv_Inv, null).updateClient(e.player);
    updatePlayerSpechial(e.player);
    updatePlayerSkills(e.player);
    updatePlayerLevel(e.player);
}
 
开发者ID:Hoijima,项目名称:Fallout_Equestria,代码行数:22,代码来源:UpdateEvents.java

示例8: playerLoggedIn

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
    {
        // Give the first achievement, because it is stupid and nobody cares.
        // If you're using this mod, you've probably opened your inventory before anyways.
        StatUtil.IFzStat stat = StatUtil.load(event.player, AchievementList.openInventory);
        if (stat.get() <= 0 && FMLCommonHandler.instance().getSide() == Side.CLIENT) {
            stat.set(-1);
            stat.set(300); // Literally, hundreds of times! :D
            Core.logInfo("Achievement Get! %s, you've opened your inventory hundreds of times already! Yes! You're welcome!", event.player.getName());
            // NORELEASE: Verify this works.
        }
    }
    {
        MinecraftServer ms = MinecraftServer.getServer();
        if (ms != null && ms.getTickCounter() >= ms.tickTimeArray.length) {
            //Startup time is ignored; early birds will get a TPS packet soon enough
            MiscNet.channel.sendTo(MiscNet.makeTpsReportPacket(getTpsRatio()), (EntityPlayerMP) event.player);
        }
    }
    fixReachDistance((EntityPlayerMP)event.player);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:23,代码来源:MiscellaneousNonsense.java

示例9: onPlayerLogin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
    NBTTagCompound tag = EntityHelper.getPlayerPersistentData(event.player, "GuiltTripSave");
    int size = tag.getInteger("size");
    for(int i = 0; i < size; i++)
    {
        ArrayList<KillInfo> kills = GuiltTrip.eventHandlerServer.playerKills.get(event.player.getName());
        if(kills == null)
        {
            kills = new ArrayList<>();
            GuiltTrip.eventHandlerServer.playerKills.put(event.player.getName(), kills);
        }

        kills.add(KillInfo.createKillInfoFromTag(tag.getCompoundTag("kill_" + i)));
    }
    GuiltTrip.eventHandlerServer.updatePlayersOnKill(event.player.getName(), null);
    GuiltTrip.eventHandlerServer.updatePlayersOnKill(null, event.player.getName());
}
 
开发者ID:iChun,项目名称:GuiltTrip,代码行数:20,代码来源:EventHandlerServer.java

示例10: PlayerLoggedInEvent

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void PlayerLoggedInEvent(PlayerEvent.PlayerLoggedInEvent event) {
	if (event.player instanceof EntityPlayerMP) {
		recalcTeams();

		WarsMod.proxy.genTag(event.player);

		int totalKills = event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getInteger("warsmod_totalKill");
		int killStreak = event.player.getEntityData().getInteger("warsmod_killstreak");
		int deaths = event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getInteger("warsmod_deaths");

		PacketDispatcher.sendTo(new PacketKills(totalKills, killStreak, deaths), (EntityPlayerMP) event.player);

		PacketDispatcher.sendTo(new PacketTeams(redPlayers, greenPlayers, bluePlayers, yellowPlayers), (EntityPlayerMP) event.player);

		WarsSavedData savedWarsData = WarsSavedData.get(event.player.worldObj);
		ItemStack playerBoots = event.player.inventory.getStackInSlot(36);// playerMP.inventory.armorItemInSlot(0);
		if (playerBoots == null) {
			if (!savedWarsData.editMode.editModeToggle) {
				scheduleDelayedGui((EntityPlayerMP) event.player);
			}
		}
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Wars-Mod,代码行数:25,代码来源:CommonEvents.java

示例11: playerLogin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event){
    if(event.player instanceof EntityPlayer && (event.player).getDisplayName().equals("Harry9137") || (event.player).getDisplayName().equals("helloneibghor")){
        EntityWings wings = new EntityWings(event.player.getEntityWorld(), event.player);
        wings.setPosition(event.player.posX, event.player.posY, event.player.posZ);
        event.player.getEntityWorld().spawnEntityInWorld(wings);

    }
    if(event.player.getDisplayName().equals("Harry9137") && event.player instanceof EntityPlayer){
        ((EntityPlayer) event.player).capabilities.allowFlying = true;

    }
    else if(event.player.getDisplayName().equals("helloneibghor") && event.player instanceof EntityPlayer){

        ((EntityPlayer)event.player).capabilities.allowFlying = true;

    }
    CreepTech.console.addText(event.player.getDisplayNameString());
}
 
开发者ID:Team-Radicool,项目名称:CreepTech,代码行数:20,代码来源:PlayerLoginHandler.java

示例12: onPlayerLogin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
    //This will send config data from the server to the client
    try
    {
        for (Field field : Settings.class.getDeclaredFields())
        {
            Object val = field.get(null);
            if (val.getClass().isArray() && !Arrays.asList(blacklistedSettingsFields).contains(field.getName()))
            {
                sendConfigInfo(field.getName(), val, (EntityPlayerMP) event.player);
            }
        }
    }
    catch (ReflectiveOperationException e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:VikeStep,项目名称:sprinkles_for_vanilla,代码行数:21,代码来源:NetworkHandler.java

示例13: onPlayerLogin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
	if(event.player instanceof EntityPlayerMP)
	{
		ServerConfigMessage msg = new ServerConfigMessage();
		msg.recipeVillagerSlabsIsRecovery = CommonProxy.recipeVillagerSlabsIsRecovery;
		SimpleNetworkWrapper netwrapper = CubicVillager.getProxy().simpleNetWrapper;
		netwrapper.sendTo(msg, (EntityPlayerMP)event.player);

		StringBuilder spawnedMessage = new StringBuilder(64);
		spawnedMessage.append("プレイヤー ")
			.append(((EntityPlayerMP)event.player).getName())
			.append(" がワールドに参加しました。設定を送信しました。");
		CubicVillager.LOG.info(spawnedMessage);
	}
}
 
开发者ID:a1lic,项目名称:McMod-CubicVillager,代码行数:18,代码来源:MyPlayerEvent.java

示例14: onPlayerJoin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) {
	BrewStorageHandler.getBrewStorage(event.player).ifPresent(data -> {
		if (event.player instanceof EntityPlayerMP) {
			data.syncToNear(event.player);
		}
	});
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:9,代码来源:BrewEvents.java

示例15: onPlayerLogin

import net.minecraftforge.fml.common.gameevent.PlayerEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
	if(event.player instanceof EntityPlayerMP) {
		NBTTagCompound data = event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
		IHardcoreRevival revival = event.player.getCapability(CapabilityHardcoreRevival.REVIVAL_CAPABILITY, null);
		if(revival != null) {
			CapabilityHardcoreRevival.REVIVAL_CAPABILITY.readNBT(revival, null, data.getCompoundTag("HardcoreRevival"));
		}

		NetworkHandler.instance.sendTo(new MessageDeathTime(revival != null ? revival.getDeathTime() : 0), (EntityPlayerMP) event.player);
		if(revival != null && revival.getDeathTime() >= ModConfig.maxDeathTicks) {
			NetworkHandler.instance.sendTo(new MessageDie(), (EntityPlayerMP) event.player);
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:16,代码来源:PlayerHandler.java


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