Hoppers will now auto link with hoppers they are naturally linked with.

This commit is contained in:
Brianna O'Keefe 2018-11-01 16:29:14 -04:00
parent 5856a2481c
commit 20a90db980
3 changed files with 11 additions and 9 deletions

View File

@ -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);
}

View File

@ -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:

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>EpicHoppers</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>3.1.24</version>
<version>3.1.25</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>