mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-26 20:45:53 +01:00
Add GuiButton that allows to switch MobHeads vs MobEggs...
This commit is contained in:
parent
21c5704864
commit
f1f9072dc0
@ -5,7 +5,6 @@ import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.*;
|
||||
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
@ -61,6 +60,7 @@ public class ManageEntitiesGUI extends CommonGUI
|
||||
|
||||
panelBuilder.item(3, this.createButton(Button.ADD));
|
||||
panelBuilder.item(5, this.createButton(Button.REMOVE));
|
||||
panelBuilder.item(8, this.createButton(Button.SWITCH));
|
||||
|
||||
final int MAX_ELEMENTS = 21;
|
||||
|
||||
@ -119,7 +119,7 @@ public class ManageEntitiesGUI extends CommonGUI
|
||||
builder.name(this.user.getTranslation("challenges.gui.button.add"));
|
||||
builder.icon(Material.BUCKET);
|
||||
builder.clickHandler((panel, user1, clickType, slot) -> {
|
||||
new SelectEntityGUI(this.user, (status, entity) -> {
|
||||
new SelectEntityGUI(this.user, Collections.emptySet(), this.asEggs, (status, entity) -> {
|
||||
if (status)
|
||||
{
|
||||
if (!this.requiredEntities.containsKey(entity))
|
||||
@ -144,6 +144,15 @@ public class ManageEntitiesGUI extends CommonGUI
|
||||
return true;
|
||||
});
|
||||
break;
|
||||
case SWITCH:
|
||||
builder.name(this.user.getTranslation("challenges.gui.button.show-eggs"));
|
||||
builder.icon(this.asEggs ? Material.EGG : Material.PLAYER_HEAD);
|
||||
builder.clickHandler((panel, user1, clickType, slot) -> {
|
||||
this.asEggs = !this.asEggs;
|
||||
this.build();
|
||||
return true;
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
@ -204,7 +213,8 @@ public class ManageEntitiesGUI extends CommonGUI
|
||||
private enum Button
|
||||
{
|
||||
ADD,
|
||||
REMOVE
|
||||
REMOVE,
|
||||
SWITCH
|
||||
}
|
||||
|
||||
|
||||
|
@ -177,6 +177,7 @@ challenges:
|
||||
button:
|
||||
add: Add
|
||||
remove-selected: Remove Selected
|
||||
show-eggs: Toogle Mob View
|
||||
buttons:
|
||||
back: Return
|
||||
next: Next
|
||||
|
Loading…
Reference in New Issue
Block a user