Add more fixes that I broke when fixing #255

This commit is contained in:
Eric Stokes 2011-11-25 16:57:01 -07:00
parent 9710501a03
commit 0c847eefdf
4 changed files with 12 additions and 15 deletions

View File

@ -327,7 +327,7 @@ public class MVWorld implements MultiverseWorld {
// TODO: Provide better feedback
@Override
public boolean setProperty(String name, String value, CommandSender sender) throws PropertyDoesNotExistException {
if (this.setKnownProperty(this.propertyAliases.get(name), value, sender)) {
if (this.setKnownProperty(name, value, sender) || this.setKnownProperty(this.propertyAliases.get(name), value, sender)) {
return true;
}
throw new PropertyDoesNotExistException(name);

View File

@ -24,8 +24,7 @@ import org.bukkit.event.Event;
public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
private MultiverseWorld world;
private CommandSender changer;
private MVConfigProperty property;
private boolean isCancelled;
private boolean isCancelled = false;
private String value;
private String name;
@ -43,11 +42,11 @@ public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
}
public String getNewValue() {
return this.property.getName();
return this.value;
}
public String setNewValue() {
return this.property.getName();
public void setNewValue(String value) {
this.value = value;
}
/**
@ -59,10 +58,6 @@ public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
return this.world;
}
public void setMVConfigProperty(MVConfigProperty property) {
this.property = property;
}
/**
* Gets the person (or console) who was responsible for the change.
*

View File

@ -146,14 +146,14 @@ public class MVPlayerListener extends PlayerListener {
@Override
public void onPlayerPortal(PlayerPortalEvent event) {
// If the player was actually outside of the portal, adjust the from location
if (event.getFrom().getWorld().getBlockAt(event.getFrom()).getType() != Material.PORTAL) {
event.setFrom(SafeTTeleporter.findPortalBlockNextTo(event.getFrom()));
}
if (event.isCancelled() || event.getTo() == null || event.getFrom() == null) {
return;
}
// If the player was actually outside of the portal, adjust the from location
if (event.getFrom().getWorld().getBlockAt(event.getFrom()).getType() != Material.PORTAL) {
event.setFrom(SafeTTeleporter.findPortalBlockNextTo(event.getFrom()));
}
MultiverseWorld fromWorld = this.worldManager.getMVWorld(event.getFrom().getWorld().getName());
MultiverseWorld toWorld = this.worldManager.getMVWorld(event.getTo().getWorld().getName());
if (event.getFrom().getWorld().equals(event.getTo().getWorld())) {

View File

@ -288,7 +288,9 @@ public class SafeTTeleporter {
public static Location findPortalBlockNextTo(Location l) {
Block b = l.getWorld().getBlockAt(l);
Location foundLocation = null;
if (b.getType() == Material.PORTAL) {
return l;
}
if (b.getRelative(BlockFace.NORTH).getType() == Material.PORTAL) {
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.NORTH).getLocation(), foundLocation);
}