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