diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 285a296..828853e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "EpicHoppers" path: "/builds/$CI_PROJECT_PATH" - version: "4.3.3" + version: "4.3.4" build: stage: build diff --git a/src/main/java/com/songoda/epichoppers/gui/GUIOverview.java b/src/main/java/com/songoda/epichoppers/gui/GUIOverview.java index 4f025ee..bc5a7a4 100644 --- a/src/main/java/com/songoda/epichoppers/gui/GUIOverview.java +++ b/src/main/java/com/songoda/epichoppers/gui/GUIOverview.java @@ -165,16 +165,15 @@ public class GUIOverview extends Gui { if (ii == 0) { setButton(slot, hook, (event) -> { + hopper.clearLinkedBlocks(); if (event.clickType == ClickType.RIGHT) { plugin.getLocale().getMessage("event.hopper.desync").sendPrefixedMessage(player); - hopper.clearLinkedBlocks(); } else { if (hopper.getLastPlayerOpened() != null && !hopper.getLastPlayerOpened().equals(player.getUniqueId())) { plugin.getLocale().getMessage("event.hopper.syncdidnotplace").sendPrefixedMessage(player); return; } plugin.getPlayerDataManager().getPlayerData(player).setSyncType(SyncType.REGULAR); - hopper.clearLinkedBlocks(); plugin.getLocale().getMessage("event.hopper.syncnext").sendPrefixedMessage(player); if (level.getLinkAmount() > 1) diff --git a/src/main/java/com/songoda/epichoppers/hopper/Hopper.java b/src/main/java/com/songoda/epichoppers/hopper/Hopper.java index 98d308c..2c31bfe 100644 --- a/src/main/java/com/songoda/epichoppers/hopper/Hopper.java +++ b/src/main/java/com/songoda/epichoppers/hopper/Hopper.java @@ -156,12 +156,13 @@ public class Hopper { this.lastPlayerOpened = player.getUniqueId(); if (level.getLinkAmount() > 1) { - if (getLinkedBlocks().size() == level.getLinkAmount()) { + if (linkedBlocks.size() >= level.getLinkAmount()) { instance.getLocale().getMessage("event.hopper.syncdone").sendPrefixedMessage(player); + cancelSync(player); return; } instance.getLocale().getMessage("event.hopper.syncsuccessmore") - .processPlaceholder("amount", level.getLinkAmount() - getLinkedBlocks().size()) + .processPlaceholder("amount", level.getLinkAmount() - linkedBlocks.size()) .sendPrefixedMessage(player); return; }