Register and set layout of reward GUI

This commit is contained in:
Daniel Saukel 2019-06-19 03:26:30 +02:00
parent 0380e5c527
commit 35d58a3815
2 changed files with 8 additions and 0 deletions

View File

@ -54,6 +54,7 @@ import de.erethon.dungeonsxl.trigger.TriggerListener;
import de.erethon.dungeonsxl.trigger.TriggerTypeCache;
import de.erethon.dungeonsxl.util.PlaceholderUtil;
import de.erethon.dungeonsxl.world.DWorldCache;
import de.erethon.vignette.api.VignetteAPI;
import java.io.File;
import java.util.HashSet;
import java.util.List;
@ -136,6 +137,7 @@ public class DungeonsXL extends DREPlugin {
if (manager.isPluginEnabled("PlaceholderAPI")) {
new PlaceholderUtil(this, "dxl").register();
}
VignetteAPI.init(this);
}
@Override

View File

@ -26,6 +26,8 @@ import de.erethon.dungeonsxl.world.DGameWorld;
import de.erethon.dungeonsxl.world.block.RewardChest;
import de.erethon.vignette.api.PaginatedInventoryGUI;
import de.erethon.vignette.api.component.InventoryButton;
import de.erethon.vignette.api.layout.PaginatedFlowInventoryLayout;
import de.erethon.vignette.api.pagination.PaginatedInventoryLayout.PaginationButtonPosition;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
@ -123,6 +125,10 @@ public class RewardListener implements Listener {
&& !VanillaItem.NETHER_PORTAL.is(block.getRelative(1, 0, 0)) && !VanillaItem.NETHER_PORTAL.is(block.getRelative(-1, 0, 0))
&& !VanillaItem.NETHER_PORTAL.is(block.getRelative(0, 0, 1)) && !VanillaItem.NETHER_PORTAL.is(block.getRelative(0, 0, -1))) {
PaginatedInventoryGUI lootInventory = new PaginatedInventoryGUI(DMessage.PLAYER_TREASURES.getMessage());
PaginatedFlowInventoryLayout layout = new PaginatedFlowInventoryLayout(lootInventory, 54, PaginationButtonPosition.BOTTOM);
layout.setSwitchButtonLinePlaceholdersEnabled(true);
lootInventory.setLayout(layout);
lootInventory.register();
for (ItemStack item : dPlayer.getRewardItems()) {
if (item != null) {
InventoryButton button = new InventoryButton(item);