Update preferences

This commit is contained in:
TadahTech 2016-08-30 00:51:51 -05:00
parent a68f7395e4
commit 90ce21db3d
2 changed files with 21 additions and 5 deletions

View File

@ -38,9 +38,9 @@ public enum Preference
CLAN_TIPS(true, PreferenceCategory.MISC, Material.IRON_SWORD, "Show Clan Tips"), CLAN_TIPS(true, PreferenceCategory.MISC, Material.IRON_SWORD, "Show Clan Tips"),
HUB_MUSIC(true, PreferenceCategory.MISC, Material.NOTE_BLOCK, "Hub Music"), HUB_MUSIC(true, PreferenceCategory.MISC, Material.NOTE_BLOCK, "Hub Music"),
AUTO_JOIN_NEXT_GAME(true, PreferenceCategory.GAME_PLAY, Material.DIAMOND_SWORD, "Auto Join Next Game"), AUTO_JOIN_NEXT_GAME(true, PreferenceCategory.GAME_PLAY, Material.DIAMOND_SWORD, "Auto Join Next Game", "Feel like playing again?", "Enable this, and when you're out", "a 15 second timer will start", "when it ends, it'll send you", "to another game!"),
DISABLE_WARNING(true, PreferenceCategory.GAME_PLAY, Material.BARRIER, "Disable Automatic Warning"), DISABLE_WARNING(true, PreferenceCategory.GAME_PLAY, Material.BARRIER, "Disable Automatic Warning", "Know what you're doing?", "Disable this to not receive", "a message warning you about Auto-Join"),
COUNTDOWN_ON_CLICK(false, PreferenceCategory.GAME_PLAY, Material.WATCH, "Countdown to Join"), COUNTDOWN_ON_CLICK(false, PreferenceCategory.GAME_PLAY, Material.WATCH, "Countdown to Join", "See that fancy text when you're out?", "If you click it, and this is enabled", "a 15 second time will countdown", "until you are sent to a new game"),
; ;
private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap(); private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap();

View File

@ -1,5 +1,6 @@
package mineplex.core.preferences.ui.buttons; package mineplex.core.preferences.ui.buttons;
import com.google.common.collect.Lists;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.menu.Button; import mineplex.core.menu.Button;
@ -12,6 +13,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.List;
/** /**
* *
*/ */
@ -32,15 +35,28 @@ public class PreferenceButton extends Button<PreferencesManager>
Material icon = preference.getIcon(); Material icon = preference.getIcon();
boolean head = icon == Material.SKULL_ITEM; boolean head = icon == Material.SKULL_ITEM;
List<String> lore = Lists.newArrayList();
if(preference.getLore() != null)
{
lore.add(" ");
for(String s : preference.getLore())
{
lore.add(C.cGray + s);
}
}
_disabled = new ItemBuilder(preference.getIcon()) _disabled = new ItemBuilder(preference.getIcon())
.setTitle(C.cRed + preference.getName()) .setTitle(C.cRed + preference.getName())
.setLore(C.cRed + "Disabled", " " , C.cWhite + "Click to Enable") .addLore(C.cRed + "Disabled", " " , C.cWhite + "Click to Enable")
.addLores(lore)
.setData(head ? (short) 3 : 0) .setData(head ? (short) 3 : 0)
.build(); .build();
_enabled = new ItemBuilder(preference.getIcon()) _enabled = new ItemBuilder(preference.getIcon())
.setTitle(C.cGreen + preference.getName()) .setTitle(C.cGreen + preference.getName())
.setLore(C.cGreen + "Enabled", " " , C.cWhite + "Click to Disable") .addLore(C.cGreen + "Enabled", " " , C.cWhite + "Click to Disable")
.addLores(lore)
.setData(head ? (short) 3 : 0) .setData(head ? (short) 3 : 0)
.build(); .build();