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.

You must login to post a comment. Don't have an account? Register to get one!

  • 7 comments
  • Avatar of zokHalsen zokHalsen Dec 21, 2013 at 05:21 UTC - 0 likes

    Could you by any chance update this?

  • Avatar of curienx curienx Jul 21, 2013 at 17:15 UTC - 0 likes

    out of curiosity is there any way of preventing nether portals form forming in in protected areas?

  • Avatar of GoldenGuy555 GoldenGuy555 Jun 10, 2013 at 02:47 UTC - 1 like

    I hate to be a bug but this could really use an update

  • Avatar of MrMightyGnome MrMightyGnome Apr 15, 2013 at 01:50 UTC - 0 likes

    Can 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 :)

  • Avatar of Feaelin Feaelin Feb 26, 2013 at 21:44 UTC - 0 likes

    @mtarnuhal: Go

    Yeah, it appears they've changed something that breaks KPortalToPortal.

  • Avatar of mtarnuhal mtarnuhal Feb 24, 2013 at 20:40 UTC - 0 likes

    This Plugin Doesnt work in 1.4.7 R1.0 It creates a random portal on the map when u teleport back from the nether.

    Last edited Feb 24, 2013 by mtarnuhal
  • Avatar of TheCanadianLizard TheCanadianLizard Dec 19, 2012 at 01:57 UTC - 0 likes

    Thank 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

  • 7 comments

Table of contents

  1. 1 KPortalToPortal

Facts

Date created
Nov 11, 2012
Categories
Last update
Nov 11, 2012
Development stage
Release
Language
  • enUS
License
GNU General Public License version 3 (GPLv3)
Curse link
KPortalToPortal
Downloads
1,510
Recent file
  • R: 1.0.1B for CB 1.4.2-R0.2 Nov 11, 2012

Authors