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


Java PlayerEvent类代码示例

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


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

示例1: onPlayerChangedDimension

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
  public void onPlayerChangedDimension(PlayerEvent.PlayerChangedDimensionEvent event)
  {
ServerPlayerBaseMagic player;
PacketLogIn packet;

player = Main.getPlayerServer((EntityPlayerMP) event.player);
   player.getPlayer().getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0d + (player.getLevel() - 1) * 0.5d);
packet = new PacketLogIn(player);
Packets.network.sendTo(packet, player.getPlayer());

if (Main.get_dungeon(event.toDim) != null)
	Main.get_dungeon(event.toDim).onPlayerJoin(player);

if (event.toDim == Main.DIM_ID)
	event.player.triggerAchievement(AchievementList.NEW_DIMENSION);
  }
 
开发者ID:GhostMonk3408,项目名称:MidgarCrusade,代码行数:18,代码来源:JoueurEvent.java

示例2: onPlayerLogout

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
  public void onPlayerLogout(PlayerEvent.PlayerLoggedOutEvent event)
  {
System.out.println("Logged out: " + event.player);

for (Dungeon d : Main.DUNGEONS)
{
	if (event.player.dimension == d.DIM_ID)
	{
		Main.getPlayerServer(event.player).travelToDimension(d.DIM_RETOUR, event.player.dimension);
		Main.log(event.player.getCommandSenderName() + " has disconnected into a dungeon");
		return ;
	}
}

  }
 
开发者ID:GhostMonk3408,项目名称:MidgarCrusade,代码行数:17,代码来源:ServerEvent.java

示例3: onPlayerLogin

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {

	event.player.addChatComponentMessage(new ChatComponentText("�b�lHello" + " " + "�e�l" + event.player.getDisplayName() + "�b�l!"));
	event.player.addChatComponentMessage(new ChatComponentText(/*/event.player.getDisplayName() + /*/"�a�l" + EpicProportionsMod.MODNAME + " " + "�2�lMade By:jtrent238"));
	event.player.addChatComponentMessage(new ChatComponentText(/*/event.player.getDisplayName() + /*/"�6�lYou are running" + "�b�l" + " " + EpicProportionsMod.MODVERSION + " " + "�6�lof" + "�6�l" + " " + EpicProportionsMod.MODNAME + "!"));
	//event.player.addChatComponentMessage(new ChatComponentText("�e�lLearn more at: �b�lhttp://bit.ly/FoodModWiki"));
	event.player.triggerAchievement(Achievements.achievementinstall);
	//event.player.addEntityCrashInfo(EpicProportionsMod.CRASHINFO);
	//event.player.clonePlayer(playerclone, true);
	event.player.extinguish();
	event.player.getDisplayName();
	//event.player.writeToNBT(EpicProportionsMod.NBTJOIN);
	event.player.getBedLocation();
	event.player.shouldHeal();
	event.getListenerList();
	event.hashCode();
	Minecraft.getSystemTime();
	Minecraft.isAmbientOcclusionEnabled();
	Minecraft.isGuiEnabled();
	Minecraft.getMinecraft();
	Minecraft.getGLMaximumTextureSize();
	Minecraft.isFancyGraphicsEnabled();
	//Log.getLog(arg0, arg1, arg2);
	//event.notifyAll();

	
}
 
开发者ID:jtrent238,项目名称:PopularMMOS-EpicProportions-Mod,代码行数:29,代码来源:OnJoinEvent.java

示例4: onCraft

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCraft(PlayerEvent.ItemCraftedEvent event) {
	if (event.crafting != null) {
		ItemStack rod = null;
		ItemStack toTransmute = null;
		ItemStack transmuted = event.crafting;
		for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++)
			if (event.craftMatrix.getStackInSlot(i) != null)
				if (event.craftMatrix.getStackInSlot(i).getItem() instanceof ITransmutationItem) {
					rod = event.craftMatrix.getStackInSlot(i).copy();
				} else {
					if (toTransmute != null)
						return;
					toTransmute = event.craftMatrix.getStackInSlot(i);
				}
		if (rod != null && toTransmute != null && transmuted != null) {
			((ITransmutationItem)rod.getItem()).transmute(rod, toTransmute.getItem(), toTransmute.getItemDamage(), 
					transmuted.getItem(), transmuted.getItemDamage());
			event.player.inventory.addItemStackToInventory(rod);
			if (!event.player.getEntityWorld().isRemote)
				DartCraft2.NETWORK.sendToAll(new DartCraftEffectPacket(event.player.getEntityWorld(), (int) event.player.posX, (int) event.player.posY, (int) event.player.posZ));
		}
	}
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:25,代码来源:TransmutationHandler.java

示例5: playerLoginEvent

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void playerLoginEvent(PlayerEvent.PlayerLoggedInEvent event) {
    //event.player.addChatComponentMessage(new ChatComponentText("Hallo " + event.player.getDisplayName()));
    if (event.player == null) {
        return;
    }

    // DEBUG
    //event.player.addChatComponentMessage(new ChatComponentText("Your Player-Interfaces are: "));

    for (InterfaceRegistry.InterfaceDataContainer dataContainer : InterfaceRegistry.getInterfacesOfPlayer(event.player.getUniqueID())) {
        // DEBUG
        //event.player.addChatComponentMessage(new ChatComponentText(String.format("x: %d, y: %d, z: %d", dataContainer.x, dataContainer.y, dataContainer.z)));
        TileEntityPlayerInterface te = ((TileEntityPlayerInterface) DimensionManager.getWorld(dataContainer.dimensionID).getTileEntity(dataContainer.x, dataContainer.y, dataContainer.z));

        if (te != null) {
            te.bindPlayer(event.player.getUniqueID());
        }
    }
}
 
开发者ID:Dragon9815,项目名称:PlayerInterfaceMod,代码行数:21,代码来源:PlimEventHandler.java

示例6: playerLogoutEvent

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void playerLogoutEvent(PlayerEvent.PlayerLoggedOutEvent event) {
    if (event.player == null) {
        return;
    }

    for (InterfaceRegistry.InterfaceDataContainer dataContainer : InterfaceRegistry.getInterfacesOfPlayer(event.player.getUniqueID())) {
        // DEBUG
        //event.player.addChatComponentMessage(new ChatComponentText(String.format(">>>>>> x: %d, y: %d, z: %d", dataContainer.x, dataContainer.y, dataContainer.z)));
        //LogHelper.info(String.format(">>>>>> DIM: %d, x: %d, y: %d, z: %d", dataContainer.dimensionID, dataContainer.x, dataContainer.y, dataContainer.z));
        TileEntityPlayerInterface te = ((TileEntityPlayerInterface) DimensionManager.getWorld(dataContainer.dimensionID).getTileEntity(dataContainer.x, dataContainer.y, dataContainer.z));

        if (te != null) {
            te.setPlayerOffline();
        }
    }
}
 
开发者ID:Dragon9815,项目名称:PlayerInterfaceMod,代码行数:18,代码来源:PlimEventHandler.java

示例7: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(PlayerEvent.ItemCraftedEvent event) {
	if(event.crafting != null) {
		Item item = event.crafting.getItem();
		if(item == LibVulpesItems.itemHoloProjector) 
			event.player.triggerAchievement(ARAchivements.holographic);
		else if(item == Item.getItemFromBlock(AdvancedRocketryBlocks.blockRollingMachine))
			event.player.triggerAchievement(ARAchivements.rollin);
		else if(item == Item.getItemFromBlock(AdvancedRocketryBlocks.blockCrystallizer))
			event.player.triggerAchievement(ARAchivements.crystalline);
		else if(item == Item.getItemFromBlock(AdvancedRocketryBlocks.blockLathe))
			event.player.triggerAchievement(ARAchivements.spinDoctor);
		else if(item ==Item.getItemFromBlock(AdvancedRocketryBlocks.blockElectrolyser))
			event.player.triggerAchievement(ARAchivements.electrifying);
		else if(item == Item.getItemFromBlock(AdvancedRocketryBlocks.blockArcFurnace))
			event.player.triggerAchievement(ARAchivements.feelTheHeat);
		else if(item == Item.getItemFromBlock(AdvancedRocketryBlocks.blockWarpCore))
			event.player.triggerAchievement(ARAchivements.warp);
		else if(item == Item.getItemFromBlock(AdvancedRocketryBlocks.blockPlatePress))
			event.player.triggerAchievement(ARAchivements.blockPresser);
	}
}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:23,代码来源:PlanetEventHandler.java

示例8: onPlayerLogin

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
	File file = new File(ConfigHandler.messageFile);

	if (file.lastModified() > lastModifiedTimestamp)
	{
		loginMessage = FileHelper.readFile(ConfigHandler.messageFile);
		lastModifiedTimestamp = file.lastModified();
	}

	if (loginMessage == null)
	{
		return;
	}

	new Timer().schedule(new MessageTask(loginMessage, event.player), ConfigHandler.messageDelay);
}
 
开发者ID:szernex,项目名称:YetAnotherLoginMessageMod,代码行数:19,代码来源:PlayerLoginHandler.java

示例9: onPlayerItemCrafted

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerItemCrafted(PlayerEvent.ItemCraftedEvent event) {

    if (event.crafting.isItemEqual(new ItemStack(ModItems.ammo))) {
        for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) {
            ItemStack stack = event.craftMatrix.getStackInSlot(i);
            if (stack != null && stack.isItemStackDamageable()) {

                if (stack.getItemDamage() <= stack.getMaxDamage() - 1) {
                    stack.setItemDamage(stack.getItemDamage() + 1);
                    stack.stackSize++;
                } else {
                    event.craftMatrix.setInventorySlotContents(i, null);
                    MinecraftForge.EVENT_BUS
                            .post(new PlayerDestroyItemEvent(event.player,
                                    stack));
                }
            }
        }
    }
}
 
开发者ID:iTitus,项目名称:MyMod,代码行数:22,代码来源:CraftingHandler.java

示例10: itemCraftedEvent

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void itemCraftedEvent(PlayerEvent.ItemCraftedEvent event) { //fired after pulling the item away
    GameRegistry.UniqueIdentifier identifier =  GameRegistry.findUniqueIdentifierFor(event.crafting.getItem());
    ExtendedPlayer playerData = ExtendedPlayer.get(event.player);
    for (String modId : playerData.disabledMods.keySet()){
        if (modId.toLowerCase().trim().equals(identifier.modId.toLowerCase().trim())){ //trims unnecessary?
            if (!playerData.disabledMods.get(modId)){
                if (!PlayerData.getBlacklistGroupDisabled(modId, event.player)){   //if mod group isn't disabled
                    PlayerData.disableGroupMods(modId, event.player);              //disable them
                    CommonProxy.saveProxyData(event.player);                       //save changes
                    NetworkingHandler.network.sendToServer(new UpdateCraftingMessage("updtCrftng")); //send message from client to server to update
                }
            }
        }
    }

}
 
开发者ID:gr8pefish,项目名称:HardChoices,代码行数:18,代码来源:FMLEventHandler.java

示例11: onPlayerLogin

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent e) {
    if (Corruption.corrSpeed == 20) e.player.addChatComponentMessage(new ChatComponentText("[Corruption] Please note that this server is running at ModJam speed (10x faster then normal!) so you can see the full effects of the mod. You can change this in your config"));

    //Introduction
    if (CorruptionDataHelper.needIntroduction(e.player)) {
        if (this.playerIntroduction.count(e.player.getCommandSenderName()) > 0) {
            e.player.addChatComponentMessage(new ChatComponentTranslation("chat.corruption.logout").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED).setItalic(true)));
            CorruptionDataHelper.increaseCorruptionForPlayer(e.player, 50);
        }
        else {
            this.playerIntroduction.add(e.player.getCommandSenderName());
        }
    }

    Corruption.eventChannel.sendTo(PacketEventHandler.getDiaryDataPacket(e.player), (EntityPlayerMP) e.player);
    List<String> corrEffects = CorruptionDataHelper.getCorruptionEffectsForPlayer(e.player);
    if (!corrEffects.isEmpty()) {
        for (String corr : corrEffects) {
            Corruption.eventChannel.sendTo(PacketEventHandler.getCorruptionEffectPacket(e.player.getCommandSenderName(), corr, true, false), (EntityPlayerMP) e.player);
        }
    }
}
 
开发者ID:kihira,项目名称:Corruption,代码行数:24,代码来源:FMLEventHandler.java

示例12: nameFormat

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void nameFormat(net.minecraftforge.event.entity.player.PlayerEvent.NameFormat event) {
    if (!PermissionConfig.prefixChatGroupName) return;

    Collection<Group> groups = PermissionManager.getGroups(event.entityPlayer.getPersistentID());
    if (groups.isEmpty()) return;

    StringBuilder sb = new StringBuilder();

    for (Group group : groups) {
        if (group.groupName.equalsIgnoreCase(PermissionConfig.defaultGroup) && !PermissionConfig.prefixChatDefaultGroup)
            continue;

        EnumChatFormatting color = EnumChatFormatting.getValueByName(group.getChatColor());
        if (color == null) color = WHITE;

        sb.append(color + "[" + group.groupName + "]" + RESET);
    }
    if (sb.toString().isEmpty())
        return;

    sb.append(" ");

    event.displayname = sb.toString() + event.displayname;
}
 
开发者ID:MCServerTools,项目名称:ServerTools-PERMISSION,代码行数:26,代码来源:EventHandler.java

示例13: onCraft

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCraft(PlayerEvent.ItemCraftedEvent event){
    ItemStack pickaxe = null;

    if(OreHelper.isItemThisOre(event.crafting, "dustTinyGem")){
        for(int slot = 0; slot < event.craftMatrix.getSizeInventory(); slot++){
            if(event.craftMatrix.getStackInSlot(slot) != null){
                ItemStack stack = event.craftMatrix.getStackInSlot(slot);
                if(stack.getItem().getHarvestLevel(stack, "pickaxe") >= 2){
                    if(stack.getItemDamage() < stack.getMaxDamage() - 7){
                        pickaxe = stack.copy();
                    }
                }
            }
        }
    }
    if(pickaxe != null){
        pickaxe.damageItem(5, event.player);
        if(!event.player.worldObj.isRemote) {
            MiscHelper.drop(event.player, pickaxe, 0);
        }
    }
}
 
开发者ID:goldenapple3,项目名称:Marble,代码行数:24,代码来源:CraftingHandler.java

示例14: onEnterWorld

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onEnterWorld(PlayerEvent.PlayerLoggedInEvent event) {
	this.event = event;
	new Thread() {
		public void run() {
			try {
				String page = makeRequest("https://mods.io/mods/1089-smartcursor");
				int l = page.indexOf("<td><strong>");
				if (l < 0) throw new Exception("");
				int r = page.indexOf("</strong>", l + 10);
				if (r < 0) throw new Exception("");
				String localVersion = ModInfo.VERSION;
				String globalVersion = page.substring(l + 12, r);
				if (localVersion.compareToIgnoreCase(globalVersion) < 0) {
					UpdateManager.this.event.player.addChatComponentMessage(new ChatComponentText("SmartCursor is out-of-date. Your version - " + localVersion + ", latest version - " + globalVersion));
					UpdateManager.this.event.player.addChatComponentMessage(generateClickableMessage());
				}
			} catch (Exception e) {
				System.out.println("Unable to fetch information about updates!");
			}
		}
	}.start();
}
 
开发者ID:asaskevich,项目名称:SmartCursor,代码行数:24,代码来源:UpdateManager.java

示例15: onPlayerLogin

import cpw.mods.fml.common.gameevent.PlayerEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
	if(ConfigurationHandler.displayAmount) {
		event.player.addChatMessage(new ChatComponentText("[AllTheThings] "+Reference.BLOCKS_ADDED+" blocks added"));
		event.player.addChatMessage(new ChatComponentText("[AllTheThings] "+Reference.ITEMS_ADDED+" items added"));
	}
	for (int i = 0; i < msgs.size(); i++) {
		event.player.addChatMessage(new ChatComponentText((String) msgs.get(i)));
	}
	/**
	book.setTagInfo("author", new NBTTagString("Shnupbups100"));
	book.setTagInfo("title", new NBTTagString(StatCollector.translateToLocal("book.allthethings:guidebook.title")));
	NBTTagList pages = new NBTTagList();
       pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.allthethings:guidebook.page1")));
       pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.allthethings:guidebook.page2")));
       pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.allthethings:guidebook.page3")));
       pages.appendTag(new NBTTagString(StatCollector.translateToLocal("book.allthethings:guidebook.page4")));
       book.setTagInfo("pages", pages);
	event.player.inventory.addItemStackToInventory(book);**/
}
 
开发者ID:OmgImAlexis,项目名称:TheStuffMod,代码行数:21,代码来源:PlayerLogin.java


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