mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-28 05:25:21 +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.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
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(3, this.createButton(Button.ADD));
|
||||||
panelBuilder.item(5, this.createButton(Button.REMOVE));
|
panelBuilder.item(5, this.createButton(Button.REMOVE));
|
||||||
|
panelBuilder.item(8, this.createButton(Button.SWITCH));
|
||||||
|
|
||||||
final int MAX_ELEMENTS = 21;
|
final int MAX_ELEMENTS = 21;
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public class ManageEntitiesGUI extends CommonGUI
|
|||||||
builder.name(this.user.getTranslation("challenges.gui.button.add"));
|
builder.name(this.user.getTranslation("challenges.gui.button.add"));
|
||||||
builder.icon(Material.BUCKET);
|
builder.icon(Material.BUCKET);
|
||||||
builder.clickHandler((panel, user1, clickType, slot) -> {
|
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 (status)
|
||||||
{
|
{
|
||||||
if (!this.requiredEntities.containsKey(entity))
|
if (!this.requiredEntities.containsKey(entity))
|
||||||
@ -144,6 +144,15 @@ public class ManageEntitiesGUI extends CommonGUI
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
break;
|
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();
|
return builder.build();
|
||||||
@ -204,7 +213,8 @@ public class ManageEntitiesGUI extends CommonGUI
|
|||||||
private enum Button
|
private enum Button
|
||||||
{
|
{
|
||||||
ADD,
|
ADD,
|
||||||
REMOVE
|
REMOVE,
|
||||||
|
SWITCH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,6 +177,7 @@ challenges:
|
|||||||
button:
|
button:
|
||||||
add: Add
|
add: Add
|
||||||
remove-selected: Remove Selected
|
remove-selected: Remove Selected
|
||||||
|
show-eggs: Toogle Mob View
|
||||||
buttons:
|
buttons:
|
||||||
back: Return
|
back: Return
|
||||||
next: Next
|
next: Next
|
||||||
|
Loading…
Reference in New Issue
Block a user