mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Register and set layout of reward GUI
This commit is contained in:
parent
0380e5c527
commit
35d58a3815
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user