Hello guys it is Eric here again let’s hope that this video works third time I have rendered and uploaded it because YouTube is broken alright let’s get into the video hello guys it is Eric here again gonna be the new video gonna do just quick apology For your I will try to cut all this out but you’ll probably hear a lot of background noise it’s Saturday night in the college dorm people are screaming running up and down the halls just banging on doors I don’t know why they’re acting like children and it’s Just you know doesn’t doesn’t make the best recording so I’ve locked myself in my room so no one will come bother me hopefully yeah so in this video I’m going to go over a couple things one how to display like in the multiplayer menu you need to use example client in order To join the server I’ll put up a screen shot hopefully an editing to show this cuz I’m not doing a good way of describing this but you know like in the player slot just gonna be like you need ease example claim and then I want to go Over fixing crashes so if you try to send a custom packet to someone who’s not using an example client they’ll be disconnected from the salmon with a giant unfortunate error message because other clients don’t know about our packet so bad things happen we send them Our packets then I also want to go over detecting who is running example claims and maybe kicking people who are not running example kleinen forcing everyone to use it or you could reward people for logging in with your client and sending the cool smiley face or something I Don’t know well that’s up to you guys to figure out what you want to do with it yeah alright so we’re going to first start off making a new Java project it’s call it shared stuff this is basically going to be mostly constants that are not all constants that are Shared between these two projects so we’re gonna add it as another source folder so I’m gonna make a new package call it example claim shared name it something you know I’m gonna make a class called multi in here is basically going to just kind of hold some Constants the client and the server did that back it’s playing in server you need to have you could do without this and just copy and paste classes between things but I have found rated that in the past I got confused of which class was what and overrode some stuff I Didn’t mean to and it was just it was chaotic and this makes it a lot better in my opinion that’s what we’re gonna do is right-click on a project go to build path link source and we are going to browse to our things we’re going to say minecraft client tutorial clips shared Stuff source you’ll get this error message it’s already a source folder we just have to name it something else so let’s click shared we should see now that in our shared constants you can open this up as another file it’s acting like it’s in this project gonna do the Same thing for the client linksource browse that’s the right folder name it sure right now we can reference everything that was in this project in these projects okay now that we got that we’re gonna first when I first cover its building their workspace Joely okay gonna be first covering how to do The cool like you need to read example client when you ping the server unless you’re running example client then it won’t say that so what we’re gonna need is constant we’re going to say public static final int let’s call it now you want to use a number it could be any Integer but that’s not like an the 1.8 version number which is 47 so or you don’t we use like any of the minecraft version numbers I can put a list in the description numbers you don’t want to use but there yeah there’s not two too Many of them so I’m just gonna make up a random number let’s go with like negative nine I’m gonna use negative numbers negative number yeah I’m gonna use a negative number because no minecraft version paying number thing they use is negative so I’m guaranteed this does not is non minecraft version Okay that was like a really long-winded way of doing good anywho now we’re gonna do is we’re going to go into the server and we’re gonna go to main and in here I’m going to do protocol proto protocol library dot get protocol manager add packet listener new packet Adapter we’re gonna save this packet tight dot status but server dot server info not out survey but we just want server info let’s import packet adapter and then we’re going to go one print see overdue open brace like that and then we’re going to do control space and override On package sending so now we can modify So now we’re gonna do is rap server pain let’s call it pain equals you then get to pack it get packet dot git server pings dot read of zero since there’s only one of them now we’re going to say pain dot set protocol what is it or set version Yeah say version protocol to be multiplayer will see your constant stopping version and then I am also going to set the text to be set version name which is gonna be the text that appears we’re gonna say sample client and then V and then I want a version Number so I’m gonna actually put a version number public static final version claim so this is gonna be the bird yeah now now that I think about it um I’m gonna make a new thing that’s just gonna be called like miscellaneous constant and we’ll put we’ll put the the Version number since it’s not really technically a multiplayer thing this is me getting all like super organized yeah this constantly you can put them in the same class you can put them in here it’s fine we just want that so now what we’ll do is let me export this as a Plugin and really want to select our plugin make sure both of our source folders are selected we’re going to export it to the server now let me launch the server real quick the desktop what did I call it server man window dude should have had this all Set up and should hopefully have no errors now let’s start up the client and I’m also going to start up the vanilla client as well so I’m gonna get two things in minecraft running at once you have example client and not example client I’m hardly tell apart so we’re Gonna go multiplayer and you should see both of them say server out-of-date you must use example client 1.0 point that’s exactly what we want to say so now about that I’m a quick those and now that we have that the issue we’re gonna run into Now is this is you know we’re gonna be used like example clay it needs to not display that because it’s example client and we’re like okay the server is an example client server we don’t need to display that it’s out of date I’m not explaining as well so let me close that It is and we’re going to go to source met minecraft what would be under what client GUI I think it’s server list entry normal yes okay so this is when we did the featured server do you guys remember that so what we want to do is right here This is checking if the client version is 47 and the server version sorry the server version is 47 this means that the server is out of date you can see right down here a flag – that’s dark ride plus the game version if that client add dates are out Of date so this is our client out of date flag we’re surviving date flag pretty much what we want to do is say if this dot field so we want our server data field dot version which is just int equals multi player constants that ping Version will say flag two is false so it is not an out of date server and what I want to do is I’m gonna draw another icon next to it I’m gonna I want like a check mark so let’s go draw image X Y make it lower and then the texture let’s Go to server data featured and make a new one and this is gonna be called check and check this is mainly just for me to verify that it’s working you guys don’t have to do this if you don’t want to server technically it’s not supposed To be in there but no check I figured it’s with the other I call and it gets displayed so I’ll put in the same place so now I will put this image up for download just check icon that was just there we want to go to source minecraft Assets minecraft client name just put it in there right next to the star now everything goes right we should see when we run the client that it no longer says that it’s out of date Oh many web servers no not well alright well wait here for a minute While this initializes you go here now you didn’t even pay my server there we go we have a check mark now and it doesn’t say the server is out of date and if I get a normal minecraft client of vanilla one and we launch this right Next to it we should see that it’s this one says it’s out of date this one says we can play on it it’s perfect got a little check mark and everything all right so that’s I’m tired now let’s switch gears a little bit and we want to Do make it so we don’t crash pretty much so if I if I try to join this you see we get this bad packet ID 174 but if we’re on here it works fine we won’t fix this so they don’t crash with bad packet ID that’s the next thing so what we’re Gonna do is let’s that we need to figure out if a client is example client or your client name I shouldn’t keep saying example I shouldn’t see your client hey we need to figure out if they are the client or not and if they’re valent there are many different ways of doing This but I’ve found that I kind of like this way and it seems to work pretty reliably so I’m gonna go for it I’m going to open up your Chrome window and and I need a random list alright so random string of characters so I’m gonna go to passwords just Google Password generator here we go it’s not actually gonna be a password but let’s make it like 128 characters generate cool alright I just need a big string of characters so in shared stuff we’re gonna go to multiplayer Constance I’m going to say public static final string cut-off key because it’s like you need To authenticate and say hey I’m client we’ll just paste that in there this can basically literally be anything but just make it something that’s you know pretty random that people can’t just guess because it kind of ruins the point of it so I’m just gonna use some Random characters type out a song here just make sure it’s less than like don’t go over like 200 characters there’s no point sending enough data that is just pointless at that point so what we’re gonna do now is in the client we want to say we want to basically append this With a null byte to the handshake that happens so we’re going to go to GUI connecting which is somewhere in here and it blind hello where am i why can’t they see this okay let’s go to GUI multiplayer for a minute and we can find connecting here GUI Oh it’s client C it’s in multiplayer there’s a GUI in here okay that’s just weird here you go GUI connecting it’ll make this bigger so you can see so this is the handshake packet and and it has an IP import that servers can read but they don’t actually use your limited 255 Characters for this so I’m only going with 128 characters but it’s kind of interesting you can see there’s no even getter for these you’re just private things the data they get sent so what we’re gonna do is plus and append to that with a null byte so backward slash Zero plus multiplayer constants top two are key so now when we connect to the server we can listen for the handshake packet and break it a null byte and then figure out if the off key is correct and allow them onto the server that’s kind of how we’re gonna figure it out there’s Other ways of doing this but this is the way I’m going to do it so you have other ways go feel free to do that I’m doing it this way now we need to go back to the server and in our server we’re going to have a couple things so We want to figure out when they log in because the join packet is join is too late here so we’re gonna do an event handler public void on playing login I’m looking clear walls visit player login event that’s what I want so we’re gonna do string it’s a host name yeah Is e dot get host name and we want to split it by a colon because we don’t care about the port number so then we’re gonna get the IP e so that so the host name is IP colon port so we’re gonna split it by the port get the IP which is The zeroth argument and then then just split again final bite and so hopefully now we have what we’re looking for so we’re gonna say if hostname actually host mean it’s really the parts of the host name dot link so if it’s two so if our host name part length is two we want To check arguments one of it and we’re gonna say if host name 50 type well-well saying it aloud of the second argument equals multi multiplayer constants dot off key we want to delay two ticks later so we’re gonna say new bucket on the bowl run task later this too because You’re taking like not in the world and weird things can happen so blame to ticks seems to fix everything let’s what’s in the player message ah chef color let’s how you do it yeah let’s go yellow well thank you for using sound so enthusiastic there you know it’d be kind Of fun we also want to keep track though if but who is using it we need like a list so up here we’re I’m not sure if this bit of you guys so we’re gonna say let’s do a private let’s do a list of UID just gonna be people using client Clothes new array list new ideas import that Java util list perfect so we want to put people using point add eat out get player it’s unique ID and then in here let’s send them the hello world packet and let’s remove that from ongoing so we’ll add them and when you got get players The player then I also want a get people using client which is going to be a list and I also need an instance of my of my plugin so its private static me instance instance equals this we want to get instance perfect other thing I want to Do is when a player disconnects we can remove them from the list so we want that event and public and on playing quit layer flipped event I can’t spell then we’re gonna say if people using clients or no actually went there you you ready you a T equals it if people Using clients dot contains their your D people using client no use to keep their you eighties around if they’re not playing on the senator like that’s just there’s no point in there and if you have you know thousands of players logging in that list could get pretty Big depending if we’re all using the client so there’s that what I’m also gonna do is say let’s make another gonna make another boolean over here boolean is using client equals false and in here we’re gonna say is using client is true [Applause] yeah so I’m not actually gonna do that the bucket mountable let’s see that outside oh there’s capital over here is using client is true outside this say if we’re not is using client a dot let’s disallow them with results dot kick probably just kick other then the Message check color Dodge red you need to use the example download at the example client decayed I replace with some other nice message if you don’t want to kick people don’t include this and it’s up to you if you would like to do that Now we need to hide in a safety check to the packet manager and I wrote down here to do make sure client is example client before sending them a packet it’s exactly what we’re gonna implement right now so we’re gonna say if main dot getinstance dot what does it get player Get people using client contains player dot get unique ID so we’re going to negate this with an exclamation point so if they’re not using our cleaved we’re going to just return and what I’m gonna do is mean get instant get logger let’s throw warning out into the console Thane trying to send the packet to player and they are let’s just paste a packet Doc’s get class yeah so this is mainly just to let you know that you are not checking for a packet for before the player before sending and you kind of should always check this is like the Fallback in case you forget kind of thing it’ll just kind of on you the console or you can use this as your check and remove that warning that’s completely up to you but we should be able to put this on the server noon it’s an example client plugin I always Remember to stop the server don’t reload it talking to you Xbox no I make sure to make sure to reload or make sure to restart the server and don’t reload it’ll break things but let me pull up Example clients and I’ll pull up the vanilla client right here so once it boots we should see so if we join the server should see thank you for using example client knows we are using the client and if we try to go here you need an example client to connect download at Their so yeah that’s that’s it for this tutorial thank you guys for watching thank you at some other point in time with a new video Video Information
This video, titled ‘How to code a Minecraft PVP Client: Episode #19.4: Verified servers & ‘Only client can play”, was uploaded by Eric Golde on 2020-02-09 22:54:39. It has garnered 14890 views and 240 likes. The duration of the video is 00:29:07 or 1747 seconds.
How to code a Minecraft PVP Client Series – Episode #19.4.
3rd times a charm with uploading this video. I’m praying to the YouTube gods not to corrupt this video.
——— [ Links Used In The Video ] ——— Check.png: https://github.com/egold555/Minecraft-1.8.8-PVP-Client-Series/blob/master/Episode%20%2319.4/check.png ———————————————–
——— [ This Series ] ——— Playlist: https://www.youtube.com/playlist?list=PLxbv-Ej1VQMQS9M2qnmEQtp-qL3xcA4ua Discord Support Server: https://discord.gg/M3PAyyy ———————————–
——— [ My Social Media ] ——— Youtube ➝ https://www.youtube.com/egold555 Instagram ➝ https://www.instagram.com/eric_golde/ Twitter ➝ https://twitter.com/eric_golde/ ————————————— Another Song: https://soundcloud.com/xmittens/winter-is-here