mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 22:26:45 +01:00
Prevent dragon eggs from leaving or entering plot bounds (#3075)
* Negate mob-place flag debug message * fixed a little typo :) * Added check for dragon egg teleportation event https://github.com/IntellectualSites/PlotSquared/issues/3074 * Basic dragon egg interact bugfix (Left-click interaction) Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
parent
dc7e6010cb
commit
2045a4988d
@ -751,7 +751,7 @@ public class BlockEventListener implements Listener {
|
|||||||
if (plot != null && plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
|
if (plot != null && plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
|
||||||
.getBlock()
|
.getBlock()
|
||||||
.isLiquid()) {
|
.isLiquid()) {
|
||||||
plot.debug("Liquid could now flow because liquid-flow = disabled");
|
plot.debug("Liquid could not flow because liquid-flow = disabled");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -761,9 +761,24 @@ public class BlockEventListener implements Listener {
|
|||||||
Location tLocation = BukkitUtil.adapt(to.getLocation());
|
Location tLocation = BukkitUtil.adapt(to.getLocation());
|
||||||
PlotArea area = tLocation.getPlotArea();
|
PlotArea area = tLocation.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
|
if (from.getType() == Material.DRAGON_EGG && fromArea != null) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = area.getOwnedPlot(tLocation);
|
Plot plot = area.getOwnedPlot(tLocation);
|
||||||
|
|
||||||
|
if (from.getType() == Material.DRAGON_EGG && fromArea != null) {
|
||||||
|
final Plot fromPlot = fromArea.getOwnedPlot(fLocation);
|
||||||
|
|
||||||
|
if (fromPlot != null || plot != null) {
|
||||||
|
if ((fromPlot == null || !fromPlot.equals(plot)) && (plot == null || !plot.equals(fromPlot))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(plot, area.getOwnedPlot(fLocation))) {
|
if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(plot, area.getOwnedPlot(fLocation))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -1103,6 +1103,17 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case LEFT_CLICK_BLOCK: {
|
||||||
|
Material blockType = block.getType();
|
||||||
|
|
||||||
|
// todo: when the code above is rearranged, it would be great to beautify this as well.
|
||||||
|
// will code this as a temporary, specific bug fix (for dragon eggs)
|
||||||
|
if (blockType != Material.DRAGON_EGG) return;
|
||||||
|
|
||||||
|
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||||
|
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user