mirror of
https://github.com/songoda/EpicHoppers.git
synced 2025-02-18 12:51:31 +01:00
Fix Link canceling issues.
This commit is contained in:
parent
59ed48b361
commit
239b0f967c
@ -165,16 +165,15 @@ public class GUIOverview extends Gui {
|
|||||||
if (ii == 0) {
|
if (ii == 0) {
|
||||||
setButton(slot, hook,
|
setButton(slot, hook,
|
||||||
(event) -> {
|
(event) -> {
|
||||||
|
hopper.clearLinkedBlocks();
|
||||||
if (event.clickType == ClickType.RIGHT) {
|
if (event.clickType == ClickType.RIGHT) {
|
||||||
plugin.getLocale().getMessage("event.hopper.desync").sendPrefixedMessage(player);
|
plugin.getLocale().getMessage("event.hopper.desync").sendPrefixedMessage(player);
|
||||||
hopper.clearLinkedBlocks();
|
|
||||||
} else {
|
} else {
|
||||||
if (hopper.getLastPlayerOpened() != null && !hopper.getLastPlayerOpened().equals(player.getUniqueId())) {
|
if (hopper.getLastPlayerOpened() != null && !hopper.getLastPlayerOpened().equals(player.getUniqueId())) {
|
||||||
plugin.getLocale().getMessage("event.hopper.syncdidnotplace").sendPrefixedMessage(player);
|
plugin.getLocale().getMessage("event.hopper.syncdidnotplace").sendPrefixedMessage(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plugin.getPlayerDataManager().getPlayerData(player).setSyncType(SyncType.REGULAR);
|
plugin.getPlayerDataManager().getPlayerData(player).setSyncType(SyncType.REGULAR);
|
||||||
hopper.clearLinkedBlocks();
|
|
||||||
plugin.getLocale().getMessage("event.hopper.syncnext").sendPrefixedMessage(player);
|
plugin.getLocale().getMessage("event.hopper.syncnext").sendPrefixedMessage(player);
|
||||||
|
|
||||||
if (level.getLinkAmount() > 1)
|
if (level.getLinkAmount() > 1)
|
||||||
|
@ -156,12 +156,13 @@ public class Hopper {
|
|||||||
this.lastPlayerOpened = player.getUniqueId();
|
this.lastPlayerOpened = player.getUniqueId();
|
||||||
|
|
||||||
if (level.getLinkAmount() > 1) {
|
if (level.getLinkAmount() > 1) {
|
||||||
if (getLinkedBlocks().size() == level.getLinkAmount()) {
|
if (linkedBlocks.size() >= level.getLinkAmount()) {
|
||||||
instance.getLocale().getMessage("event.hopper.syncdone").sendPrefixedMessage(player);
|
instance.getLocale().getMessage("event.hopper.syncdone").sendPrefixedMessage(player);
|
||||||
|
cancelSync(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
instance.getLocale().getMessage("event.hopper.syncsuccessmore")
|
instance.getLocale().getMessage("event.hopper.syncsuccessmore")
|
||||||
.processPlaceholder("amount", level.getLinkAmount() - getLinkedBlocks().size())
|
.processPlaceholder("amount", level.getLinkAmount() - linkedBlocks.size())
|
||||||
.sendPrefixedMessage(player);
|
.sendPrefixedMessage(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user