mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-24 19:45:14 +01:00
Add existing GUIs in EditChallengeGUI.
This commit is contained in:
parent
97174930d5
commit
1b1b081a42
@ -6,10 +6,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
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;
|
||||||
@ -17,6 +14,9 @@ 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.ItemSwitchGUI;
|
||||||
|
import world.bentobox.challenges.panel.util.NumberGUI;
|
||||||
|
import world.bentobox.challenges.panel.util.StringListGUI;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,7 +76,7 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
@Override
|
@Override
|
||||||
public void build()
|
public void build()
|
||||||
{
|
{
|
||||||
PanelBuilder panelBuilder = new PanelBuilder().name(
|
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
|
||||||
this.user.getTranslation("challenges.gui.admin.edit-challenge-title"));
|
this.user.getTranslation("challenges.gui.admin.edit-challenge-title"));
|
||||||
|
|
||||||
panelBuilder.item(2, this.createMenuButton(MenuType.PROPERTIES));
|
panelBuilder.item(2, this.createMenuButton(MenuType.PROPERTIES));
|
||||||
@ -385,8 +385,15 @@ public class EditChallengeGUI 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: Implement challenges description change GUI.
|
new StringListGUI(this.user, this.challenge.getDescription(), (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setDescription(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
glow = false;
|
glow = false;
|
||||||
@ -401,8 +408,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getSlot())));
|
Integer.toString(this.challenge.getSlot())));
|
||||||
icon = new ItemStack(Material.DROPPER);
|
icon = new ItemStack(Material.DROPPER);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getSlot(), -1, 54, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setSlot(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -423,7 +436,7 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = values;
|
description = values;
|
||||||
icon = new ItemStack(Material.DROPPER);
|
icon = new ItemStack(Material.DROPPER);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create change enviroment button
|
// TODO: Create Enviroment Change GUI
|
||||||
this.build();
|
this.build();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -459,7 +472,7 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = Collections.emptyList();
|
description = Collections.emptyList();
|
||||||
icon = new ItemStack(Material.DROPPER);
|
icon = new ItemStack(Material.DROPPER);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create naming
|
// TODO: Implement AnvilGUI.
|
||||||
this.build();
|
this.build();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -481,7 +494,7 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = values;
|
description = values;
|
||||||
icon = new ItemStack(Material.CREEPER_HEAD);
|
icon = new ItemStack(Material.CREEPER_HEAD);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create Panel
|
// TODO: Entities GUI
|
||||||
this.build();
|
this.build();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -525,7 +538,7 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = values;
|
description = values;
|
||||||
icon = new ItemStack(Material.STONE);
|
icon = new ItemStack(Material.STONE);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create Panel
|
// TODO: Block GUI
|
||||||
this.build();
|
this.build();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -565,8 +578,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getSearchRadius())));
|
Integer.toString(this.challenge.getSearchRadius())));
|
||||||
icon = new ItemStack(Material.COBBLESTONE_WALL);
|
icon = new ItemStack(Material.COBBLESTONE_WALL);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getSearchRadius(), 0, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setSearchRadius(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -579,8 +598,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = new ArrayList<>(this.challenge.getReqPerms());
|
description = new ArrayList<>(this.challenge.getReqPerms());
|
||||||
icon = new ItemStack(Material.REDSTONE_LAMP);
|
icon = new ItemStack(Material.REDSTONE_LAMP);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create naming
|
new StringListGUI(this.user, this.challenge.getReqPerms(), (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setReqPerms(new HashSet<>(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -600,8 +625,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = values;
|
description = values;
|
||||||
icon = new ItemStack(Material.CHEST);
|
icon = new ItemStack(Material.CHEST);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create Panel
|
new ItemSwitchGUI(this.user, this.challenge.getRequiredItems(), (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRequiredItems(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -640,9 +671,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getMaxTimes())));
|
Integer.toString(this.challenge.getMaxTimes())));
|
||||||
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getReqExp(), 0, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setReqExp(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
glow = false;
|
glow = false;
|
||||||
@ -680,8 +716,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Long.toString(this.challenge.getReqIslandlevel())));
|
Long.toString(this.challenge.getReqIslandlevel())));
|
||||||
icon = new ItemStack(Material.BEACON);
|
icon = new ItemStack(Material.BEACON);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, (int) this.challenge.getReqIslandlevel(), (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setReqIslandlevel(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -697,9 +739,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getReqMoney())));
|
Integer.toString(this.challenge.getReqMoney())));
|
||||||
icon = new ItemStack(Material.GOLD_INGOT);
|
icon = new ItemStack(Material.GOLD_INGOT);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getReqMoney(), 0, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setReqMoney(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
glow = false;
|
glow = false;
|
||||||
@ -735,8 +782,8 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = Collections.singletonList(this.challenge.getRewardText());
|
description = Collections.singletonList(this.challenge.getRewardText());
|
||||||
icon = new ItemStack(Material.WRITTEN_BOOK);
|
icon = new ItemStack(Material.WRITTEN_BOOK);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Implement challenges description change GUI.
|
// TODO: Implement AnvilGUI
|
||||||
this.build();
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
glow = false;
|
glow = false;
|
||||||
@ -755,8 +802,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = values;
|
description = values;
|
||||||
icon = new ItemStack(Material.CHEST);
|
icon = new ItemStack(Material.CHEST);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create Panel
|
new ItemSwitchGUI(this.user, this.challenge.getRewardItems(), (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRewardItems(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -772,8 +825,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getRewardExp())));
|
Integer.toString(this.challenge.getRewardExp())));
|
||||||
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getReqExp(), 0, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRewardExp(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -789,8 +848,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getRewardMoney())));
|
Integer.toString(this.challenge.getRewardMoney())));
|
||||||
icon = new ItemStack(Material.GOLD_INGOT);
|
icon = new ItemStack(Material.GOLD_INGOT);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getRewardMoney(), 0, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRewardMoney(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -803,8 +868,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = this.challenge.getRewardCommands();
|
description = this.challenge.getRewardCommands();
|
||||||
icon = new ItemStack(Material.COMMAND_BLOCK);
|
icon = new ItemStack(Material.COMMAND_BLOCK);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create naming
|
new StringListGUI(this.user, this.challenge.getRewardCommands(), (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRewardCommands(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -844,8 +915,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getMaxTimes())));
|
Integer.toString(this.challenge.getMaxTimes())));
|
||||||
icon = new ItemStack(Material.COBBLESTONE_WALL);
|
icon = new ItemStack(Material.COBBLESTONE_WALL);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getMaxTimes(), 0, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setMaxTimes(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -859,8 +936,9 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = Collections.singletonList(this.challenge.getRepeatRewardText());
|
description = Collections.singletonList(this.challenge.getRepeatRewardText());
|
||||||
icon = new ItemStack(Material.WRITTEN_BOOK);
|
icon = new ItemStack(Material.WRITTEN_BOOK);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Implement challenges description change GUI.
|
// TODO: Implement AnvilGUI
|
||||||
this.build();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
glow = false;
|
glow = false;
|
||||||
@ -879,8 +957,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = values;
|
description = values;
|
||||||
icon = new ItemStack(Material.TRAPPED_CHEST);
|
icon = new ItemStack(Material.TRAPPED_CHEST);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create Panel
|
new ItemSwitchGUI(this.user, this.challenge.getRepeatItemReward(), (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRepeatItemReward(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -896,8 +980,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getRepeatExpReward())));
|
Integer.toString(this.challenge.getRepeatExpReward())));
|
||||||
icon = new ItemStack(Material.GLASS_BOTTLE);
|
icon = new ItemStack(Material.GLASS_BOTTLE);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getRepeatExpReward(), 0, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRepeatExpReward(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -913,8 +1003,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
Integer.toString(this.challenge.getRepeatMoneyReward())));
|
Integer.toString(this.challenge.getRepeatMoneyReward())));
|
||||||
icon = new ItemStack(Material.GOLD_NUGGET);
|
icon = new ItemStack(Material.GOLD_NUGGET);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Possibility to change order.
|
new NumberGUI(this.user, this.challenge.getRepeatMoneyReward(), 0, (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRepeatMoneyReward(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -927,8 +1023,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
description = this.challenge.getRepeatRewardCommands();
|
description = this.challenge.getRepeatRewardCommands();
|
||||||
icon = new ItemStack(Material.COMMAND_BLOCK);
|
icon = new ItemStack(Material.COMMAND_BLOCK);
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
// TODO: Create naming
|
new StringListGUI(this.user, this.challenge.getRepeatRewardCommands(), (status, value) -> {
|
||||||
this.build();
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRepeatRewardCommands(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user