mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-02 08:50:17 +01:00
Fixes #1774 (backwards compatibility)
This commit is contained in:
parent
03337fe080
commit
bc8b2af164
@ -99,7 +99,6 @@ import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Shulker;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
@ -459,8 +458,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
case WITHER:
|
||||
case WOLF:
|
||||
case ZOMBIE:
|
||||
case SHULKER:
|
||||
default:
|
||||
default: {
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||
Location location = entity.getLocation();
|
||||
if (BukkitUtil.getLocation(location).isPlotRoad()) {
|
||||
@ -484,29 +482,28 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null && BukkitUtil.getLocation(entity.getLocation()).isPlotArea()) {
|
||||
if (entity instanceof Shulker) {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
if (entity.hasMetadata("ownerplot")) {
|
||||
if(!livingEntity.isLeashed() || !entity.hasMetadata("keep")) {
|
||||
PlotId originalPlotId = (PlotId) (!entity.getMetadata("ownerplot").isEmpty() ? entity.getMetadata("ownerplot").get(0).value() : null);
|
||||
PlotId currentPlotId = BukkitUtil.getLocation(entity.getLocation()).getPlot().getId();
|
||||
if(!currentPlotId.equals(originalPlotId)) {
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!entity.hasMetadata("ownerplot")) {
|
||||
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
|
||||
entity.setMetadata("ownerplot", new FixedMetadataValue((Plugin) PS.get().IMP, BukkitUtil.getLocation(entity.getLocation()).getPlot().getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case SHULKER: {
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
if (entity.hasMetadata("plot")) {
|
||||
if (!livingEntity.isLeashed() || !entity.hasMetadata("keep")) {
|
||||
PlotId originalPlotId = (PlotId) (!entity.getMetadata("plot").isEmpty() ? entity.getMetadata("plot").get(0).value() : null);
|
||||
PlotId currentPlotId = BukkitUtil.getLocation(entity.getLocation()).getPlot().getId();
|
||||
if (!currentPlotId.equals(originalPlotId)) {
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (!entity.hasMetadata("plot")) {
|
||||
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
|
||||
entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, BukkitUtil.getLocation(entity.getLocation()).getPlot().getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
@ -42,8 +42,8 @@ public class EntitySpawnListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
case SHULKER:
|
||||
if(!entity.hasMetadata("ownerplot")) {
|
||||
entity.setMetadata("ownerplot", new FixedMetadataValue((Plugin) PS.get().IMP, plot.getId()));
|
||||
if(!entity.hasMetadata("plot")) {
|
||||
entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1263,9 +1263,11 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockDispense(BlockDispenseEvent event) {
|
||||
Material type = event.getItem().getType();
|
||||
Material dispenserType = event.getBlock().getType();
|
||||
if (dispenserType == Material.DROPPER || (type != Material.WATER_BUCKET && type != Material.LAVA_BUCKET)) {
|
||||
return;
|
||||
switch (type) {
|
||||
case WATER_BUCKET:
|
||||
case LAVA_BUCKET: {
|
||||
if (event.getBlock().getType() == Material.DROPPER) return;
|
||||
}
|
||||
}
|
||||
Location location = BukkitUtil.getLocation(event.getVelocity().toLocation(event.getBlock().getWorld()));
|
||||
if (location.isPlotRoad()) {
|
||||
|
Loading…
Reference in New Issue
Block a user