當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。