There you do this is octo and today we’re going to make a bucket plugin that gets locations and teleports players to those locations and by the end of this video hopefully you can build your own custom locations and teleport plugin based on what I’ve given you it’s going To be pretty simple we’re going to use some methods that are already provided in the spigot API for the most part such as teleport and location so that you know just take it easy enjoy this one because the next one is going to be a little bit more complicated with set Blocks and data values by giving you the ones crap so let’s jump into it we go bring up our Eclipse we are in hello world – and we are going to want to go to my personal snare here we go so we’re going to go ahead and create a new event Angela here so that we can write a new method called big void on flare damage alright and we’re going to look per entity damaged by entity you guys there you go you report this there it is right there and we’ll get our bracket in boom there We go so every time the player is damaged by an entity that is an arrow or a mob or any other player is going to teleport them somewhere on the map I haven’t quite decided yet we’ll pick a regular location probably something nearby to where they started and so it Will kind of be like a maybe a knock back you can knock them back wall we have to get directions we’re probably going to be a little bit more like them just a random teleport or a third number block all right so what we need to do First is make sure that it is indeed a player being damaged here and not just a another mob because you can see it’s entity damage not player damage so we’re going to do here if event actually first we should get the entity to entity n 2z equals events get entity Give it a second here to load up there we go and we’ll need to import entity there it is that’ll right there bucket and then we’ll check if the entity is an instance of player like how we did in the last episode we check to make sure the Command center with a player this time we’ll be checking a BNC damage to the player well if it is a player then we’re going to cast itself player a player a player equal player entity there you go now we’ve got a player version of entity and we’re complete them teleports them So player Josh teleport there you go we’re going to need to put in a location here okay so we’re going to call it Lok and there’s going to be a new variable so we could get the player location right off the bat to fly typing location Player look it’s not going to be the one we use in the tell 4 equals player Josh get location you see a lot of this is already built into the API which is why I said it’s fairly simple import location man from bucket so now we’ve Got the players location and say we want to solve for them 10 blocks away when they’re hit okay so we’re going to do location slope equals new location and this is going to be actually we don’t need to do a new location we can just Type player looks dot add and we can add in a x y&z mount to edit the location we already have so whatever the players location is we can either increase it by 10 in the X which is a One Direction like horizontally candy which is another direction horizontally or ten in the Y Which is vertical we gotta remember that X Y n V just like the coordinate you see when you press f3 in the game alright so we’re going to go ahead and just do 10 in the x-direction maybe 10 in the V direction so it’s a diagonal 10 whatever The hypotenuse is of the 10 by 10 all right so that’s how far you’ll travel and play hl4 to that location straightforward you can randomize these numbers as well if you use the Javas random that’s what I like to do if I like a random jump for the telephone all Right so this should work I believe just as it is every time a player gets hit let’s go ahead and give it a shot so we’re going to export our plug in here there we go just plug in Y now to construct perfect and I’ve already got It up and loaded here as you can see so we’re just going to reload it do you usually I type in slash reload but you type rate regular just reload straight into the console and you’ll get the same effects and you’ll tell you that it’s not good for some plugins that’s true Once we start working with more complex things like list hashmaps config files stuff like that you will want to be careful about reloading alright and now that we’re in you can see I’ve got my solo I mean I can write it forward and we’re here I’m going to Go ahead and enter game mode 1 and grab myself a zombie perhaps be wrong be perfect go ahead and change it tonight although sorry mommy doesn’t burn up see what is the command set time sets 20,000 let’s do it yes perfect all right and difficulty Needs to be a lot peaceful there we go hard angry all right and we’re going to go back into game mode one and our dear army this is survival when the zombie hits us so poor player it should tell us far away ten blocks away but it should Not do so when the zombie is hit by us there we go see you can see I’ve been teleported far away there you go kind of like an odd pack of Tex coda it if you’re really clever and you know how to work with some vectors you can get the Direction the players facing and do an opposite vector in the opposite direction that is and teleports them kind of like as a knock-back which i think is a cool tank let’s see if we hit him he doesn’t teleport but if he gets up we get sent following that’s exactly What we wanted alright so let’s head back to clips here I’m going to stop this okay so now say we want to teleport them to a very specific location we already know the coordinates of the exact spot we want to teleports into we want to build this location now since we Can’t just get the location you’re in the code you have to actually put in the coordinates because that’s the part of the information we have we can’t do that you can build it from scratch with doing in your location so when the player is damaged here we’re going to go ahead and Stop getting their location and teleporting them ten blocks in either direction we’re going to create a location that is just a new location just like that alright and we will need to put in edge of the Year world double double double or world double double double slope slow and the first one Straightforward that’s the world you’re in then the next three the doubles are x y and z now you can put in an integer now it will convert to a double curlies and the last two the optional float parameters you see there those for pitch and yaw pitch and yaw Determine the direction you’re looking so you can find those in f3 as well but they’re less often use all right um even in regular in-game teleports it’s not really important I don’t suggest bothering with them unless you know the exact pitch in yaw of the teleport location you want to send them To so if you build a teleport plug-in and you come out saved the exact pitch in yon back arm location you can then input it there and you would be able to get the exact spot you’re looking at that’s why even when you use like a warp Plugin you still look at the exact same spot but our teleports here will be looking at a tree to find pitch and yaw that’s just something to know we can work on it in the future if you’re interested just let me know in the comments all right so now that a time We’re going to build this new location here we’re going to get the players world alright so this is assuming we only have one world otherwise we would have to build the world which we’ll do in a second player get world and you know I’m actually going to make that Home variable world world equals player on get world and import world in bucket perfect okay so now we’ve got the world we could type world in right there and we’re going to teleport them to let’s say um we have a spot we like at 150 I mean it’s one um ten hot and it’s 200 bucks in the Z directions there you go now technically this will take us someone we could add a pitching y’all like I was saying just like that that this will be fun so oh and save that Every time we get hit it should send us to this predefined location where you can change the event as well it could be a command even if you want you can put in here what we do that next I plus give this is shown well okay fine and Severn go ahead and Reload it now I have uploaded perfect all right fun and song you there and when he hits us it should take us to a predefined spot you’ll notice or more current XYZ is nowhere near the one we put in so as soon as we hit this you can see now We’ve been teleported to 115 10 200 and we dropped down because we didn’t have 10 high effects or me also keep that in mind when you’re doing y-coordinates that you have to sub drop from whatever they are if it’s to Rio but we have a pickup alright so back here we’re going To go ahead and craft another world say we want some into the nether instead so if you get hit you get sent to another or actually this time what we’ll do is we’ll get rid of this so it’s no use to us right now and we will clean up our Code here you guys here to the import you didn’t use eclipse let you know if the yellow line there we go and we’re going to make a command for so it will create some more space up here and the command will be if you want to go back To the correct format I will not let it all right the case will be um multi-line nether port okay so whenever someone types in another port it will send another I’m some predefined location I’m not going to check it so I’ll mate all forth in a wall whatever I’m something you can deal With alright okay so when they type in nether port’s they’re going to get teleported to the nether and is that we do it we’re gonna create a new world called another alright and this will teleport them to specific world we’re gonna have to type in get world here or Actually here’s the tricky one world another equals bucket get server start get world and it’s going to be quotation to your world nether there we go we’re going to have to import bucket from Oregon buckets then gets over here with this parenthesis and get world alright so whatever the world folder Name is you’ll put it in here let’s the world it’s all for two so if we want the nether it’ll be world nether if you wanted on your regular world it just feel like that the end of quarters like that get a custom one named you know my World you can do that you pull over to the kinetic there we go so we’ve got this world selected whenever we want to do a new location well flairs teleport here we go player teleport there’s your location that is going to be location most equal new location World are another sign at the world wind and semi to 0 0 0 that’s wherever that is we’re going to tell forth in actually perfect there we go now we imported on location alpha Rd imported world save this and that should do it well we got a return to let’s remember That next one so let’s go ahead and export it there we go get our log my ml again your setup and your minecraft server here I’m going to go ahead and get rid of that and I’m going to reload nothing alright so now we’re going to Type in another port oh this is not going to work because we forgot to add a torque while you wanna know we’re in copiers child note here all the way to the beginning and paste it has to have the exact same number spaces as on the other hand the metaphor has the Description teleport to another there we go and now we can export that correctly something I forget quite often from what the game will remind you reload alright and check another part there we go you can see we’ve been teleported to zero or roughly zero zero Zero and another zero is um way down on the block it’s pushed us up to sixty one but it has succeeded it’s a done exactly where we intended and sent us to the nether in this exact farm so then that’s pretty much it um now you can create 12 Forks and wherever you want and exactly the world and location you want if using multi world oh please remember you do have to load the world before you teleport into it otherwise probably get some strange effects I don’t know what could happen there I’ve never tried I Just um load the world first alright so that’s all there is to it like I said earlier in the video our next video is going to be on setting blocks in the world so say we wanted this lot to be a diamond I’m using the plug-in programming we could touch the Diamond we could cut it to a command block whatever we wanted and we’ll also set data values for some blocks have multiple data values like wood so you can’t just set the block you have two sets blocks and the data value so we’ll go over all that and get until that Tedium fun stuff um if you like to just comment and leave a subscribe I really appreciate it I hope you had fun be sure to check out the quiz here coming at the end ruins and um you know let me know if you having suggestions you Video Information
This video, titled ‘How to Make Bukkit Plugins #5: Teleports & Locations | MINECRAFT 🔌’, was uploaded by DGtv – Daemon Gaming TV on 2017-03-12 12:27:55. It has garnered 5267 views and 84 likes. The duration of the video is 00:16:48 or 1008 seconds.
How to Make Bukkit Plugins for Minecraft! Episode #5: Teleports & Locations
=DESC So you want to make a Bukkit/Spigot plugin for your Minecraft server? How do you even do that? Luckily, you can do it all for free with Java!
Featured in this episode are Location and World objects, as well as player teleports (also known as warps)!
If you have any questions, feel free to shoot me a comment or message!
===
🛒 GET MERCH NOW! Visit the DGtv Etsy shop @ https://www.etsy.com/shop/DGtv
===
=QUIZ http://pastebin.com/iz5Newz8
=LINKS GitHub repo: https://github.com/randallarms/hello-world Eclipse IDE: http://www.eclipse.org/ Java SE 8 SDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html BuildTools page @ Spigot: https://www.spigotmc.org/wiki/buildtools