Posted May 23, 201312 yr How would you chat a string of text like "Hay usernamehere your version of AdditionalCrafting is out of date." I have a update checker made but how would I chat that string to tell them.
May 23, 201312 yr playerInstance.sendChatToPlayer(String); platerInstance is the player variable you are using I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
May 23, 201312 yr Author What would I use for a player varable if I want it to say AdditionalCrafting because I don't have a player varable. Sorry but this is my first time with chat stuff.
May 23, 201312 yr Where are you calling it? if it is in a class that extends IConnectionHandler in the playerLoggedIn method you do something like this: if(!MainModConfigOrBaseFile.isLatestVersion) { ((EntityPlayerMP) player).sendChatToPlayer("Hay " + ((EntityPlayerMP) player).username + " your version of AdditionalCrafting is out of date."); } I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
May 23, 201312 yr Author That's the problem I have nothing that involves that I only have a mod that can tell in a variable if its in date. Is the a tutorial for this stuff?
May 23, 201312 yr Look at my MinePG code. Especially this class: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/comm/ConnectionHandler.java and for registering it, chuck this in your @Init method: NetworkRegistry.instance().registerConnectionHandler(new ConnectionHandler()); I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
May 23, 201312 yr I would do it using events: @ForgeSubscribe public void VersionChecker(EntityJoinWorldEvent ev) { if (ev.entity instanceof EntityPlayer) { if (!VersionCheckerClass.isUpToDate) { //Get player and send chat message } } } But that's just my opinion
May 23, 201312 yr Author Thank you and just so I don't have to make another thread I tryed to spawn a new thread and it won't work because forge does not seem to be yielding its thread.
May 23, 201312 yr uhhhh.... What? ^^^ Agreed.... What? I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
May 23, 201312 yr Author I tryed to multithreaded my mod by putting the update checker that does the checking in its own class that implients runnable so I can do new thread(UC,"updater").Start; and it would run on a second thread it starts the thread but then it stops before it can check my version off my github Version-1.5.txt file.
May 23, 201312 yr You do not need a new thread for that. Just use the one that minecraft is already using. There is no need for a new thread. I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
May 23, 201312 yr Author I was going to use a new thread because other wise I would need a tick handler of something of that sort so every hour I would output That it was out of date to a server counsel.
May 23, 201312 yr Ohhhhhhh......I though we were talking about the player? There are tutorials regarding TickHandlers out there. Is there a reason why you did not want to go that route?
May 23, 201312 yr Author Because I know how to use multithreading and I did no want to have to learn something new when I need to get this version out in 2 days to meet my goal of 1.0.0 of additional crafting.
May 23, 201312 yr Author Not really because I am not at my pc right now but I can say it is starting the thread but then stops executing it before it runs once fully.
May 23, 201312 yr Then your cutting it off before it can fully operate. A flaw with your code or not I am not sure.... As I cannot see it I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.