mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +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.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Shulker;
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
@ -459,8 +458,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
case WITHER:
|
case WITHER:
|
||||||
case WOLF:
|
case WOLF:
|
||||||
case ZOMBIE:
|
case ZOMBIE:
|
||||||
case SHULKER:
|
default: {
|
||||||
default:
|
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||||
Location location = entity.getLocation();
|
Location location = entity.getLocation();
|
||||||
if (BukkitUtil.getLocation(location).isPlotRoad()) {
|
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()) {
|
case SHULKER: {
|
||||||
if (entity instanceof Shulker) {
|
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||||
LivingEntity livingEntity = (LivingEntity) entity;
|
LivingEntity livingEntity = (LivingEntity) entity;
|
||||||
if (entity.hasMetadata("ownerplot")) {
|
if (entity.hasMetadata("plot")) {
|
||||||
if(!livingEntity.isLeashed() || !entity.hasMetadata("keep")) {
|
if (!livingEntity.isLeashed() || !entity.hasMetadata("keep")) {
|
||||||
PlotId originalPlotId = (PlotId) (!entity.getMetadata("ownerplot").isEmpty() ? entity.getMetadata("ownerplot").get(0).value() : null);
|
PlotId originalPlotId = (PlotId) (!entity.getMetadata("plot").isEmpty() ? entity.getMetadata("plot").get(0).value() : null);
|
||||||
PlotId currentPlotId = BukkitUtil.getLocation(entity.getLocation()).getPlot().getId();
|
PlotId currentPlotId = BukkitUtil.getLocation(entity.getLocation()).getPlot().getId();
|
||||||
if(!currentPlotId.equals(originalPlotId)) {
|
if (!currentPlotId.equals(originalPlotId)) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
if (!entity.hasMetadata("plot")) {
|
||||||
if(!entity.hasMetadata("ownerplot")) {
|
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
|
||||||
//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()));
|
||||||
entity.setMetadata("ownerplot", new FixedMetadataValue((Plugin) PS.get().IMP, BukkitUtil.getLocation(entity.getLocation()).getPlot().getId()));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -42,8 +42,8 @@ public class EntitySpawnListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
case SHULKER:
|
case SHULKER:
|
||||||
if(!entity.hasMetadata("ownerplot")) {
|
if(!entity.hasMetadata("plot")) {
|
||||||
entity.setMetadata("ownerplot", new FixedMetadataValue((Plugin) PS.get().IMP, plot.getId()));
|
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)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockDispense(BlockDispenseEvent event) {
|
public void onBlockDispense(BlockDispenseEvent event) {
|
||||||
Material type = event.getItem().getType();
|
Material type = event.getItem().getType();
|
||||||
Material dispenserType = event.getBlock().getType();
|
switch (type) {
|
||||||
if (dispenserType == Material.DROPPER || (type != Material.WATER_BUCKET && type != Material.LAVA_BUCKET)) {
|
case WATER_BUCKET:
|
||||||
return;
|
case LAVA_BUCKET: {
|
||||||
|
if (event.getBlock().getType() == Material.DROPPER) return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Location location = BukkitUtil.getLocation(event.getVelocity().toLocation(event.getBlock().getWorld()));
|
Location location = BukkitUtil.getLocation(event.getVelocity().toLocation(event.getBlock().getWorld()));
|
||||||
if (location.isPlotRoad()) {
|
if (location.isPlotRoad()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user