mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Revert changes to BlockPlaceEvent
This commit is contained in:
parent
3af05e7960
commit
ed8fa0a2a5
@ -2869,12 +2869,12 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void blockCreate(BlockPlaceEvent event) {
|
public void blockCreate(BlockPlaceEvent event) {
|
||||||
Player player = event.getPlayer();
|
|
||||||
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Player player = event.getPlayer();
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
@ -2885,23 +2885,25 @@ import java.util.regex.Pattern;
|
|||||||
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED, true)) {
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
|
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
Optional<Set<BlockType>> place = plot.getFlag(Flags.PLACE);
|
Set<BlockType> place = plot.getFlag(Flags.PLACE, null);
|
||||||
|
if (place != null) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (place.isPresent() && place.get().contains(BukkitAdapter.asBlockType(block.getType()))) {
|
if (place.contains(BukkitAdapter.asBlockType(block.getType()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
}
|
||||||
return;
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
} else {
|
|
||||||
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
Captions.PERMISSION_ADMIN_BUILD_OTHER);
|
Captions.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) {
|
||||||
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
@ -2917,10 +2919,10 @@ import java.util.regex.Pattern;
|
|||||||
sendBlockChange(block.getLocation(), block.getBlockData());
|
sendBlockChange(block.getLocation(), block.getBlockData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
return;
|
Captions.PERMISSION_ADMIN_BUILD_ROAD);
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user