Correctly handle line overflow in book pager

Fixes a bug with the last book pager tweak.
This commit is contained in:
KHobbits 2014-04-05 15:33:38 +01:00
parent af3f3fb4c7
commit fe9fbf585f
2 changed files with 13 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Bukkit;
public class BookPager
@ -94,7 +95,10 @@ public class BookPager
tempLine = pageLine.substring(start, pointer);
pageLines.add(tempLine);
buildPage(pages, pageLines, forcePageEnd);
if (buildPage(pages, pageLines, forcePageEnd))
{
pageLength = 0;
}
forcePageEnd = false;
start = pointer;
@ -149,7 +153,10 @@ public class BookPager
{
tempLine = pageLine.substring(start, lineLength);
pageLines.add(tempLine);
buildPage(pages, pageLines, false);
if (buildPage(pages, pageLines, false))
{
pageLength = 0;
}
}
}
@ -157,7 +164,7 @@ public class BookPager
return pages;
}
void buildPage(List<String> pages, List<String> lines, boolean override)
boolean buildPage(List<String> pages, List<String> lines, boolean override)
{
if (override || lines.size() > lineMax)
{
@ -168,6 +175,8 @@ public class BookPager
}
pages.add(newPage.toString());
lines.clear();
return true;
}
return false;
}
}

View File

@ -4,11 +4,11 @@
<actionName>build-with-dependencies</actionName>
<reactor>also-make</reactor>
<goals>
<goal>clean</goal>
<goal>package</goal>
<goal>dependency:copy</goal>
</goals>
</action>
<action>