Using Portals Support

Introduction

WorldPos v3 introduced portals support (actually it doesn't even have to be a portal, more on this later). WorldPos does not hook into any plugins to do this, instead I used a pretty clever method. In this page I will show you how to take advantage of this feature.

Requirements

  1. WorldPos installed,
  2. Multiverse,
  3. Multiverse portals (most portal plugins will work, I just like this one)

Background Information

Before I explain how to use this feature, I'd like you to know how it works. Knowing how it works allows you to take greater advantage of it. WorldPos knows when you went though a portal by checking the following conditions:

  1. Did the player change worlds?
  2. Is the player's Y position 300?

Here's the code for those interested:

wnF = world name from

wnT = world name to

if(Settings.portalSupport) {
	if(!wnF.equalsIgnoreCase(wnT) && event.getTo().getY()==300) {
		try {
			event.setTo(LocationManager.getPastLocation(event.getTo().getWorld(), p));
			p.sendMessage(ChatColor.AQUA+"Teleported to world "+ChatColor.YELLOW+wnT+ChatColor.AQUA+" via portal.");
		} catch (IOException e) {
			e.printStackTrace();
		}
		return;
	}
}

What happens here is that WorldPos checks if the player changed worlds during the teleport, and if the player's new location has a Y value (height) of 300. If both of those conditions are true, the plugin finds the player's last location in that world and redirects them there. This process is completely transparent to the user.

Note: There is no specific reason for the Y coordinate to be 300, I just decided I would use that number. The Y coordinate of 300 is just a "marker" of sorts.

Tutorial using Multiverse Portals

Read this wiki page first or you will be very confused click here

  1. Select your portal like normal (using worldedit wand)
  2. Create the portal using the following command (important!)
    /mvp create newportal e:foo:0,300,0
    
    replace "newportal" with your portal name (can be anything), replace "foo" with the world name that this portal will lead to
  3. You're done!

Now if you walk into the portal it will take you your last location in the world you specified ("foo" in this example)

If you still can't figure it out, leave a ticket or message me on skype: mikem724


Comments

Posts Quoted:
Reply
Clear All Quotes