added extra info to world locations

This commit is contained in:
sekwah41 2018-02-02 09:31:44 +00:00
parent 02e0d73311
commit 332d722ed7
4 changed files with 13 additions and 4 deletions

View File

@ -55,6 +55,7 @@ command.selector.detailedhelp=Gives you a portal selector to select the regions
portal.invalidselection=You must have both pos1 and pos2 selected to create a portal. portal.invalidselection=You must have both pos1 and pos2 selected to create a portal.
portal.noname=No name for the portal has been given. portal.noname=No name for the portal has been given.
portal.takenname=The name given for the portal is already taken. portal.takenname=The name given for the portal is already taken.
portal.selection.differentworlds=Both the selected points need to be in the same world.
portal.selector.poschange=\u00A7eYou have selected pos%1$s X:%2$s Y:%3$s Z:%4$s portal.selector.poschange=\u00A7eYou have selected pos%1$s X:%2$s Y:%3$s Z:%4$s

View File

@ -136,8 +136,12 @@ public class PortalManager {
int minY = Math.min(loc1.posY, loc2.posY); int minY = Math.min(loc1.posY, loc2.posY);
int minZ = Math.min(loc1.posZ, loc2.posZ); int minZ = Math.min(loc1.posZ, loc2.posZ);
PortalLocation maxLoc = new PortalLocation(maxX, maxY, maxZ); if(!loc1.worldName.equalsIgnoreCase(loc2.worldName)) {
PortalLocation minLoc = new PortalLocation(minX, minY, minZ); throw new PortalException(Lang.translate("portal.selection.differentworlds"));
}
PortalLocation maxLoc = new PortalLocation(loc1.worldName, maxX, maxY, maxZ);
PortalLocation minLoc = new PortalLocation(loc1.worldName, minX, minY, minZ);
AdvancedPortal portal = new AdvancedPortal(maxLoc, minLoc); AdvancedPortal portal = new AdvancedPortal(maxLoc, minLoc);
for(PortalTag portalTag : tags) { for(PortalTag portalTag : tags) {

View File

@ -5,8 +5,10 @@ public class PlayerLocation {
public final double posX; public final double posX;
public final double posY; public final double posY;
public final double posZ; public final double posZ;
public final String worldName;
public PlayerLocation(double posX, double posY, double posZ) { public PlayerLocation(String worldName, double posX, double posY, double posZ) {
this.worldName = worldName;
this.posX = posX; this.posX = posX;
this.posY = posY; this.posY = posY;
this.posZ = posZ; this.posZ = posZ;

View File

@ -5,8 +5,10 @@ public class PortalLocation {
public final int posX; public final int posX;
public final int posY; public final int posY;
public final int posZ; public final int posZ;
public final String worldName;
public PortalLocation(int posX, int posY, int posZ) { public PortalLocation(String worldName, int posX, int posY, int posZ) {
this.worldName = worldName;
this.posX = posX; this.posX = posX;
this.posY = posY; this.posY = posY;
this.posZ = posZ; this.posZ = posZ;