mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-05 09:20:52 +01:00
Fixes #405
This commit is contained in:
parent
d0b90c2679
commit
f471a05dcd
21
pom.xml
21
pom.xml
@ -48,30 +48,11 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<executions>
|
<version>2.10.3</version>
|
||||||
<execution>
|
|
||||||
<id>attach-javadocs</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<additionalparam>-Xdoclint:none</additionalparam>
|
<additionalparam>-Xdoclint:none</additionalparam>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-sources</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -13,6 +13,8 @@ import java.util.Stack;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.*;
|
import com.intellectualcrafters.plot.commands.*;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -108,6 +110,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
version[2] = Integer.parseInt(split[2]);
|
version[2] = Integer.parseInt(split[2]);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,9 +221,9 @@ public class DebugUUID extends SubCommand {
|
|||||||
if (value != null) {
|
if (value != null) {
|
||||||
plot.owner = value;
|
plot.owner = value;
|
||||||
}
|
}
|
||||||
plot.trusted = new ArrayList<>();
|
plot.trusted = new HashSet<>();
|
||||||
plot.members = new ArrayList<>();
|
plot.members = new HashSet<>();
|
||||||
plot.denied = new ArrayList<>();
|
plot.denied = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainUtil.sendConsoleMessage("&7 - Deleting database");
|
MainUtil.sendConsoleMessage("&7 - Deleting database");
|
||||||
|
@ -935,7 +935,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
user = UUID.fromString(o);
|
user = UUID.fromString(o);
|
||||||
uuids.put(o, user);
|
uuids.put(o, user);
|
||||||
}
|
}
|
||||||
p = new Plot(plot_id, user, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), "", null, null, worldname, new boolean[]{false, false, false, false});
|
p = new Plot(plot_id, user, new HashSet<UUID>(), new HashSet<UUID>(), new HashSet<UUID>(), "", null, null, worldname, new boolean[]{false, false, false, false});
|
||||||
plots.put(id, p);
|
plots.put(id, p);
|
||||||
}
|
}
|
||||||
if (Settings.CACHE_RATINGS) {
|
if (Settings.CACHE_RATINGS) {
|
||||||
|
@ -19,18 +19,18 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.Creature;
|
import org.bukkit.entity.Creature;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
|
import org.bukkit.entity.Hanging;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.ItemFrame;
|
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
|
||||||
import org.bukkit.entity.Vehicle;
|
import org.bukkit.entity.Vehicle;
|
||||||
import org.bukkit.entity.minecart.RideableMinecart;
|
import org.bukkit.entity.minecart.RideableMinecart;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -60,7 +60,6 @@ import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
|||||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.event.painting.PaintingBreakEvent;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||||
@ -73,15 +72,11 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.event.player.PlayerUnleashEntityEvent;
|
|
||||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
import org.bukkit.event.world.StructureGrowEvent;
|
import org.bukkit.event.world.StructureGrowEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.projectiles.BlockProjectileSource;
|
import org.bukkit.projectiles.BlockProjectileSource;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@ -206,9 +201,11 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
case POWERED_RAIL: {
|
case POWERED_RAIL: {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
default: {
|
||||||
event.setNewCurrent(0);
|
event.setNewCurrent(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPhysicsEvent(BlockPhysicsEvent event) {
|
public void onPhysicsEvent(BlockPhysicsEvent event) {
|
||||||
@ -234,6 +231,9 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (block.getType().hasGravity()) {
|
if (block.getType().hasGravity()) {
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
@ -358,8 +358,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
public void PlayerMove(final PlayerMoveEvent event) {
|
public void PlayerMove(final PlayerMoveEvent event) {
|
||||||
org.bukkit.Location from = event.getFrom();
|
org.bukkit.Location from = event.getFrom();
|
||||||
org.bukkit.Location to = event.getTo();
|
org.bukkit.Location to = event.getTo();
|
||||||
int x1, x2;
|
int x2;
|
||||||
if ((x1 = (int) from.getX()) != (x2 = (int) to.getX()) ) {
|
if (from.getX() != (x2 = (int) to.getX()) ) {
|
||||||
String worldname = to.getWorld().getName();
|
String worldname = to.getWorld().getName();
|
||||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||||
if (plotworld == null) {
|
if (plotworld == null) {
|
||||||
@ -421,8 +421,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int z1, z2;
|
int z2;
|
||||||
if ((z1 = (int) from.getZ()) != (z2 = (int) to.getZ()) ) {
|
if ((int) from.getZ() != (z2 = (int) to.getZ()) ) {
|
||||||
String worldname = to.getWorld().getName();
|
String worldname = to.getWorld().getName();
|
||||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||||
if (plotworld == null) {
|
if (plotworld == null) {
|
||||||
@ -980,6 +980,9 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
eventType = PlayerBlockEventType.TELEPORT_OBJECT;
|
eventType = PlayerBlockEventType.TELEPORT_OBJECT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lb = new BukkitLazyBlock(blockId, block);
|
lb = new BukkitLazyBlock(blockId, block);
|
||||||
ItemStack hand = player.getItemInHand();
|
ItemStack hand = player.getItemInHand();
|
||||||
@ -991,8 +994,6 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
lb = new BukkitLazyBlock(block);
|
lb = new BukkitLazyBlock(block);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO calls both:
|
// TODO calls both:
|
||||||
// redstone ore
|
// redstone ore
|
||||||
|
|
||||||
@ -1004,6 +1005,11 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ARMOR_STAND: {
|
||||||
|
eventType = PlayerBlockEventType.PLACE_MISC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WRITTEN_BOOK:
|
case WRITTEN_BOOK:
|
||||||
case BOOK_AND_QUILL:
|
case BOOK_AND_QUILL:
|
||||||
case BOOK: {
|
case BOOK: {
|
||||||
@ -1051,14 +1057,9 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
eventType = PlayerBlockEventType.PLACE_HANGING;
|
eventType = PlayerBlockEventType.PLACE_HANGING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ARMOR_STAND: {
|
|
||||||
eventType = PlayerBlockEventType.PLACE_MISC;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1645,120 +1646,142 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onEntityDamageByEntityEvent(final EntityDamageByEntityEvent e) {
|
public void onEntityDamageByEntityEvent(final EntityDamageByEntityEvent e) {
|
||||||
final Location l = BukkitUtil.getLocation(e.getEntity());
|
final Location l = BukkitUtil.getLocation(e.getEntity());
|
||||||
|
if (!PS.get().isPlotWorld(l.getWorld())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Entity damager = e.getDamager();
|
final Entity damager = e.getDamager();
|
||||||
final Entity victim = e.getEntity();
|
final Entity victim = e.getEntity();
|
||||||
if ((Settings.TELEPORT_DELAY != 0) && (TaskManager.TELEPORT_QUEUE.size() > 0) && (victim instanceof Player)) {
|
|
||||||
final Player player = (Player) victim;
|
Location dloc = BukkitUtil.getLocation(damager);
|
||||||
final String name = player.getName();
|
Location vloc = BukkitUtil.getLocation(victim);
|
||||||
if (TaskManager.TELEPORT_QUEUE.contains(name)) {
|
|
||||||
TaskManager.TELEPORT_QUEUE.remove(name);
|
Plot dplot = MainUtil.getPlot(dloc);
|
||||||
|
Plot vplot = MainUtil.getPlot(vloc);
|
||||||
|
|
||||||
|
Plot plot;
|
||||||
|
String stub;
|
||||||
|
if (dplot == null && vplot == null) {
|
||||||
|
if (!MainUtil.isPlotAreaAbs(dloc)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
plot = null;
|
||||||
|
stub = "road";
|
||||||
}
|
}
|
||||||
if (PS.get().isPlotWorld(l.getWorld())) {
|
else {
|
||||||
Player p = null;
|
// Priorize plots for close to seamless pvp zones
|
||||||
Projectile projectile = null;
|
plot = vplot == null ? dplot : ((dplot == null || victim instanceof Player) ? vplot : (victim.getTicksLived() > damager.getTicksLived() ? dplot : vplot));
|
||||||
if (damager instanceof Player) {
|
stub = plot.hasOwner() ? "other" : "unowned";
|
||||||
p = (Player) damager;
|
}
|
||||||
|
|
||||||
|
Player player;
|
||||||
|
if (damager instanceof Player) { // attacker is player
|
||||||
|
player = (Player) damager;
|
||||||
}
|
}
|
||||||
else if (damager instanceof Projectile) {
|
else if (damager instanceof Projectile) {
|
||||||
projectile = (Projectile) damager;
|
Projectile projectile = (Projectile) damager;
|
||||||
//Arrow, Egg, EnderPearl, Fireball, Fish, FishHook, LargeFireball, SmallFireball, Snowball, ThrownExpBottle, ThrownPotion, WitherSkull
|
|
||||||
if (damager instanceof Projectile) {
|
|
||||||
if (damager instanceof ThrownPotion) {
|
|
||||||
ThrownPotion potion = (ThrownPotion) damager;
|
|
||||||
Collection<PotionEffect> effects = potion.getEffects();
|
|
||||||
for (PotionEffect effect : effects) {
|
|
||||||
PotionEffectType type = effect.getType();
|
|
||||||
if (type == PotionEffectType.BLINDNESS || type == PotionEffectType.CONFUSION || type == PotionEffectType.HARM || type == PotionEffectType.INVISIBILITY || type == PotionEffectType.POISON || type == PotionEffectType.SLOW || type == PotionEffectType.SLOW_DIGGING || type == PotionEffectType.WEAKNESS || type == PotionEffectType.WITHER) {
|
|
||||||
ProjectileSource shooter = ((Projectile) damager).getShooter();
|
|
||||||
if (shooter == null || !(shooter instanceof Player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
p = (Player) shooter;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ProjectileSource shooter = projectile.getShooter();
|
ProjectileSource shooter = projectile.getShooter();
|
||||||
if (shooter == null || !(shooter instanceof Player)) {
|
if (shooter.getClass() == Player.class) { // shooter is player
|
||||||
|
player = (Player) shooter;
|
||||||
|
}
|
||||||
|
else { // shooter is not player
|
||||||
|
player = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // Attacker is not player
|
||||||
|
player = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
|
if (victim instanceof Hanging) { // hanging
|
||||||
|
if (plot != null && (FlagManager.isPlotFlagTrue(plot, "hanging-break") || FlagManager.isPlotFlagTrue(plot, "pve") || plot.isAdded(pp.getUUID()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = (Player) shooter;
|
if (!Permissions.hasPermission(pp, "plots.admin.break." + stub)) {
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (p != null) {
|
|
||||||
final boolean aPlr = victim instanceof Player;
|
|
||||||
final PlotWorld pW = PS.get().getPlotWorld(l.getWorld());
|
|
||||||
if (!aPlr && pW.PVE && (!(victim instanceof ItemFrame) && !(victim.getType().getTypeId() == 30))) {
|
|
||||||
return;
|
|
||||||
} else if (aPlr && pW.PVP) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = MainUtil.getPlot(l);
|
|
||||||
if (plot == null) {
|
|
||||||
if (!MainUtil.isPlotAreaAbs(l)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.pve.road")) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.road");
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.break." + stub);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (victim instanceof ArmorStand) {
|
||||||
|
if (plot != null && (FlagManager.isPlotFlagTrue(plot, "misc-break") || FlagManager.isPlotFlagTrue(plot, "pve") || plot.isAdded(pp.getUUID()))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Permissions.hasPermission(pp, "plots.admin.break." + stub)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.break." + stub);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (victim instanceof Monster) { // victim is monster
|
||||||
|
if (plot != null && (FlagManager.isPlotFlagTrue(plot, "hostile-break") || FlagManager.isPlotFlagTrue(plot, "pve") || plot.isAdded(pp.getUUID()))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Permissions.hasPermission(pp, "plots.admin.pve." + stub)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve." + stub);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (victim instanceof Tameable) { // victim is tameable
|
||||||
|
if (plot != null && (FlagManager.isPlotFlagTrue(plot, "tamed-break") || FlagManager.isPlotFlagTrue(plot, "pve") || plot.isAdded(pp.getUUID()))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Permissions.hasPermission(pp, "plots.admin.pve." + stub)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve." + stub);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (victim instanceof Animals) { // victim is animal
|
||||||
|
if (plot != null && (FlagManager.isPlotFlagTrue(plot, "animal-break") || FlagManager.isPlotFlagTrue(plot, "pve") || plot.isAdded(pp.getUUID()))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Permissions.hasPermission(pp, "plots.admin.pve." + stub)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve." + stub);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (victim instanceof Player) {
|
||||||
|
if (plot != null) {
|
||||||
|
Flag pvp = FlagManager.getPlotFlag(plot, "pvp");
|
||||||
|
if (pvp == null) {
|
||||||
|
if (victim.getTicksLived() > damager.getTicksLived() ? plot.isAdded(BukkitUtil.getPlayer((Player) victim).getUUID()) : plot.isAdded(pp.getUUID())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!plot.hasOwner()) {
|
if ((Boolean) pvp.getValue()) {
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
return;
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.pve.unowned")) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.unowned");
|
|
||||||
if (projectile != null) {
|
|
||||||
projectile.remove();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Permissions.hasPermission(pp, "plots.admin.pvp." + stub)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pvp." + stub);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
}
|
||||||
} else if (aPlr && FlagManager.isPlotFlagTrue(plot, "pvp")) {
|
else if (victim instanceof Vehicle) { // Vehicles are managed in vehicle destroy event
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!aPlr && FlagManager.isPlotFlagTrue(plot, "pve")) {
|
else { // victim is something else
|
||||||
return;
|
if (!Permissions.hasPermission(pp, "plots.admin.pvp." + stub)) {
|
||||||
}
|
|
||||||
assert plot != null;
|
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
|
||||||
if (!plot.isAdded(pp.getUUID())) {
|
|
||||||
if ((victim instanceof Monster) && FlagManager.isPlotFlagTrue(plot, "hostile-attack")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((victim instanceof Animals) && FlagManager.isPlotFlagTrue(plot, "animal-attack")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((victim instanceof Tameable) && ((Tameable) victim).isTamed() && FlagManager.isPlotFlagTrue(plot, "tamed-attack")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.pve.other")) {
|
|
||||||
if (MainUtil.isPlotArea(l)) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.other");
|
|
||||||
if (projectile != null) {
|
|
||||||
projectile.remove();
|
|
||||||
}
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pvp." + stub);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
if (plot != null && FlagManager.isPlotFlagTrue(plot, "pvp")) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((damager instanceof Arrow) && MainUtil.isPlotArea(l) && (!(victim instanceof Creature))) {
|
// player is null
|
||||||
|
if ((damager instanceof Arrow) && (!(victim instanceof Creature))) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onPlayerEggThrow(final PlayerEggThrowEvent e) {
|
public void onPlayerEggThrow(final PlayerEggThrowEvent e) {
|
||||||
|
@ -56,15 +56,15 @@ public class Plot implements Cloneable {
|
|||||||
/**
|
/**
|
||||||
* List of trusted (with plot permissions)
|
* List of trusted (with plot permissions)
|
||||||
*/
|
*/
|
||||||
public ArrayList<UUID> trusted;
|
public HashSet<UUID> trusted;
|
||||||
/**
|
/**
|
||||||
* List of members users (with plot permissions)
|
* List of members users (with plot permissions)
|
||||||
*/
|
*/
|
||||||
public ArrayList<UUID> members;
|
public HashSet<UUID> members;
|
||||||
/**
|
/**
|
||||||
* List of denied players
|
* List of denied players
|
||||||
*/
|
*/
|
||||||
public ArrayList<UUID> denied;
|
public HashSet<UUID> denied;
|
||||||
/**
|
/**
|
||||||
* External settings class<br>
|
* External settings class<br>
|
||||||
* - Please favor the methods over direct access to this class<br>
|
* - Please favor the methods over direct access to this class<br>
|
||||||
@ -94,9 +94,9 @@ public class Plot implements Cloneable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.settings = new PlotSettings(this);
|
this.settings = new PlotSettings(this);
|
||||||
this.trusted = new ArrayList<>();
|
this.trusted = new HashSet<>();
|
||||||
this.members = new ArrayList<>();
|
this.members = new HashSet<>();
|
||||||
this.denied = new ArrayList<>();
|
this.denied = new HashSet<>();
|
||||||
this.temp = false;
|
this.temp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,9 +113,9 @@ public class Plot implements Cloneable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.settings = new PlotSettings(this);
|
this.settings = new PlotSettings(this);
|
||||||
this.trusted = new ArrayList<>();
|
this.trusted = new HashSet<>();
|
||||||
this.members = new ArrayList<>();
|
this.members = new HashSet<>();
|
||||||
this.denied = new ArrayList<>();
|
this.denied = new HashSet<>();
|
||||||
this.temp = temp;
|
this.temp = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ public class Plot implements Cloneable {
|
|||||||
* @param denied
|
* @param denied
|
||||||
* @param merged
|
* @param merged
|
||||||
*/
|
*/
|
||||||
public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> trusted, final ArrayList<UUID> members, final ArrayList<UUID> denied, final String alias, final BlockLoc position, final Collection<Flag> flags, final String world, final boolean[] merged) {
|
public Plot(final PlotId id, final UUID owner, final HashSet<UUID> trusted, final HashSet<UUID> members, final HashSet<UUID> denied, final String alias, final BlockLoc position, final Collection<Flag> flags, final String world, final boolean[] merged) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.settings = new PlotSettings(this);
|
this.settings = new PlotSettings(this);
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
@ -61,13 +61,15 @@ public class SetBlockQueue {
|
|||||||
if (locked) {
|
if (locked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (blocks.size() == 0) {
|
if (blocks == null || blocks.size() == 0) {
|
||||||
PS.get().TASK.cancelTask(TaskManager.tasks.get(current));
|
PS.get().TASK.cancelTask(TaskManager.tasks.get(current));
|
||||||
|
if (runnables != null) {
|
||||||
for (Runnable runnable : runnables) {
|
for (Runnable runnable : runnables) {
|
||||||
TaskManager.runTask(runnable);
|
TaskManager.runTask(runnable);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
runnables = null;
|
runnables = null;
|
||||||
blocks = null;
|
blocks = new HashMap<>();
|
||||||
running = false;
|
running = false;
|
||||||
slow = false;
|
slow = false;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user