mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-11-18 06:24:17 +01:00
Fixed pagination in multiple UIs
This commit is contained in:
parent
f80eacc18c
commit
d327ba8fa0
@ -50,7 +50,7 @@ public class QuestViewer extends EditableInventory {
|
||||
}
|
||||
|
||||
public GeneratedInventory newInventory(PlayerData data) {
|
||||
return new QuestInventory(data, this);
|
||||
return new QuestInventory(data);
|
||||
}
|
||||
|
||||
public class QuestItem extends PhysicalItem<QuestInventory> {
|
||||
@ -240,12 +240,12 @@ public class QuestViewer extends EditableInventory {
|
||||
private final List<Quest> quests = new ArrayList<>(MMOCore.plugin.questManager.getAll());
|
||||
private final PlayerData playerData;
|
||||
|
||||
public QuestInventory(PlayerData playerData, EditableInventory editable) {
|
||||
super(new Navigator(playerData.getMMOPlayerData()), editable);
|
||||
public QuestInventory(PlayerData playerData) {
|
||||
super(new Navigator(playerData.getMMOPlayerData()), QuestViewer.this);
|
||||
|
||||
this.playerData = playerData;
|
||||
|
||||
enablePagination(getByFunction("quest").getSlots().size());
|
||||
enablePagination(QuestViewer.this.getByFunction("quest").getSlots().size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -65,7 +65,7 @@ public class SkillList extends EditableInventory {
|
||||
}
|
||||
|
||||
public GeneratedInventory newInventory(PlayerData data) {
|
||||
return new SkillViewerInventory(data, this);
|
||||
return new SkillViewerInventory(data);
|
||||
}
|
||||
|
||||
public class ReallocationItem extends PhysicalItem<SkillViewerInventory> {
|
||||
@ -498,8 +498,8 @@ public class SkillList extends EditableInventory {
|
||||
|
||||
private final PlayerData playerData;
|
||||
|
||||
public SkillViewerInventory(PlayerData playerData, EditableInventory editable) {
|
||||
super(new Navigator(playerData.getMMOPlayerData()), editable);
|
||||
public SkillViewerInventory(PlayerData playerData) {
|
||||
super(new Navigator(playerData.getMMOPlayerData()), SkillList.this);
|
||||
|
||||
this.playerData = playerData;
|
||||
skills = playerData.getProfess().getSkills().stream().filter(playerData::hasUnlocked).sorted(Comparator.comparingInt(ClassSkill::getUnlockLevel)).collect(Collectors.toList());
|
||||
|
||||
@ -50,7 +50,7 @@ public class WaypointViewer extends EditableInventory {
|
||||
}
|
||||
|
||||
public GeneratedInventory newInventory(PlayerData data, Waypoint waypoint) {
|
||||
return new WaypointViewerInventory(data, this, waypoint);
|
||||
return new WaypointViewerInventory(data, waypoint);
|
||||
}
|
||||
|
||||
public class WaypointItem extends InventoryItem<WaypointViewerInventory> {
|
||||
@ -218,14 +218,14 @@ public class WaypointViewer extends EditableInventory {
|
||||
|
||||
private Map<Waypoint, WaypointPath> paths;
|
||||
|
||||
public WaypointViewerInventory(PlayerData playerData, EditableInventory editable, Waypoint current) {
|
||||
super(new Navigator(playerData.getMMOPlayerData()), editable);
|
||||
public WaypointViewerInventory(PlayerData playerData, Waypoint current) {
|
||||
super(new Navigator(playerData.getMMOPlayerData()), WaypointViewer.this);
|
||||
|
||||
this.playerData = playerData;
|
||||
this.current = current;
|
||||
paths = new WaypointPathCalculation(playerData).run(current).getPaths();
|
||||
|
||||
enablePagination(editable.getByFunction("waypoint").getSlots().size());
|
||||
enablePagination(WaypointViewer.this.getByFunction("waypoint").getSlots().size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -112,7 +112,7 @@ public class SkillTreeViewer extends EditableInventory {
|
||||
}
|
||||
|
||||
public SkillTreeInventory newInventory(PlayerData playerData) {
|
||||
return new SkillTreeInventory(playerData, this, defaultSkillTree);
|
||||
return new SkillTreeInventory(playerData, defaultSkillTree);
|
||||
}
|
||||
|
||||
public class ReallocateButton extends PhysicalItem<SkillTreeInventory> {
|
||||
@ -477,18 +477,18 @@ public class SkillTreeViewer extends EditableInventory {
|
||||
//width and height correspond to the the size of the 'board' representing the skill tree
|
||||
private int minSlot, maxSlot;
|
||||
|
||||
public SkillTreeInventory(PlayerData playerData, EditableInventory editable, SkillTree skillTree) {
|
||||
super(new Navigator(playerData.getMMOPlayerData()), editable);
|
||||
public SkillTreeInventory(PlayerData playerData, SkillTree skillTree) {
|
||||
super(new Navigator(playerData.getMMOPlayerData()), SkillTreeViewer.this);
|
||||
|
||||
this.playerData = playerData;
|
||||
skillTrees = playerData.getProfess().getSkillTrees();
|
||||
this.skillTree = skillTree == null ? skillTrees.get(0) : skillTree;
|
||||
if (skillTree == null)
|
||||
maxTreeListPage = (skillTrees.size() - 1) / editable.getByFunction("skill-tree").getSlots().size();
|
||||
maxTreeListPage = (skillTrees.size() - 1) / SkillTreeViewer.this.getByFunction("skill-tree").getSlots().size();
|
||||
else
|
||||
maxTreeListPage = 0;
|
||||
//We get the width and height of the GUI(corresponding to the slots given)
|
||||
slots = editable.getByFunction("skill-tree-node").getSlots();
|
||||
slots = SkillTreeViewer.this.getByFunction("skill-tree-node").getSlots();
|
||||
minSlot = 64;
|
||||
maxSlot = 0;
|
||||
for (int slot : slots) {
|
||||
|
||||
@ -251,7 +251,7 @@ public class EditableGuildView extends EditableInventory {
|
||||
this.playerData = playerData;
|
||||
isGuildOwner = playerData.getGuild().getOwner().equals(playerData.getUniqueId());
|
||||
|
||||
enablePagination(getEditable().getByFunction("member").getSlots().size());
|
||||
enablePagination(EditableGuildView.this.getByFunction("member").getSlots().size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user