mirror of
https://github.com/songoda/EpicVouchers.git
synced 2025-01-09 09:27:39 +01:00
Fixed using voucher with confirm disabled.
Updated pom. Removed lombok.
This commit is contained in:
parent
e3a0718bdc
commit
acc82182e9
@ -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<String, Voucher> getVouchers() {
|
||||
return this.vouchers;
|
||||
}
|
||||
}
|
@ -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+).
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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<String> 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<String> getBroadcasts() {
|
||||
return this.broadcasts;
|
||||
}
|
||||
|
||||
public List<String> getMessages() {
|
||||
return this.messages;
|
||||
}
|
||||
|
||||
public List<String> 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<String> 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<String> broadcasts) {
|
||||
this.broadcasts = broadcasts;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Voucher setMessages(List<String> messages) {
|
||||
this.messages = messages;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Voucher setCommands(List<String> 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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user