mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
What's snow-melt doing there?
This commit is contained in:
parent
3fb6ccbbb6
commit
ff1b7c66b1
@ -806,8 +806,23 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (area.getOwnedPlot(loc) == null) {
|
Plot plot = area.getOwnedPlot(loc);
|
||||||
|
if (plot == null) {
|
||||||
e.setCancelled(true);
|
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.events.PlayerLeavePlotEvent;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.listener.PlotListener;
|
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.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
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 {
|
public class PlotPlusListener extends PlotListener implements Listener {
|
||||||
|
|
||||||
private static final HashMap<String, Interval> feedRunnable = new HashMap<>();
|
private static final HashMap<String, Interval> feedRunnable = new HashMap<>();
|
||||||
@ -101,25 +97,6 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
}, 0L, 20L);
|
}, 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)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onInteract(BlockDamageEvent event) {
|
public void onInteract(BlockDamageEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
Loading…
Reference in New Issue
Block a user