Potionspy remake

Remade the entire potionspy and monitor class to avoid spam in the chat.

Furthermore, there is now a way to look at a history of potions thrown (individually and globally) however this history is limited to avoid too much useless data in the memory.
This commit is contained in:
CoolJWB
2020-07-14 21:00:22 +02:00
parent cb108e0c13
commit 6e622ad2f3
4 changed files with 357 additions and 48 deletions

View File

@ -172,6 +172,37 @@ public class FUtil
return Arrays.asList(string.split(", "));
}
/**
* A way to get a sublist with a page index and a page size.
* @param list A list of objects that should be split into pages.
* @param size The size of the pages.
* @param index The page index, if outside of bounds error will be thrown. The page index starts at 0 as with all lists.
* @return A list of objects that is the page that has been selected from the previous last parameter.
*/
public static List<String> getPageFromList(List<String> list, int size, int index)
{
try
{
if (size >= list.size())
{
return list;
}
else if (size * (index + 1) <= list.size())
{
return list.subList(size * index, size * (index + 1));
}
else
{
return list.subList(size * index, (size * index) + (list.size() % size));
}
}
catch (IndexOutOfBoundsException e)
{
return new ArrayList<>();
}
}
public static List<String> getAllMaterialNames()
{
List<String> names = new ArrayList<>();