mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-29 14:06:30 +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
|
// TODO: Provide better feedback
|
||||||
@Override
|
@Override
|
||||||
public boolean setProperty(String name, String value, CommandSender sender) throws PropertyDoesNotExistException {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
throw new PropertyDoesNotExistException(name);
|
throw new PropertyDoesNotExistException(name);
|
||||||
|
@ -24,8 +24,7 @@ import org.bukkit.event.Event;
|
|||||||
public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
|
public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
|
||||||
private MultiverseWorld world;
|
private MultiverseWorld world;
|
||||||
private CommandSender changer;
|
private CommandSender changer;
|
||||||
private MVConfigProperty property;
|
private boolean isCancelled = false;
|
||||||
private boolean isCancelled;
|
|
||||||
private String value;
|
private String value;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ -43,11 +42,11 @@ public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getNewValue() {
|
public String getNewValue() {
|
||||||
return this.property.getName();
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String setNewValue() {
|
public void setNewValue(String value) {
|
||||||
return this.property.getName();
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,10 +58,6 @@ public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
|
|||||||
return this.world;
|
return this.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMVConfigProperty(MVConfigProperty property) {
|
|
||||||
this.property = property;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the person (or console) who was responsible for the change.
|
* Gets the person (or console) who was responsible for the change.
|
||||||
*
|
*
|
||||||
|
@ -146,14 +146,14 @@ public class MVPlayerListener extends PlayerListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerPortal(PlayerPortalEvent event) {
|
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) {
|
if (event.isCancelled() || event.getTo() == null || event.getFrom() == null) {
|
||||||
return;
|
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 fromWorld = this.worldManager.getMVWorld(event.getFrom().getWorld().getName());
|
||||||
MultiverseWorld toWorld = this.worldManager.getMVWorld(event.getTo().getWorld().getName());
|
MultiverseWorld toWorld = this.worldManager.getMVWorld(event.getTo().getWorld().getName());
|
||||||
if (event.getFrom().getWorld().equals(event.getTo().getWorld())) {
|
if (event.getFrom().getWorld().equals(event.getTo().getWorld())) {
|
||||||
|
@ -288,7 +288,9 @@ public class SafeTTeleporter {
|
|||||||
public static Location findPortalBlockNextTo(Location l) {
|
public static Location findPortalBlockNextTo(Location l) {
|
||||||
Block b = l.getWorld().getBlockAt(l);
|
Block b = l.getWorld().getBlockAt(l);
|
||||||
Location foundLocation = null;
|
Location foundLocation = null;
|
||||||
|
if (b.getType() == Material.PORTAL) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
if (b.getRelative(BlockFace.NORTH).getType() == Material.PORTAL) {
|
if (b.getRelative(BlockFace.NORTH).getType() == Material.PORTAL) {
|
||||||
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.NORTH).getLocation(), foundLocation);
|
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.NORTH).getLocation(), foundLocation);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user