Merge branch 'rework' of https://github.com/BONNe/Challenges into develop

This commit is contained in:
BONNe1704 2019-01-18 10:53:16 +02:00
commit c7445df56f
11 changed files with 376 additions and 232 deletions

View File

@ -527,4 +527,16 @@ public class ChallengesManager {
{ {
return new ArrayList<>(); return new ArrayList<>();
} }
public void deleteChallenge(Challenges selectedChallenge)
{
}
public void deleteChallengeLevel(ChallengeLevels valueObject)
{
}
} }

View File

@ -4,7 +4,6 @@ package world.bentobox.challenges.panel;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -232,5 +231,15 @@ public abstract class CommonGUI
return new PanelItem(icon, name, description, false, clickHandler, false); return new PanelItem(icon, name, description, false, clickHandler, false);
} }
/**
* This method sets new value to ValueObject variable.
* @param value new Value of valueObject.
*/
public void setValue(Object value)
{
this.valueObject = value;
}
} }

View File

@ -4,7 +4,6 @@ package world.bentobox.challenges.panel.admin;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -29,6 +28,11 @@ public class AdminGUI extends CommonGUI
*/ */
private boolean overwriteMode; private boolean overwriteMode;
/**
* This indicate if Reset Challenges must work as reset all.
*/
private boolean resetAllMode;
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Enums // Section: Enums
@ -135,7 +139,13 @@ public class AdminGUI extends CommonGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.WRITTEN_BOOK); icon = new ItemStack(Material.WRITTEN_BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Complete Challenge GUI new ListUsersGUI(this.addon,
this.world,
this.user,
ListUsersGUI.Mode.COMPLETE,
this.topLabel,
this.permissionPrefix,
this).build();
return true; return true;
}; };
@ -148,12 +158,28 @@ public class AdminGUI extends CommonGUI
name = this.user.getTranslation("challenges.gui.admin.buttons.reset"); name = this.user.getTranslation("challenges.gui.admin.buttons.reset");
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.WRITABLE_BOOK); icon = new ItemStack(Material.WRITABLE_BOOK);
glow = this.resetAllMode;
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Reset Challenge GUI if (clickType.isRightClick())
{
this.resetAllMode = !this.resetAllMode;
this.build();
}
else
{
new ListUsersGUI(this.addon,
this.world,
this.user,
this.resetAllMode ? ListUsersGUI.Mode.RESET_ALL : ListUsersGUI.Mode.RESET,
this.topLabel,
this.permissionPrefix,
this).build();
}
return true; return true;
}; };
glow = false;
break; break;
case ADD_CHALLENGE: case ADD_CHALLENGE:
@ -163,7 +189,7 @@ public class AdminGUI extends CommonGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.BOOK); icon = new ItemStack(Material.BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Add Challenge GUI // TODO: Create AnvilGUI that force to create String for "unique_id"
return true; return true;
}; };
@ -177,7 +203,7 @@ public class AdminGUI extends CommonGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.BOOK); icon = new ItemStack(Material.BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Add Level GUI // TODO: Create AnvilGUI that force to create String for "unique_id"
return true; return true;
}; };
@ -191,7 +217,13 @@ public class AdminGUI extends CommonGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.ANVIL); icon = new ItemStack(Material.ANVIL);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Edit Challenge GUI new ListChallengesGUI(this.addon,
this.world,
this.user,
ListChallengesGUI.Mode.EDIT,
this.topLabel,
this.permissionPrefix,
this);
return true; return true;
}; };
@ -206,7 +238,13 @@ public class AdminGUI extends CommonGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.ANVIL); icon = new ItemStack(Material.ANVIL);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Edit Level GUI new ListLevelsGUI(this.addon,
this.world,
this.user,
ListLevelsGUI.Mode.EDIT,
this.topLabel,
this.permissionPrefix,
this);
return true; return true;
}; };
@ -222,7 +260,13 @@ public class AdminGUI extends CommonGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.LAVA_BUCKET); icon = new ItemStack(Material.LAVA_BUCKET);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Delete Challenge GUI new ListChallengesGUI(this.addon,
this.world,
this.user,
ListChallengesGUI.Mode.DELETE,
this.topLabel,
this.permissionPrefix,
this);
return true; return true;
}; };
@ -238,7 +282,13 @@ public class AdminGUI extends CommonGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.LAVA_BUCKET); icon = new ItemStack(Material.LAVA_BUCKET);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Delete Level GUI new ListLevelsGUI(this.addon,
this.world,
this.user,
ListLevelsGUI.Mode.DELETE,
this.topLabel,
this.permissionPrefix,
this);
return true; return true;
}; };

View File

@ -11,6 +11,7 @@ import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon; import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.database.object.Challenges; import world.bentobox.challenges.database.object.Challenges;
import world.bentobox.challenges.panel.CommonGUI; import world.bentobox.challenges.panel.CommonGUI;
import world.bentobox.challenges.panel.util.ConfirmationGUI;
/** /**
@ -140,7 +141,8 @@ public class ListChallengesGUI extends CommonGUI
else if (this.currentMode.equals(Mode.DELETE)) else if (this.currentMode.equals(Mode.DELETE))
{ {
itemBuilder.clickHandler((panel, user1, clickType, i) -> { itemBuilder.clickHandler((panel, user1, clickType, i) -> {
// TODO: Conformation GUI for DELETING. new ConfirmationGUI(this, this.user);
this.valueObject = challenge;
return true; return true;
}); });
} }
@ -149,6 +151,25 @@ public class ListChallengesGUI extends CommonGUI
} }
/**
* Overwriting set value allows to catch if ConfirmationGui returns true.
* @param value new Value of valueObject.
*/
@Override
public void setValue(Object value)
{
if (value instanceof Boolean && ((Boolean) value) && this.valueObject != null)
{
this.addon.getChallengesManager().deleteChallenge((Challenges) this.valueObject);
this.valueObject = null;
}
else
{
this.valueObject = null;
}
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Enums // Section: Enums
// --------------------------------------------------------------------- // ---------------------------------------------------------------------

View File

@ -2,7 +2,6 @@ package world.bentobox.challenges.panel.admin;
import org.bukkit.World; import org.bukkit.World;
import java.util.List; import java.util.List;
import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelItem;
@ -12,6 +11,7 @@ import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon; import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.database.object.ChallengeLevels; import world.bentobox.challenges.database.object.ChallengeLevels;
import world.bentobox.challenges.panel.CommonGUI; import world.bentobox.challenges.panel.CommonGUI;
import world.bentobox.challenges.panel.util.ConfirmationGUI;
/** /**
@ -141,7 +141,8 @@ public class ListLevelsGUI extends CommonGUI
else if (this.currentMode.equals(Mode.DELETE)) else if (this.currentMode.equals(Mode.DELETE))
{ {
itemBuilder.clickHandler((panel, user1, clickType, i) -> { itemBuilder.clickHandler((panel, user1, clickType, i) -> {
// TODO: Conformation GUI for DELETING. new ConfirmationGUI(this, this.user);
this.valueObject = challengeLevel;
return true; return true;
}); });
} }
@ -150,6 +151,25 @@ public class ListLevelsGUI extends CommonGUI
} }
/**
* Overwriting set value allows to catch if ConfirmationGui returns true.
* @param value new Value of valueObject.
*/
@Override
public void setValue(Object value)
{
if (value instanceof Boolean && ((Boolean) value) && this.valueObject != null)
{
this.addon.getChallengesManager().deleteChallengeLevel((ChallengeLevels) this.valueObject);
this.valueObject = null;
}
else
{
this.valueObject = null;
}
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Enums // Section: Enums
// --------------------------------------------------------------------- // ---------------------------------------------------------------------

View File

@ -54,7 +54,7 @@ public class ListUsersGUI extends CommonGUI
/** /**
* This allows to decide what User Icon should do. * This allows to decide what User Icon should do.
*/ */
private enum Mode public enum Mode
{ {
COMPLETE, COMPLETE,
RESET, RESET,

View File

@ -1,10 +1,8 @@
package world.bentobox.challenges.panel.util; package world.bentobox.challenges.panel.util;
import org.bukkit.Material; import org.bukkit.Material;
import java.util.*;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder; import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.api.user.User;
@ -22,18 +20,11 @@ public class ConfirmationGUI
* *
* @param user Gui Caller. * @param user Gui Caller.
* @param parentGUI Parent GUI. * @param parentGUI Parent GUI.
* @param command Command .
* @param parameters Variables at the end of command.
*/ */
public ConfirmationGUI(CommonGUI parentGUI, public ConfirmationGUI(CommonGUI parentGUI, User user)
User user,
CompositeCommand command,
String... parameters)
{ {
this.user = user; this.user = user;
this.parentGUI = parentGUI; this.parentGUI = parentGUI;
this.command = command;
this.parameters = parameters;
this.build(); this.build();
} }
@ -50,11 +41,8 @@ public class ConfirmationGUI
panelBuilder.item(3, new PanelItemBuilder(). panelBuilder.item(3, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.proceed")). name(this.user.getTranslation("challenges.gui.admin.buttons.proceed")).
icon(Material.GREEN_STAINED_GLASS_PANE). icon(Material.GREEN_STAINED_GLASS_PANE).
clickHandler((panel, user1, clickType, index) -> clickHandler((panel, user1, clickType, index) -> {
{ this.parentGUI.setValue(true);
this.command
.execute(this.user, "CONFIRMATION", Arrays.asList(this.parameters));
this.user.closeInventory(); this.user.closeInventory();
this.parentGUI.build(); this.parentGUI.build();
return true; return true;
@ -66,6 +54,7 @@ public class ConfirmationGUI
icon(Material.RED_STAINED_GLASS_PANE). icon(Material.RED_STAINED_GLASS_PANE).
clickHandler((panel, user1, clickType, i) -> clickHandler((panel, user1, clickType, i) ->
{ {
this.parentGUI.setValue(null);
this.parentGUI.build(); this.parentGUI.build();
return true; return true;
}). }).
@ -88,14 +77,4 @@ public class ConfirmationGUI
* Parent GUI where should return on cancel or proceed. * Parent GUI where should return on cancel or proceed.
*/ */
private CommonGUI parentGUI; private CommonGUI parentGUI;
/**
* Command that must be run on confirmation.
*/
private CompositeCommand command;
/**
* List of variables.
*/
private String[] parameters;
} }

View File

@ -1,129 +0,0 @@
package world.bentobox.challenges.panel.util;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.ItemStack;
import java.util.Collections;
import java.util.List;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.PanelListener;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.user.User;
/**
* This class allows to change Input ItemStacks to different ItemStacks.
*/
public class ItemGUI
{
public ItemGUI(User user, List<ItemStack> itemStacks)
{
this.user = user;
this.itemStacks = itemStacks;
this.build();
}
/**
* This method builds panel that allows to change given number value.
*/
private void build()
{
PanelBuilder panelBuilder = new PanelBuilder().name(this.user.getTranslation("challenges.gui.change-items"));
panelBuilder.listener(new CustomPanelListener());
for (ItemStack itemStack : this.itemStacks)
{
panelBuilder.item(new CustomPanelItem(itemStack));
}
panelBuilder.build().open(this.user);
}
// ---------------------------------------------------------------------
// Section: Private classes
// ---------------------------------------------------------------------
/**
* This CustomPanelItem does no lose Item original MetaData. After PanelItem has been
* created it restores original meta data. It also does not allow to change anything that
* could destroy meta data.
*/
private class CustomPanelItem extends PanelItem
{
CustomPanelItem(ItemStack item)
{
super(item.clone(), "", Collections.emptyList(), false, null, false);
this.getItem().setItemMeta(item.getItemMeta());
}
@Override
public void setGlow(boolean glow)
{
}
@Override
public void setDescription(List<String> description)
{
}
@Override
public void setName(String name)
{
}
@Override
public void setHead(ItemStack itemStack)
{
}
}
/**
* This CustomPanelListener allows to move items in current panel.
*/
private class CustomPanelListener implements PanelListener
{
@Override
public void setup()
{
}
@Override
public void onInventoryClose(InventoryCloseEvent inventoryCloseEvent)
{
}
@Override
public void onInventoryClick(User user, InventoryClickEvent event)
{
event.setCancelled(false);
}
}
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
/**
* User who opens current gui.
*/
private User user;
/**
* List with original items.
*/
private List<ItemStack> itemStacks;
}

View File

@ -0,0 +1,236 @@
package world.bentobox.challenges.panel.util;
import org.bukkit.Material;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.PanelListener;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.panel.CommonGUI;
/**
* This class allows to change Input ItemStacks to different ItemStacks.
*/
public class ItemSwitchGUI
{
public ItemSwitchGUI(CommonGUI parentGUI, User user, List<ItemStack> itemStacks)
{
this.parentGUI = parentGUI;
this.user = user;
this.itemStacks = itemStacks;
this.build();
}
/**
* This method builds panel that allows to change given number value.
*/
private void build()
{
PanelBuilder panelBuilder = new PanelBuilder().name(this.user.getTranslation("challenges.gui.change-items"));
// Size of inventory that user can set via GUI.
panelBuilder.size(45);
panelBuilder.listener(new CustomPanelListener());
panelBuilder.item(0, this.getButton(Button.SAVE));
for (int i = 1; i < 8; i++)
{
panelBuilder.item(i, this.getButton(Button.EMPTY));
}
panelBuilder.item(8, this.getButton(Button.CANCEL));
for (ItemStack itemStack : this.itemStacks)
{
panelBuilder.item(new CustomPanelItem(itemStack));
}
panelBuilder.build().open(this.user);
}
/**
* This method create button that does some functionality in current gui.
* @param button Button functionality.
* @return PanelItem.
*/
private PanelItem getButton(Button button)
{
ItemStack icon;
String name;
List<String> description;
PanelItem.ClickHandler clickHandler;
switch (button)
{
case SAVE:
{
name = this.user.getTranslation("challenges.gui.buttons.save");
description = Collections.emptyList();
icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> {
// Magic number 9 - second row. First row is for custom buttons.
// Magic number 45 - This GUI is initialed with 45 elements.
List<ItemStack> returnItems = new ArrayList<>(36);
for (int i = 9; i < 45; i++)
{
ItemStack itemStack = panel.getInventory().getItem(i);
if (itemStack != null)
{
returnItems.add(itemStack);
}
}
this.parentGUI.setValue(returnItems);
this.user.closeInventory();
this.parentGUI.build();
return true;
};
break;
}
case CANCEL:
{
name = this.user.getTranslation("challenges.gui.buttons.cancel");
description = Collections.emptyList();
icon = new ItemStack(Material.IRON_DOOR);
clickHandler = (panel, user, clickType, slot) -> {
this.parentGUI.build();
return true;
};
break;
}
case EMPTY:
{
name = "";
description = Collections.emptyList();
icon = new ItemStack(Material.BARRIER);
clickHandler = (panel, user, clickType, slot) -> true;
break;
}
default:
return null;
}
return new PanelItem(icon, name, description, false, clickHandler, false);
}
// ---------------------------------------------------------------------
// Section: Private classes
// ---------------------------------------------------------------------
/**
* This CustomPanelItem does no lose Item original MetaData. After PanelItem has been
* created it restores original meta data. It also does not allow to change anything that
* could destroy meta data.
*/
private class CustomPanelItem extends PanelItem
{
CustomPanelItem(ItemStack item)
{
super(item.clone(), "", Collections.emptyList(), false, null, false);
this.getItem().setItemMeta(item.getItemMeta());
}
@Override
public void setGlow(boolean glow)
{
}
@Override
public void setDescription(List<String> description)
{
}
@Override
public void setName(String name)
{
}
@Override
public void setHead(ItemStack itemStack)
{
}
}
/**
* This CustomPanelListener allows to move items in current panel.
*/
private class CustomPanelListener implements PanelListener
{
@Override
public void setup()
{
}
@Override
public void onInventoryClose(InventoryCloseEvent inventoryCloseEvent)
{
}
@Override
public void onInventoryClick(User user, InventoryClickEvent event)
{
// First row of elements should be ignored, as it contains buttons and blocked slots.
event.setCancelled(event.getRawSlot() < 9);
}
}
// ---------------------------------------------------------------------
// Section: Enums
// ---------------------------------------------------------------------
/**
* This enum holds all button values in current gui.
*/
private enum Button
{
CANCEL,
SAVE,
EMPTY
}
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
/**
* ParentGUI from which current gui is called.
*/
private CommonGUI parentGUI;
/**
* User who opens current gui.
*/
private User user;
/**
* List with original items.
*/
private List<ItemStack> itemStacks;
}

View File

@ -3,11 +3,9 @@ package world.bentobox.challenges.panel.util;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder; import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
@ -20,17 +18,11 @@ import world.bentobox.challenges.panel.CommonGUI;
*/ */
public class NumberGUI public class NumberGUI
{ {
public NumberGUI(CommonGUI parentGUI, public NumberGUI(CommonGUI parentGUI, User user, int value)
User user,
int value,
CompositeCommand command,
String... parameters)
{ {
this.parentGUI = parentGUI; this.parentGUI = parentGUI;
this.user = user; this.user = user;
this.value = value; this.value = value;
this.command = command;
this.parameters = parameters;
this.currentOperation = Button.SET; this.currentOperation = Button.SET;
@ -101,18 +93,9 @@ public class NumberGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.COMMAND_BLOCK); icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
List<String> values = Arrays.asList(this.parameters); this.parentGUI.setValue(this.value);
values.add(Integer.toString(this.value)); this.user.closeInventory();
this.parentGUI.build();
if (this.command.execute(this.user, "NUMBER_GUI", values))
{
this.user.closeInventory();
this.parentGUI.build();
}
else
{
this.build();
}
return true; return true;
}; };
@ -321,16 +304,6 @@ public class NumberGUI
*/ */
private int value; private int value;
/**
* Command that must be processed on save.
*/
private CompositeCommand command;
/**
* Command input parameters before number.
*/
private String[] parameters;
/** /**
* This variable holds which operation now is processed. * This variable holds which operation now is processed.
*/ */

View File

@ -3,11 +3,9 @@ package world.bentobox.challenges.panel.util;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder; import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
@ -21,17 +19,11 @@ import world.bentobox.challenges.panel.CommonGUI;
*/ */
public class StringListGUI public class StringListGUI
{ {
public StringListGUI(CommonGUI parentGUI, public StringListGUI(CommonGUI parentGUI, User user, List<String> value)
User user,
List<String> value,
CompositeCommand command,
String... parameters)
{ {
this.parentGUI = parentGUI; this.parentGUI = parentGUI;
this.user = user; this.user = user;
this.value = value; this.value = value;
this.command = command;
this.parameters = parameters;
if (this.value.size() > 18) if (this.value.size() > 18)
{ {
@ -90,18 +82,9 @@ public class StringListGUI
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.COMMAND_BLOCK); icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
List<String> values = Arrays.asList(this.parameters); this.parentGUI.setValue(this.value);
values.addAll(this.value); this.user.closeInventory();
this.parentGUI.build();
if (this.command.execute(this.user, "STRING_LIST_GUI", values))
{
this.user.closeInventory();
this.parentGUI.build();
}
else
{
this.build();
}
return true; return true;
}; };
@ -228,14 +211,4 @@ public class StringListGUI
* Current value. * Current value.
*/ */
private List<String> value; private List<String> value;
/**
* Command that must be processed on save.
*/
private CompositeCommand command;
/**
* Command input parameters before number.
*/
private String[] parameters;
} }