mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-29 05:55:48 +01:00
Add more fixes that I broke when fixing #255
This commit is contained in:
parent
9710501a03
commit
0c847eefdf
@ -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);
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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())) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user