Reviewed and Rewrote Commands #169

Merged
SenseiKiwi merged 17 commits from master into master 2014-07-06 01:59:42 +00:00
Showing only changes of commit 06cf72f9f7 - Show all commits

View File

@@ -484,10 +484,31 @@ public class DDTeleporter
{ {
if (PocketManager.isBlackListed(link.destination().getDimension())) if (PocketManager.isBlackListed(link.destination().getDimension()))
{ {
// Overwrite this link to a blacklisted destination with a safe exit link // This link leads to a dimension that has been blacklisted.
// We don't need to change 'link' to a different reference. // That means that it was a pocket and it was deleted.
// NewDimData will overwrite the existing link in-place. // Depending on the link type, we must overwrite it or cancel
PocketManager.getDimensionData(link.source().getDimension()).createLink(link.source(), LinkTypes.SAFE_EXIT, link.orientation()); // the teleport operation. We don't need to assign 'link' with
// a different value. NewDimData will overwrite it in-place.
NewDimData start = PocketManager.getDimensionData(link.source().getDimension());
if (link.linkType() == LinkTypes.DUNGEON)
{
// Ovewrite the link into a dungeon link with no destination
start.createLink(link.source(), LinkTypes.DUNGEON, link.orientation());
}
else
{
if (start.isPocketDimension())
{
// Ovewrite the link into a safe exit link, because
// this could be the only way out from a pocket.
start.createLink(link.source(), LinkTypes.SAFE_EXIT, link.orientation());
}
else
{
// Cancel the teleport attempt
return false;
}
}
} }
else else
{ {