KPortalToPortal
KPortalToPortal
Have you ever went through a Nether portal only to find when you return from the Nether that you end up in someone's house? The default game mechanic does not always bring you back through the portal you used. This plugin will force you to return to the portal that you originally walked through.
How Does It Work?
Lets say you build a Nether portal and you walk through it. This will create a entry in your history file that holds the source location and the destination location. So if you ever enter a portal that matches the destination location you will be teleported to the source location. This overrides the default game mechanic because you may not come back out the same portal you walked into. This history also covers multiple portals. So that each time you portal a history entry is created. Each time you walk back in a portal that you came out of all history entries below that will be dropped. Also, if you walk into a portal you walked into before all history entries after that entry will be dropped. This helps to keep the portal history files from growing and growing because of teleport such as /tpa and other teleports.
Shortcomings
After a very very very long period of time a player's teleport history files may become slightly large. This can be fixed simply by deleting the files thus erasing the player's history. Do not worry though as this will take quite a bit of time to actually happen. Also each player has two files created which take a minimum of 8KB on most systems just for the two file allocations. However, the files will not actually grow until they exceeds 4KB.
I hope to one day eliminate the file per player and use a more complex format, but at the moment this is one of the best ways to keep the code simple and ensure that if a server crash does happen that the players can be fairly well assured that their portal history was saved.
The code actually checks locations using a 30 block spherical radius. This means that two portals next to each other will likely be considered the same portal. But, this is not a major problem or a problem at all for most players.
But, most servers have quite a large amount of disk space so do not be afraid. I may add in the ability for it to automatically delete a player's portal history after they have been inactive for quite some time and it could do this in the background with out effecting performance. Or, I may devise a better way to keep the portal history from growing and growing over a long period of time by possibly being able to detect if the portal even still exists.
Source Code
The source code is contained in the JAR that you download. Just extract the JAR using a unzip utility. You are free to change, modify, or release the code as your own plugin. Or, if you like you can submit a patch to me and I can apply it, credit your name, and upload the new version.
-
View User Profile
-
Send Message
Posted May 27, 2017Does this work with 1.11.2?
-
View User Profile
-
Send Message
Posted Dec 20, 2013Could you by any chance update this?
-
View User Profile
-
Send Message
Posted Jul 21, 2013out of curiosity is there any way of preventing nether portals form forming in in protected areas?
-
View User Profile
-
Send Message
Posted Jun 9, 2013I hate to be a bug but this could really use an update
-
View User Profile
-
Send Message
Posted Apr 14, 2013Can you make it so this also happens for end portals? I know its not meant to be more than 1 end portal enterances but people pour lava on the spawn deck and kills everyone when entering. BECAUSE end portals arent craftable, maybe make it so theres some kind of random spawning system when you enter the portal? Just a thought :)
-
View User Profile
-
Send Message
Posted Feb 26, 2013@mtarnuhal
Yeah, it appears they've changed something that breaks KPortalToPortal.
-
View User Profile
-
Send Message
Posted Feb 24, 2013This Plugin Doesnt work in 1.4.7 R1.0 It creates a random portal on the map when u teleport back from the nether.
-
View User Profile
-
Send Message
Posted Dec 18, 2012Thank you for making this plugin, i remember having this problem on other servers (my friend once griefed some random guy's house when it happened!), this will go great with my server! :D
-
View User Profile
-
Send Message
Posted Nov 12, 2012ccxc