@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); }
@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 ; } } }
@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(); }
@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)); } } }
@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()); } } }
@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(); } } }
@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); } }
@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); }
@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)); } } } } }
@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 } } } } }
@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); } } }
@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; }
@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); } } }
@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(); }
@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);**/ }
@SubscribeEvent public void playerLogin(final PlayerEvent.PlayerLoggedInEvent event) { for (final String name : MinecraftServer.getServer().getAllUsernames()) { if (ItemAngelRing.curFlyingPlayers.containsKey(name)) { NetworkHandler.sendPacketToPlayer(new PacketAngelRingNotifier(name, ItemAngelRing.curFlyingPlayers.get(name)), event.player); } else { NetworkHandler.sendPacketToPlayer(new PacketAngelRingNotifier(name, 0), event.player); } } }
/** * SERVERSIDE * * @param pEvent */ @SubscribeEvent public void onPlayerJoin( PlayerEvent.PlayerLoggedInEvent pEvent ) { if( pEvent.player instanceof EntityPlayerMP ) sendClientUpdate( (EntityPlayerMP) pEvent.player ); }
@SubscribeEvent public void onCraft(PlayerEvent.ItemCraftedEvent event) { Item item = event.crafting.getItem(); if (item == ItemRegister.BLUE_STICK) event.player.triggerAchievement(AchievementList.NEW_ITEMS); else if (item == ItemRegister.TITANIUM_CHESTPLATE || item == ItemRegister.TITANIUM_BOOTS || item == ItemRegister.TITANIUM_PANTS ||item == ItemRegister.TITANIUM_HELMET) event.player.triggerAchievement(AchievementList.TITANIUM_STUFF); else if (item == ItemRegister.SILVER_PICKAXE) event.player.triggerAchievement(AchievementList.SILVER_PICKAXE); else if (item == ItemRegister.ETHERNIUM_SWORD) event.player.triggerAchievement(AchievementList.ETHERNIUM_SWORD); }
@SubscribeEvent public void onItemPickup(PlayerEvent.ItemPickupEvent event) { Item item; item = event.pickedUp.getEntityItem().getItem(); if (item == ItemRegister.STAFF_BUMPING || item == ItemRegister.STAFF_ELFIC || item == ItemRegister.STAFF_LIGHTNING) event.player.triggerAchievement(AchievementList.MAGIC_STAFF); else if (item == ItemRegister.SULFURAS) event.player.triggerAchievement(AchievementList.SULFURAS); }
@SubscribeEvent public void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) { ServerPlayerBaseMagic player; player = Main.getPlayerServer((EntityPlayerMP) event.player); player.onRespawn(); }
@SubscribeEvent public void onPlayerLog(PlayerEvent.PlayerLoggedInEvent event) { ServerPlayerBaseMagic player; PacketLogIn packet; event.player.triggerAchievement(AchievementList.LOGING); player = Main.getPlayerServer((EntityPlayerMP) event.player); packet = new PacketLogIn(player); Packets.network.sendTo(packet, player.getPlayer()); for (Dungeon d : Main.DUNGEONS) //Install les maps du donjon d.install_map(event.player.worldObj.getWorldInfo().getWorldName()); }
@SubscribeEvent public void onJoinWorlds(PlayerEvent.PlayerLoggedInEvent e) { activePlayers.put(new PlayerID(e.player), (EntityPlayerMP)e.player); for (Acceptor<EntityPlayerMP> action: onLogin) { action.accept((EntityPlayerMP)e.player); } }
@SubscribeEvent public void onLeaveWorlds(PlayerEvent.PlayerLoggedOutEvent e) { activePlayers.remove(new PlayerID(e.player)); for (Acceptor<EntityPlayerMP> action: onLogout) { action.accept((EntityPlayerMP)e.player); } }
@SubscribeEvent public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) { if (TweetQuake.instance().isAuthRequired()&&isOp(event.player.getGameProfile())) { final ChatStyle style = new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/eewreciever auth start")); ChatBuilder.create("[EEWReciever2] Twitter認証が完了していません。クリックして開始する(Twitterアカウントが必要です").setStyle(style).sendPlayer(event.player); } }
@SubscribeEvent public void PlayerEvent(PlayerEvent event) { int minimum = 0; double maximum = 21; int index = minimum + (int)(Math.random() * maximum); ; event.player.addChatComponentMessage(new ChatComponentText("�b�lHello" + " " + "�e�l" + event.player.getDisplayName() + JokeAsk.get(index))); System.out.println(index); }
@SubscribeEvent public void onServerJoin(PlayerEvent.PlayerLoggedInEvent event) { if (FMLCommonHandler.instance().getSide() == Side.SERVER || FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) for (ConfigRegistry.ConfigProxy proxy : ConfigRegistry.configs) { if (proxy.doesSync) NETWORK.sendTo(new ConfigPacket(proxy.fileName, proxy.handler.convertToString(proxy.config), false), (EntityPlayerMP) event.player); } }
@SubscribeEvent public void onClientDisconnect(PlayerEvent.PlayerLoggedOutEvent event) { if (FMLCommonHandler.instance().getSide() == Side.SERVER || FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) for (ConfigRegistry.ConfigProxy proxy : ConfigRegistry.configs) { if (proxy.doesSync) NETWORK.sendTo(new ConfigPacket(proxy.fileName, proxy.handler.convertToString(proxy.config), true), (EntityPlayerMP) event.player); } }
private void sendPlayerPowerGridWorldSavedData(PlayerEvent event) { World world = event.player.getEntityWorld(); PowerGridWorldSavedData pgwsd = PowerGridWorldSavedData.get(world); PowerGridSynchronizationMessage message = new PowerGridSynchronizationMessage(pgwsd); PowerLinesMod.networking.sendTo(message, (EntityPlayerMP) event.player); }
@SubscribeEvent public void onPlayerJoin( PlayerEvent.PlayerLoggedInEvent pEvent ) { if( pEvent.player instanceof EntityPlayerMP ) { sendClientUpdate(pEvent.player); } }
@SubscribeEvent public void checkUpdate(PlayerEvent.PlayerLoggedInEvent event) { if(VendingMachineConfigs.checkUpdate) { if(status==Status.OUTDATED) { EntityPlayer player = event.player; player.addChatComponentMessage(new ChatComponentTranslation("vendingmachine.update")); IChatComponent component = IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal("vendingmachine.update.download")); player.addChatMessage(component); } } }
@SubscribeEvent(priority = EventPriority.LOWEST) public void onPlayerQuit(PlayerEvent.PlayerLoggedOutEvent event) { if (event.player.worldObj.isRemote) { return; } handleQuit((EntityPlayerMP) event.player); }
@SubscribeEvent public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { StatsHelper stats = StatsHelper.get(event.player); if (Configs.Mod.disableVersionCheck) event.player.addChatMessage(new ChatComponentText(UpdateHandler.status)); }
@SubscribeEvent public void onItemPickup(PlayerEvent.ItemPickupEvent event) { // TODO: Implement ItemPickupEventHandler (Achievement on ItemPickup ??) //if (event.pickedUp.getEntityItem().getItem().equals(ModItems.testItem)) //if (event.pickedUp.getEntityItem().getItem().equals(Item.getItemFromBlock(ModBlocks.testBlock)) //event.player.addStat(Thallus.testAchievement, 1); }
@SubscribeEvent public void onCrafting(PlayerEvent.ItemCraftedEvent event) { // TODO: Implement ItemSmeltingHandler (Achievement on Smelt ??) //if (event.crafting.getItem().equals(ModItems.testItem)) //if (event.crafting.getItem().equals(Item.getItemFromBlock(ModBlocks.testBlock)) //event.player.addStat(AchievementHandler.DEBUG, 1); }
@SubscribeEvent public void onSmelting(PlayerEvent.ItemSmeltedEvent event) { // TODO: Implement ItemCraftedHandler (Achievement on Craft ??) //if (event.smelting.getItem().equals(ModItems.testItem)) //if (event.smelting.getItem().equals(Item.getItemFromBlock(ModBlocks.testBlock)) //event.player.addStat(AchievementHandler.DEBUG, 1); }
@SubscribeEvent public void onPlayerLogin( PlayerEvent.PlayerLoggedInEvent event ) { EntityPlayer player = event.player; if( FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER ) { QCraft.clearUnverifiedLuggage( player ); // Shouldn't be necessary, but can't hurt QCraft.requestLuggage( player ); } }
@SubscribeEvent public void onPlayerLogout( PlayerEvent.PlayerLoggedOutEvent event ) { EntityPlayer player = event.player; if( FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER ) { QCraft.clearUnverifiedLuggage( player ); } }
@SubscribeEvent public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent e) { if (BBConfig.greetUser) { ChatUtil.sendChatToPlayer(e.player, ChatUtil.LIME + "BetterBeginnings " + ModMain.VERSION + " loaded successfully."); } }