mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
Merge branch 'master' of https://github.com/IntellectualSites/PlotSquared
This commit is contained in:
commit
58eeeb16d4
@ -41,6 +41,7 @@ import org.bukkit.entity.Creature;
|
|||||||
import org.bukkit.entity.EnderDragon;
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Fireball;
|
||||||
import org.bukkit.entity.Hanging;
|
import org.bukkit.entity.Hanging;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -56,6 +57,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockDispenseEvent;
|
import org.bukkit.event.block.BlockDispenseEvent;
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
@ -1412,16 +1414,35 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
return checkEntity(plot, "entity-cap");
|
return checkEntity(plot, "entity-cap");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBlockBurn(final BlockBurnEvent e) {
|
||||||
|
final Block b = e.getBlock();
|
||||||
|
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
||||||
|
|
||||||
|
PlotArea area = loc.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Plot plot = loc.getOwnedPlot();
|
||||||
|
if (plot == null || !FlagManager.isBooleanFlag(plot, "block-burn", false)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockIgnite(final BlockIgniteEvent e) {
|
public void onBlockIgnite(final BlockIgniteEvent e) {
|
||||||
final Player player = e.getPlayer();
|
final Player player = e.getPlayer();
|
||||||
|
final Entity ent = e.getIgnitingEntity();
|
||||||
final Block b = e.getBlock();
|
final Block b = e.getBlock();
|
||||||
|
final BlockIgniteEvent.IgniteCause c = e.getCause();
|
||||||
final Location loc;
|
final Location loc;
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
loc = BukkitUtil.getLocation(b.getLocation());
|
loc = BukkitUtil.getLocation(b.getLocation());
|
||||||
} else {
|
} else {
|
||||||
final Entity ent = e.getIgnitingEntity();
|
|
||||||
if (ent != null) {
|
if (ent != null) {
|
||||||
loc = BukkitUtil.getLocation(ent);
|
loc = BukkitUtil.getLocation(ent);
|
||||||
} else if (player != null) {
|
} else if (player != null) {
|
||||||
@ -1434,36 +1455,98 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.getCause() == BlockIgniteEvent.IgniteCause.LIGHTNING) {
|
if (c == BlockIgniteEvent.IgniteCause.LIGHTNING) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player == null) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Player p = e.getPlayer();
|
|
||||||
final Plot plot = area.getOwnedPlotAbs(loc);
|
final Plot plot = area.getOwnedPlotAbs(loc);
|
||||||
if (plot == null) {
|
if (player != null) {
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
e.setCancelled(true);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!plot.hasOwner()) {
|
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
if (!plot.hasOwner()) {
|
||||||
if (!plot.isAdded(pp.getUUID())) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!plot.isAdded(pp.getUUID())) {
|
||||||
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else if (!FlagManager.isPlotFlagTrue(plot, "block-ignition")) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ent != null) {
|
||||||
|
if (plot == null || !FlagManager.isPlotFlagTrue(plot, "block-ignition")) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (c == BlockIgniteEvent.IgniteCause.FIREBALL) {
|
||||||
|
if (ent instanceof Fireball) {
|
||||||
|
final Projectile fireball = (Fireball) ent;
|
||||||
|
if (fireball.getShooter() instanceof Entity) {
|
||||||
|
final Entity shooter = (Entity) fireball.getShooter();
|
||||||
|
if (BukkitUtil.getLocation(shooter.getLocation()).getPlot() == null) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!BukkitUtil.getLocationFull(shooter).getPlot().equals(plot)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (fireball.getShooter() instanceof BlockProjectileSource) {
|
||||||
|
final Block shooter = (Block) ((BlockProjectileSource) fireball.getShooter()).getBlock();
|
||||||
|
if (BukkitUtil.getLocation(shooter.getLocation()).getPlot() == null) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!BukkitUtil.getLocation(shooter.getLocation()).getPlot().equals(plot)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (e.getIgnitingBlock() != null) {
|
||||||
|
final Block igniter = e.getIgnitingBlock();
|
||||||
|
if (c == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL) {
|
||||||
|
if (plot == null || !FlagManager.isPlotFlagTrue(plot, "block-ignition")) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (BukkitUtil.getLocation(igniter.getLocation()).getPlot() == null) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!BukkitUtil.getLocation(igniter.getLocation()).getPlot().equals(plot)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c == BlockIgniteEvent.IgniteCause.SPREAD || c == BlockIgniteEvent.IgniteCause.LAVA) {
|
||||||
|
if (plot == null || !FlagManager.isPlotFlagTrue(plot, "fire-spread")) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (BukkitUtil.getLocation(igniter.getLocation()).getPlot() == null) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!BukkitUtil.getLocation(igniter.getLocation()).getPlot().equals(plot)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1951,6 +1951,9 @@ public class PS {
|
|||||||
FlagManager.addFlag(new AbstractFlag("use", new FlagValue.PlotBlockListValue()));
|
FlagManager.addFlag(new AbstractFlag("use", new FlagValue.PlotBlockListValue()));
|
||||||
FlagManager.addFlag(new AbstractFlag("blocked-cmds", new FlagValue.StringListValue()));
|
FlagManager.addFlag(new AbstractFlag("blocked-cmds", new FlagValue.StringListValue()));
|
||||||
FlagManager.addFlag(new AbstractFlag("ice-melt", new FlagValue.BooleanValue()));
|
FlagManager.addFlag(new AbstractFlag("ice-melt", new FlagValue.BooleanValue()));
|
||||||
|
FlagManager.addFlag(new AbstractFlag("block-ignition", new FlagValue.BooleanValue()));
|
||||||
|
FlagManager.addFlag(new AbstractFlag("block-burn", new FlagValue.BooleanValue()));
|
||||||
|
FlagManager.addFlag(new AbstractFlag("fire-spread", new FlagValue.BooleanValue()));
|
||||||
FlagManager.addFlag(new AbstractFlag("snow-melt", new FlagValue.BooleanValue()));
|
FlagManager.addFlag(new AbstractFlag("snow-melt", new FlagValue.BooleanValue()));
|
||||||
FlagManager.addFlag(new AbstractFlag("keep") {
|
FlagManager.addFlag(new AbstractFlag("keep") {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user