Fix shift walk under bug (#740)

This commit is contained in:
Lucwousin
2019-06-25 07:31:48 +02:00
committed by James
parent d793312cf4
commit 2006f52219
7 changed files with 82 additions and 41 deletions

View File

@@ -173,22 +173,14 @@ public class MenuManager
final MenuEntry newestEntry = menuEntries[menuEntries.length - 1];
boolean isPrio = false;
for (ComparableEntry p : priorityEntries)
{
if (p.matches(newestEntry))
{
isPrio = true;
break;
currentPriorityEntries.add(newestEntry);
}
}
// If the last entry was a priority entry, keep track of it
if (isPrio)
{
currentPriorityEntries.add(newestEntry);
}
// Make a copy of the menu entries, cause you can't remove from Arrays.asList()
List<MenuEntry> copy = Lists.newArrayList(menuEntries);
@@ -197,7 +189,29 @@ public class MenuManager
{
copy.retainAll(currentPriorityEntries);
copy.add(0, CANCEL());
// This is because players existing changes walk-here target
// so without this we lose track of em
if (copy.size() != currentPriorityEntries.size())
{
for (MenuEntry e : currentPriorityEntries)
{
if (copy.contains(e))
{
continue;
}
for (MenuEntry e2 : client.getMenuEntries())
{
if (e.getType() == e2.getType())
{
e.setTarget(e2.getTarget());
copy.add(e);
}
}
}
}
copy.add(CANCEL());
}
// Find the current entry in the swaps map