Small improvements

This commit is contained in:
SBDeveloper 2022-12-28 21:00:11 +01:00
parent f28519b19f
commit 7614f5adb5
3 changed files with 8 additions and 10 deletions

View file

@ -16,7 +16,6 @@ import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import static nl.sbdeveloper.showapi.utils.MainUtil.__;
@ -34,12 +33,11 @@ public class ShowCueGUI extends Inventory {
Pagination pagination = contents.pagination();
List<ClickableItem> items = new ArrayList<>();
for (ShowCue cue : Shows.getPoints(showName).stream().sorted(Comparator.comparing(ShowCue::getTime)).collect(Collectors.toList())) {
items.add(ClickableItem.of(MainUtil.pointToItem(cue), e -> {
Shows.removePoint(showName, cue);
open(player, pagination.getPage());
}));
}
Shows.getPoints(showName).stream().sorted(Comparator.comparing(ShowCue::getTime))
.forEach(cue -> items.add(ClickableItem.of(MainUtil.pointToItem(cue), e -> {
Shows.removePoint(showName, cue);
open(player, pagination.getPage());
})));
ClickableItem[] itemsArray = new ClickableItem[items.size()];
itemsArray = items.toArray(itemsArray);

View file

@ -50,7 +50,7 @@ public class MainUtil {
try {
Constructor<? extends TriggerTask> ctor = type.getTrigger().getConstructor(String[].class);
if (dataSplitter.length < type.getMinArgs()) return null;
return ctor.newInstance(new Object[] { dataSplitterNew });
return ctor.newInstance(dataSplitterNew);
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
return null;
}