diff --git a/src/main/java/com/songoda/epicvouchers/EpicVouchers.java b/src/main/java/com/songoda/epicvouchers/EpicVouchers.java index dc250b7..27688a9 100644 --- a/src/main/java/com/songoda/epicvouchers/EpicVouchers.java +++ b/src/main/java/com/songoda/epicvouchers/EpicVouchers.java @@ -7,14 +7,16 @@ import com.songoda.epicvouchers.libraries.inventory.FastInv; import com.songoda.epicvouchers.libraries.inventory.IconInv; import com.songoda.epicvouchers.listeners.PlayerCommandListener; import com.songoda.epicvouchers.listeners.PlayerInteractListener; -import com.songoda.epicvouchers.utils.*; +import com.songoda.epicvouchers.utils.ConfigWrapper; +import com.songoda.epicvouchers.utils.Methods; +import com.songoda.epicvouchers.utils.ServerVersion; +import com.songoda.epicvouchers.utils.SettingsManager; import com.songoda.epicvouchers.utils.updateModules.LocaleModule; import com.songoda.epicvouchers.voucher.CoolDownManager; import com.songoda.epicvouchers.voucher.Voucher; import com.songoda.epicvouchers.voucher.VoucherExecutor; import com.songoda.update.Plugin; import com.songoda.update.SongodaUpdate; -import lombok.Getter; import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -25,7 +27,6 @@ import org.bukkit.plugin.java.JavaPlugin; import java.io.File; import java.util.LinkedHashMap; -@Getter public class EpicVouchers extends JavaPlugin { private static EpicVouchers INSTANCE; @@ -160,4 +161,39 @@ public class EpicVouchers extends JavaPlugin { Bukkit.getConsoleSender().sendMessage(Methods.format("&a=============================")); } + public ServerVersion getServerVersion() { + return this.serverVersion; + } + + public CommandManager getCommandManager() { + return this.commandManager; + } + + public Connections getConnections() { + return this.connections; + } + + public CoolDownManager getCoolDowns() { + return this.coolDowns; + } + + public Locale getLocale() { + return this.locale; + } + + public SettingsManager getSettingsManager() { + return this.settingsManager; + } + + public VoucherExecutor getVoucherExecutor() { + return this.voucherExecutor; + } + + public ConfigWrapper getVouchersFile() { + return this.vouchersFile; + } + + public LinkedHashMap getVouchers() { + return this.vouchers; + } } \ No newline at end of file diff --git a/src/main/java/com/songoda/epicvouchers/libraries/ItemBuilder.java b/src/main/java/com/songoda/epicvouchers/libraries/ItemBuilder.java index 0ad8173..a39d838 100644 --- a/src/main/java/com/songoda/epicvouchers/libraries/ItemBuilder.java +++ b/src/main/java/com/songoda/epicvouchers/libraries/ItemBuilder.java @@ -11,7 +11,10 @@ import org.bukkit.inventory.meta.*; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * A complete {@link ItemStack} inventory for FastInv (only works on 1.8+). diff --git a/src/main/java/com/songoda/epicvouchers/libraries/inventory/FastInv.java b/src/main/java/com/songoda/epicvouchers/libraries/inventory/FastInv.java index 325c286..eaeb272 100644 --- a/src/main/java/com/songoda/epicvouchers/libraries/inventory/FastInv.java +++ b/src/main/java/com/songoda/epicvouchers/libraries/inventory/FastInv.java @@ -12,7 +12,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitTask; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; /** * A fast API to easily create advanced GUI. diff --git a/src/main/java/com/songoda/epicvouchers/libraries/inventory/IconInv.java b/src/main/java/com/songoda/epicvouchers/libraries/inventory/IconInv.java index 9668bac..cbc9463 100644 --- a/src/main/java/com/songoda/epicvouchers/libraries/inventory/IconInv.java +++ b/src/main/java/com/songoda/epicvouchers/libraries/inventory/IconInv.java @@ -1,6 +1,5 @@ package com.songoda.epicvouchers.libraries.inventory; -import com.songoda.epicvouchers.libraries.ItemBuilder; import com.songoda.epicvouchers.libraries.inventory.icons.Icon; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/src/main/java/com/songoda/epicvouchers/libraries/inventory/PlayersMenu.java b/src/main/java/com/songoda/epicvouchers/libraries/inventory/PlayersMenu.java index 92d419d..60d809a 100644 --- a/src/main/java/com/songoda/epicvouchers/libraries/inventory/PlayersMenu.java +++ b/src/main/java/com/songoda/epicvouchers/libraries/inventory/PlayersMenu.java @@ -17,7 +17,8 @@ import java.util.List; import java.util.function.BiConsumer; import java.util.stream.IntStream; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; import static org.bukkit.Material.*; public abstract class PlayersMenu extends FastInv { diff --git a/src/main/java/com/songoda/epicvouchers/libraries/inventory/icons/ListEntryIcon.java b/src/main/java/com/songoda/epicvouchers/libraries/inventory/icons/ListEntryIcon.java index 6e1fba9..a02cfab 100644 --- a/src/main/java/com/songoda/epicvouchers/libraries/inventory/icons/ListEntryIcon.java +++ b/src/main/java/com/songoda/epicvouchers/libraries/inventory/icons/ListEntryIcon.java @@ -10,7 +10,8 @@ import org.bukkit.event.inventory.ClickType; import java.util.function.BiConsumer; import static com.songoda.epicvouchers.libraries.AbstractAnvilGUI.AnvilSlot.INPUT_LEFT; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; import static org.bukkit.Material.PAPER; public class ListEntryIcon extends Icon { diff --git a/src/main/java/com/songoda/epicvouchers/listeners/PlayerInteractListener.java b/src/main/java/com/songoda/epicvouchers/listeners/PlayerInteractListener.java index 765103e..772a25e 100644 --- a/src/main/java/com/songoda/epicvouchers/listeners/PlayerInteractListener.java +++ b/src/main/java/com/songoda/epicvouchers/listeners/PlayerInteractListener.java @@ -55,7 +55,7 @@ public class PlayerInteractListener implements Listener { UUID uuid = player.getUniqueId(); if (instance.getCoolDowns().isOnCoolDown(uuid)) { - player.sendMessage(instance.getLocale().getMessage("event.general.coolDown", instance.getCoolDowns().getTime(uuid), voucher.getName(true))); + player.sendMessage(instance.getLocale().getMessage("event.general.cooldown", instance.getCoolDowns().getTime(uuid), voucher.getName(true))); return; } @@ -67,7 +67,8 @@ public class PlayerInteractListener implements Listener { () -> { }) .open(player); - return; + } else { + instance.getVoucherExecutor().redeemVoucher(player, voucher, item, true, event); } } } diff --git a/src/main/java/com/songoda/epicvouchers/menus/ActionMenu.java b/src/main/java/com/songoda/epicvouchers/menus/ActionMenu.java index e92943e..3ab8c7f 100644 --- a/src/main/java/com/songoda/epicvouchers/menus/ActionMenu.java +++ b/src/main/java/com/songoda/epicvouchers/menus/ActionMenu.java @@ -15,7 +15,8 @@ import org.bukkit.inventory.ItemStack; import java.util.ArrayList; import static com.songoda.epicvouchers.utils.Methods.format; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; import static org.bukkit.Material.BARRIER; public class ActionMenu extends FastInv { diff --git a/src/main/java/com/songoda/epicvouchers/menus/OptionMenu.java b/src/main/java/com/songoda/epicvouchers/menus/OptionMenu.java index fa047f1..5682fcd 100644 --- a/src/main/java/com/songoda/epicvouchers/menus/OptionMenu.java +++ b/src/main/java/com/songoda/epicvouchers/menus/OptionMenu.java @@ -10,8 +10,8 @@ import org.bukkit.ChatColor; import org.bukkit.inventory.ItemStack; import static com.songoda.epicvouchers.utils.Methods.format; -import static org.bukkit.ChatColor.*; -import static org.bukkit.Material.valueOf; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; import static org.bukkit.Material.*; public class OptionMenu extends FastInv { diff --git a/src/main/java/com/songoda/epicvouchers/menus/VoucherEditorMenu.java b/src/main/java/com/songoda/epicvouchers/menus/VoucherEditorMenu.java index 7aace32..d14510d 100644 --- a/src/main/java/com/songoda/epicvouchers/menus/VoucherEditorMenu.java +++ b/src/main/java/com/songoda/epicvouchers/menus/VoucherEditorMenu.java @@ -3,15 +3,22 @@ package com.songoda.epicvouchers.menus; import com.songoda.epicvouchers.EpicVouchers; import com.songoda.epicvouchers.libraries.ItemBuilder; import com.songoda.epicvouchers.libraries.inventory.IconInv; -import com.songoda.epicvouchers.libraries.inventory.icons.*; -import com.songoda.epicvouchers.menus.sub.editor.*; +import com.songoda.epicvouchers.libraries.inventory.icons.Icon; +import com.songoda.epicvouchers.libraries.inventory.icons.StringIcon; +import com.songoda.epicvouchers.libraries.inventory.icons.StringListIcon; +import com.songoda.epicvouchers.libraries.inventory.icons.ToggleableIcon; +import com.songoda.epicvouchers.menus.sub.editor.EffectsMenu; +import com.songoda.epicvouchers.menus.sub.editor.ParticlesMenu; +import com.songoda.epicvouchers.menus.sub.editor.SoundsMenu; +import com.songoda.epicvouchers.menus.sub.editor.TitlesMenu; import com.songoda.epicvouchers.voucher.Voucher; import org.apache.commons.lang.StringUtils; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; import static org.bukkit.Material.BOOK; public class VoucherEditorMenu extends IconInv { diff --git a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/EffectsMenu.java b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/EffectsMenu.java index 21bbe6b..42367bb 100644 --- a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/EffectsMenu.java +++ b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/EffectsMenu.java @@ -9,7 +9,8 @@ import com.songoda.epicvouchers.menus.VoucherEditorMenu; import com.songoda.epicvouchers.voucher.Voucher; import org.bukkit.Material; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; public class EffectsMenu extends IconInv { public EffectsMenu(EpicVouchers instance, Voucher voucher) { diff --git a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/ParticlesMenu.java b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/ParticlesMenu.java index 0f592ac..99a668d 100644 --- a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/ParticlesMenu.java +++ b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/ParticlesMenu.java @@ -9,7 +9,8 @@ import com.songoda.epicvouchers.menus.VoucherEditorMenu; import com.songoda.epicvouchers.voucher.Voucher; import org.bukkit.Material; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; public class ParticlesMenu extends IconInv { public ParticlesMenu(EpicVouchers instance, Voucher voucher) { diff --git a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/SetItemMenu.java b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/SetItemMenu.java index 1f1688a..c723f2d 100644 --- a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/SetItemMenu.java +++ b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/SetItemMenu.java @@ -11,7 +11,8 @@ import org.bukkit.Material; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; public class SetItemMenu extends FastInv { diff --git a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/SoundsMenu.java b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/SoundsMenu.java index 6fbf553..6f90046 100644 --- a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/SoundsMenu.java +++ b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/SoundsMenu.java @@ -11,7 +11,8 @@ import com.songoda.epicvouchers.voucher.Voucher; import org.bukkit.Material; import org.bukkit.Sound; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; public class SoundsMenu extends IconInv { public SoundsMenu(EpicVouchers instance, Voucher voucher) { diff --git a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/TitlesMenu.java b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/TitlesMenu.java index 6b5b5ff..77807cb 100644 --- a/src/main/java/com/songoda/epicvouchers/menus/sub/editor/TitlesMenu.java +++ b/src/main/java/com/songoda/epicvouchers/menus/sub/editor/TitlesMenu.java @@ -9,7 +9,8 @@ import com.songoda.epicvouchers.menus.VoucherEditorMenu; import com.songoda.epicvouchers.voucher.Voucher; import org.bukkit.Material; -import static org.bukkit.ChatColor.*; +import static org.bukkit.ChatColor.GRAY; +import static org.bukkit.ChatColor.YELLOW; public class TitlesMenu extends IconInv { public TitlesMenu(EpicVouchers instance, Voucher voucher) { diff --git a/src/main/java/com/songoda/epicvouchers/voucher/Voucher.java b/src/main/java/com/songoda/epicvouchers/voucher/Voucher.java index ac711ef..2756972 100644 --- a/src/main/java/com/songoda/epicvouchers/voucher/Voucher.java +++ b/src/main/java/com/songoda/epicvouchers/voucher/Voucher.java @@ -4,8 +4,6 @@ import com.songoda.epicvouchers.EpicVouchers; import com.songoda.epicvouchers.events.ForceRedeemEvent; import com.songoda.epicvouchers.events.VoucherReceiveEvent; import com.songoda.epicvouchers.utils.Methods; -import lombok.Getter; -import lombok.Setter; import lombok.experimental.Accessors; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -24,8 +22,6 @@ import java.util.stream.Collectors; import static com.songoda.epicvouchers.utils.Methods.format; import static org.bukkit.Material.PAPER; -@Getter -@Setter @Accessors(chain = true) public class Voucher { @@ -197,4 +193,278 @@ public class Voucher { return format(title); } + public String getKey() { + return this.key; + } + + public EpicVouchers getInstance() { + return this.instance; + } + + public String getPermission() { + return this.permission; + } + + public Material getMaterial() { + return this.material; + } + + public short getData() { + return this.data; + } + + public int getCoolDown() { + return this.coolDown; + } + + public String getName() { + return this.name; + } + + public List getLore() { + return this.lore; + } + + public boolean isGlow() { + return this.glow; + } + + public boolean isConfirm() { + return this.confirm; + } + + public boolean isUnbreakable() { + return this.unbreakable; + } + + public boolean isHideAttributes() { + return this.hideAttributes; + } + + public boolean isRemoveItem() { + return this.removeItem; + } + + public boolean isFeedPlayer() { + return this.feedPlayer; + } + + public boolean isHealPlayer() { + return this.healPlayer; + } + + public boolean isSmiteEffect() { + return this.smiteEffect; + } + + public List getBroadcasts() { + return this.broadcasts; + } + + public List getMessages() { + return this.messages; + } + + public List getCommands() { + return this.commands; + } + + public int getTitleFadeIn() { + return this.titleFadeIn; + } + + public int getTitleStay() { + return this.titleStay; + } + + public int getTitleFadeOut() { + return this.titleFadeOut; + } + + public String getSound() { + return this.sound; + } + + public int getSoundPitch() { + return this.soundPitch; + } + + public String getParticle() { + return this.particle; + } + + public int getParticleAmount() { + return this.particleAmount; + } + + public String getEffect() { + return this.effect; + } + + public int getEffectAmplifier() { + return this.effectAmplifier; + } + + public int getEffectDuration() { + return this.effectDuration; + } + + public ItemStack getItemStack() { + return this.itemStack; + } + + public Voucher setPermission(String permission) { + this.permission = permission; + return this; + } + + public Voucher setMaterial(Material material) { + this.material = material; + return this; + } + + public Voucher setData(short data) { + this.data = data; + return this; + } + + public Voucher setCoolDown(int coolDown) { + this.coolDown = coolDown; + return this; + } + + public Voucher setName(String name) { + this.name = name; + return this; + } + + public Voucher setLore(List lore) { + this.lore = lore; + return this; + } + + public Voucher setGlow(boolean glow) { + this.glow = glow; + return this; + } + + public Voucher setConfirm(boolean confirm) { + this.confirm = confirm; + return this; + } + + public Voucher setUnbreakable(boolean unbreakable) { + this.unbreakable = unbreakable; + return this; + } + + public Voucher setHideAttributes(boolean hideAttributes) { + this.hideAttributes = hideAttributes; + return this; + } + + public Voucher setRemoveItem(boolean removeItem) { + this.removeItem = removeItem; + return this; + } + + public Voucher setFeedPlayer(boolean feedPlayer) { + this.feedPlayer = feedPlayer; + return this; + } + + public Voucher setHealPlayer(boolean healPlayer) { + this.healPlayer = healPlayer; + return this; + } + + public Voucher setSmiteEffect(boolean smiteEffect) { + this.smiteEffect = smiteEffect; + return this; + } + + public Voucher setBroadcasts(List broadcasts) { + this.broadcasts = broadcasts; + return this; + } + + public Voucher setMessages(List messages) { + this.messages = messages; + return this; + } + + public Voucher setCommands(List commands) { + this.commands = commands; + return this; + } + + public Voucher setActionBar(String actionBar) { + this.actionBar = actionBar; + return this; + } + + public Voucher setTitle(String title) { + this.title = title; + return this; + } + + public Voucher setSubTitle(String subTitle) { + this.subTitle = subTitle; + return this; + } + + public Voucher setTitleFadeIn(int titleFadeIn) { + this.titleFadeIn = titleFadeIn; + return this; + } + + public Voucher setTitleStay(int titleStay) { + this.titleStay = titleStay; + return this; + } + + public Voucher setTitleFadeOut(int titleFadeOut) { + this.titleFadeOut = titleFadeOut; + return this; + } + + public Voucher setSound(String sound) { + this.sound = sound; + return this; + } + + public Voucher setSoundPitch(int soundPitch) { + this.soundPitch = soundPitch; + return this; + } + + public Voucher setParticle(String particle) { + this.particle = particle; + return this; + } + + public Voucher setParticleAmount(int particleAmount) { + this.particleAmount = particleAmount; + return this; + } + + public Voucher setEffect(String effect) { + this.effect = effect; + return this; + } + + public Voucher setEffectAmplifier(int effectAmplifier) { + this.effectAmplifier = effectAmplifier; + return this; + } + + public Voucher setEffectDuration(int effectDuration) { + this.effectDuration = effectDuration; + return this; + } + + public Voucher setItemStack(ItemStack itemStack) { + this.itemStack = itemStack; + return this; + } }