Skip to content

Commit

Permalink
What's snow-melt doing there?
Browse files Browse the repository at this point in the history
  • Loading branch information
boy0001 committed Mar 27, 2016
1 parent 3fb6ccb commit ff1b7c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,23 @@ public void onFade(BlockFadeEvent e) {
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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,24 @@
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<>();
Expand Down Expand Up @@ -101,25 +97,6 @@ public void run() {
}, 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();
Expand Down

0 comments on commit ff1b7c6

Please sign in to comment.