Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.bergerkiller.bukkit.fountains;
- 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 com.bergerkiller.bukkit.common.collections.BlockMap;
- import com.bergerkiller.bukkit.fountains.FountainController.FountainOptions;
- public class SomeListener implements Listener {
- private BlockMap<Boolean> fountainActiveMap = new BlockMap<Boolean>();
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
- public void onBlockFromTo(BlockFromToEvent event) {
- event.setCancelled(FountainController.isNonSpreadingFountain(event.getBlock())
- || FountainController.isNonSpreadingFountain(event.getToBlock()));
- }
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
- public void onSignBlockPhysics(BlockPhysicsEvent event) {
- FountainOptions opts = FountainOptions.fromSignBlock(event.getBlock());
- if (opts != null) {
- Boolean activeUpState = fountainActiveMap.get(event.getBlock());
- if (activeUpState == null || activeUpState.booleanValue() != opts.up) {
- fountainActiveMap.put(event.getBlock(), opts.up);
- FountainController.animate(FountainMain.plugin, event.getBlock().getRelative(0, 2, 0), opts);
- }
- } else if (FountainController.isNonSpreadingFountain(event.getBlock())) {
- event.setCancelled(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement