mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-12 13:53:54 +00:00
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:
@ -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<>();
|
||||
|
Reference in New Issue
Block a user