mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-14 02:24:16 +02:00
Correctly handle line overflow in book pager
Fixes a bug with the last book pager tweak.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user