mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
Plot physics flag + ignore modified option + fix invalid plot music
Fixes #356 Fixes #355
This commit is contained in:
parent
ab03b358f5
commit
345b4599b9
@ -3,13 +3,18 @@ package com.intellectualcrafters.plot.listeners;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.EntityBlockFormEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
@ -35,7 +40,7 @@ public class ChunkListener implements Listener {
|
||||
|
||||
private Chunk lastChunk = null;
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority=EventPriority.LOWEST)
|
||||
public void onItemSpawn(ItemSpawnEvent event) {
|
||||
Item entity = event.getEntity();
|
||||
Chunk chunk = entity.getLocation().getChunk();
|
||||
@ -58,7 +63,25 @@ public class ChunkListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private long last = 0;
|
||||
private int count = 0;
|
||||
|
||||
@EventHandler(priority=EventPriority.LOWEST)
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - last < 20) {
|
||||
if (count > Settings.CHUNK_PROCESSOR_MAX_ENTITIES) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
else {
|
||||
count = 0;
|
||||
}
|
||||
last = now;
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOWEST)
|
||||
public void onEntitySpawn(CreatureSpawnEvent event) {
|
||||
LivingEntity entity = event.getEntity();
|
||||
Chunk chunk = entity.getLocation().getChunk();
|
||||
|
@ -145,12 +145,15 @@ public class PlotListener extends APlotListener {
|
||||
if (musicFlag != null) {
|
||||
player.playEffect(player.getLocation(), Effect.RECORD_PLAY, 0);
|
||||
Integer id = (Integer) musicFlag.getValue();
|
||||
if (id != 0) {
|
||||
if (id >= 2256 && id <= 2267) {
|
||||
Location center = MainUtil.getPlotCenter(plot);
|
||||
org.bukkit.Location newLoc = BukkitUtil.getLocation(center);
|
||||
newLoc.setY(Math.min((((int) player.getLocation().getBlockY())/16) * 16, 240));
|
||||
try {
|
||||
player.playEffect(newLoc, Effect.RECORD_PLAY, Material.getMaterial(id));
|
||||
}
|
||||
catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
CommentManager.sendTitle(pp, plot);
|
||||
}
|
||||
|
@ -118,9 +118,6 @@ public class ExpireManager {
|
||||
expiredPlots.get(world).remove(plot);
|
||||
return;
|
||||
}
|
||||
if (plot.settings.isMerged()) {
|
||||
MainUtil.unlinkPlot(plot);
|
||||
}
|
||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||
RunnableVal run = new RunnableVal() {
|
||||
@Override
|
||||
@ -134,10 +131,14 @@ public class ExpireManager {
|
||||
return;
|
||||
}
|
||||
else if (changed >= Settings.MIN_BLOCKS_CHANGED_IGNORED && Settings.MIN_BLOCKS_CHANGED_IGNORED > 0) {
|
||||
PlotSquared.log("&aIgnoring modified plot: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
|
||||
expiredPlots.get(world).remove(plot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (plot.settings.isMerged()) {
|
||||
MainUtil.unlinkPlot(plot);
|
||||
}
|
||||
manager.clearPlot(plotworld, plot, false, null);
|
||||
MainUtil.removeSign(plot);
|
||||
DBFunc.delete(world, plot);
|
||||
|
Loading…
Reference in New Issue
Block a user