mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
What's snow-melt doing there?
This commit is contained in:
parent
3fb6ccbbb6
commit
ff1b7c66b1
2 changed files with 20 additions and 28 deletions
|
@ -806,8 +806,23 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
if (area.getOwnedPlot(loc) == null) {
|
||||
Plot plot = area.getOwnedPlot(loc);
|
||||
if (plot == null) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
switch (b.getType()) {
|
||||
case WATER:
|
||||
case STATIONARY_WATER:
|
||||
if (FlagManager.isPlotFlagFalse(plot, "ice-melt")) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case SNOW:
|
||||
if (FlagManager.isPlotFlagFalse(plot, "snow-melt")) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,28 +28,24 @@ import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
|||
import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.EntityType;
|
||||
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.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlotPlusListener extends PlotListener implements Listener {
|
||||
|
||||
private static final HashMap<String, Interval> feedRunnable = new HashMap<>();
|
||||
|
@ -101,25 +97,6 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||
}, 0L, 20L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onMelt(BlockFadeEvent event) {
|
||||
BlockState state = event.getNewState();
|
||||
|
||||
if (state.getType() != Material.WATER && state.getType() != Material.STATIONARY_WATER) {
|
||||
return;
|
||||
}
|
||||
Plot plot = BukkitUtil.getLocation(state.getLocation()).getOwnedPlot();
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
if (!FlagManager.isBooleanFlag(plot, "ice-melt", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (FlagManager.isPlotFlagFalse(plot, "snow-melt")) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onInteract(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
|
Loading…
Reference in a new issue