mirror of
https://github.com/songoda/EpicHoppers.git
synced 2025-02-02 21:11:40 +01:00
Hoppers will now auto link with hoppers they are naturally linked with.
This commit is contained in:
parent
5856a2481c
commit
20a90db980
@ -3,6 +3,8 @@ package com.songoda.epichoppers.listeners;
|
||||
import com.songoda.epichoppers.EpicHoppersPlugin;
|
||||
import com.songoda.epichoppers.api.hopper.Hopper;
|
||||
import com.songoda.epichoppers.utils.Debugger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
@ -20,17 +22,17 @@ public class HopperListeners implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onHop(InventoryMoveItemEvent e) {
|
||||
public void onHop(InventoryMoveItemEvent event) {
|
||||
try {
|
||||
Inventory source = e.getSource();
|
||||
Inventory source = event.getSource();
|
||||
|
||||
if (!instance.getHopperManager().isHopper(e.getSource().getLocation())) return;
|
||||
if (source.getLocation().getBlock().getType() != Material.HOPPER) return;
|
||||
|
||||
Hopper hopper = instance.getHopperManager().getHopper(e.getSource().getLocation());
|
||||
|
||||
if (source.getHolder() instanceof Hopper && hopper.getSyncedBlock() != null) {
|
||||
e.setCancelled(true);
|
||||
Hopper hopper = instance.getHopperManager().getHopper(source.getLocation());
|
||||
if (hopper.getSyncedBlock() == null) {
|
||||
hopper.setSyncedBlock(event.getDestination().getLocation().getBlock());
|
||||
}
|
||||
event.setCancelled(true);
|
||||
} catch (Exception ee) {
|
||||
Debugger.runReport(ee);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ description: EpicHoppers
|
||||
main: com.songoda.epichoppers.EpicHoppersPlugin
|
||||
depend: [Arconix]
|
||||
softdepend: [WildStacker, Towny, RedProtect, Kingdoms, PlotsSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, Vault]
|
||||
version: 3.1.24
|
||||
version: 3.1.25
|
||||
author: Songoda
|
||||
api-version: 1.13
|
||||
commands:
|
||||
|
Loading…
Reference in New Issue
Block a user