Update to BentoBox API 1.4.0

This commit is contained in:
BONNe 2019-03-29 00:42:51 +02:00
parent 577a13a698
commit a957dc3a62
10 changed files with 97 additions and 13 deletions

View File

@ -20,6 +20,7 @@ import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.ChallengesManager;
import world.bentobox.challenges.database.object.Challenge;
import world.bentobox.challenges.database.object.ChallengeLevel;
import world.bentobox.challenges.utils.GuiUtils;
import world.bentobox.challenges.utils.LevelStatus;
@ -239,7 +240,13 @@ public abstract class CommonGUI
return null;
}
return new PanelItem(icon, name, description, false, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(description).
glow(false).
clickHandler(clickHandler).
build();
}

View File

@ -8,6 +8,7 @@ import org.bukkit.inventory.ItemStack;
import net.wesjd.anvilgui.AnvilGUI;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;
import world.bentobox.challenges.ChallengesAddon;
@ -453,6 +454,12 @@ public class AdminGUI extends CommonGUI
};
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength()), glow, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())).
glow(glow).
clickHandler(clickHandler).
build();
}
}

View File

@ -11,6 +11,7 @@ import java.util.*;
import net.wesjd.anvilgui.AnvilGUI;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.database.object.Challenge;
@ -281,7 +282,13 @@ public class EditChallengeGUI extends CommonGUI
return null;
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength()), glow, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())).
glow(glow).
clickHandler(clickHandler).
build();
}
@ -1250,7 +1257,13 @@ public class EditChallengeGUI extends CommonGUI
return null;
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, lineLength), glow, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, lineLength)).
glow(glow).
clickHandler(clickHandler).
build();
}

View File

@ -253,7 +253,13 @@ public class EditLevelGUI extends CommonGUI
return null;
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength()), glow, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())).
glow(glow).
clickHandler(clickHandler).
build();
}
@ -697,7 +703,15 @@ public class EditLevelGUI extends CommonGUI
return null;
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, lineLength), glow, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, lineLength)).
glow(glow).
clickHandler(clickHandler).
build();
}

View File

@ -453,7 +453,13 @@ public class EditSettingsGUI extends CommonGUI
return new PanelItemBuilder().build();
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.settings.getLoreLineLength()), glow, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, this.settings.getLoreLineLength())).
glow(glow).
clickHandler(clickHandler).
build();
}

View File

@ -438,7 +438,13 @@ public class ChallengesGUI extends CommonGUI
glow = false;
}
return new PanelItem(icon, name, description, glow, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(description).
glow(glow).
clickHandler(clickHandler).
build();
}

View File

@ -13,6 +13,7 @@ import java.util.function.BiConsumer;
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.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.utils.GuiUtils;
@ -125,7 +126,13 @@ public class ItemSwitchGUI
return null;
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.lineLength), false, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, this.lineLength)).
glow(false).
clickHandler(clickHandler).
build();
}
@ -143,7 +150,13 @@ public class ItemSwitchGUI
{
CustomPanelItem(ItemStack item)
{
super(item.clone(), "", Collections.emptyList(), false, null, false);
super(new PanelItemBuilder().
icon(item.clone()).
name("").
description(Collections.emptyList()).
glow(false).
clickHandler(null));
this.getItem().setItemMeta(item.getItemMeta());
}

View File

@ -239,7 +239,13 @@ public class NumberGUI
return null;
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.lineLength), glow, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, this.lineLength)).
glow(glow).
clickHandler(clickHandler).
build();
}

View File

@ -180,7 +180,13 @@ public class StringListGUI
return null;
}
return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.lineLength), false, clickHandler, false);
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, this.lineLength)).
glow(false).
clickHandler(clickHandler).
build();
}

View File

@ -13,6 +13,7 @@ import java.util.List;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
/**
@ -347,7 +348,12 @@ public class GuiUtils
{
private BorderBlock(ItemStack icon)
{
super(icon.clone(), " ", Collections.emptyList(), false, null, false);
super(new PanelItemBuilder().
icon(icon.clone()).
name(" ").
description(Collections.emptyList()).
glow(false).
clickHandler(null));
}