The rest of that rewrite.
This commit is contained in:
parent
8207ff915b
commit
4db8c49fa4
|
@ -1,7 +1,10 @@
|
|||
package com.songoda.epicenchants.commands;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Dependency;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import com.songoda.epicenchants.menus.AlchemistMenu;
|
||||
import com.songoda.epicenchants.menus.EnchanterMenu;
|
||||
|
|
|
@ -7,13 +7,12 @@ import com.songoda.epicenchants.EpicEnchants;
|
|||
import com.songoda.epicenchants.enums.EnchantResult;
|
||||
import com.songoda.epicenchants.objects.Enchant;
|
||||
import com.songoda.epicenchants.objects.Group;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import com.songoda.epicenchants.utils.Tuple;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import static com.songoda.epicenchants.enums.EnchantResult.BROKEN_FAILURE;
|
||||
import static com.songoda.epicenchants.objects.Placeholder.of;
|
||||
import static com.songoda.epicenchants.utils.single.GeneralUtils.getMessageFromResult;
|
||||
|
||||
@CommandAlias("epicenchants|ee")
|
||||
|
@ -29,15 +28,21 @@ public class EnchantCommand extends BaseCommand {
|
|||
@CommandPermission("epicenchants.give.book")
|
||||
public void onGiveBook(CommandSender sender, @Flags("other") Player target, Enchant enchant, @Optional Integer level, @Optional Integer successRate, @Optional Integer destroyRate) {
|
||||
if (level != null && (level > enchant.getMaxLevel() || level < 1)) {
|
||||
instance.getAction().perform(sender, "command.book." + (level > enchant.getMaxLevel() ? "max-level" : "min-level"),
|
||||
of("enchant", enchant.getIdentifier()),
|
||||
of("max-level", enchant.getMaxLevel()));
|
||||
instance.getLocale().getMessage("command.book." + (level > enchant.getMaxLevel() ? "maxlevel" : "minlevel"))
|
||||
.processPlaceholder("enchant", enchant.getIdentifier())
|
||||
.processPlaceholder("maxlevel", enchant.getMaxLevel())
|
||||
.sendPrefixedMessage(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
target.getInventory().addItem(enchant.getBook().get(enchant, level, successRate, destroyRate));
|
||||
instance.getAction().perform(target, "command.book.received", of("enchant", enchant.getIdentifier()));
|
||||
instance.getAction().perform(sender, "command.book.gave", of("player", target.getName()), of("enchant", enchant.getIdentifier()));
|
||||
instance.getLocale().getMessage("command.book.received")
|
||||
.processPlaceholder("enchant", enchant.getIdentifier())
|
||||
.sendPrefixedMessage(target);
|
||||
instance.getLocale().getMessage("command.book.gave")
|
||||
.processPlaceholder("player", target.getName())
|
||||
.processPlaceholder("enchant", enchant.getIdentifier())
|
||||
.sendPrefixedMessage(sender);
|
||||
}
|
||||
|
||||
//ee give item dust [player] [group] <type> <percentage>
|
||||
|
@ -46,8 +51,13 @@ public class EnchantCommand extends BaseCommand {
|
|||
@CommandPermission("epicenchants.give.item.dust")
|
||||
public void onGiveDust(CommandSender sender, @Flags("other") Player target, Group group, @Optional String dustType, @Optional Integer percentage) {
|
||||
target.getInventory().addItem(instance.getSpecialItems().getDust(group, dustType, percentage, true));
|
||||
instance.getAction().perform(target, "command.dust.received", of("group", group.getIdentifier()));
|
||||
instance.getAction().perform(sender, "command.dust.gave", of("player", target.getName()), of("group", group.getIdentifier()));
|
||||
instance.getLocale().getMessage("command.dust.received")
|
||||
.processPlaceholder("group", group.getIdentifier())
|
||||
.sendPrefixedMessage(target);
|
||||
instance.getLocale().getMessage("command.dust.gave")
|
||||
.processPlaceholder("player", target.getName())
|
||||
.processPlaceholder("group", group.getIdentifier())
|
||||
.sendPrefixedMessage(sender);
|
||||
}
|
||||
|
||||
//ee give item [giveType] [player] <amount> <success-rate>
|
||||
|
@ -67,12 +77,17 @@ public class EnchantCommand extends BaseCommand {
|
|||
target.getInventory().addItem(instance.getSpecialItems().getBlackScroll(amount, successRate));
|
||||
break;
|
||||
default:
|
||||
instance.getAction().perform(target, "command.give-unknown", of("unknown", giveType));
|
||||
instance.getLocale().getMessage("command.giveunknown")
|
||||
.processPlaceholder("unknown", giveType)
|
||||
.sendPrefixedMessage(target);
|
||||
return;
|
||||
}
|
||||
|
||||
instance.getAction().perform(target, "command." + messageKey + ".received");
|
||||
instance.getAction().perform(sender, "command." + messageKey + ".gave", of("player", target.getName()));
|
||||
instance.getLocale().getMessage("command." + messageKey + ".received")
|
||||
.sendPrefixedMessage(target);
|
||||
instance.getLocale().getMessage("command." + messageKey + ".gave")
|
||||
.processPlaceholder("player", target.getName())
|
||||
.sendPrefixedMessage(target);
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,18 +97,22 @@ public class EnchantCommand extends BaseCommand {
|
|||
@Description("Apply enchant to item in hand")
|
||||
@CommandPermission("epicenchants.apply")
|
||||
public void onApply(Player player, Enchant enchant, int level, @Optional Integer successRate, @Optional Integer destroyRate) {
|
||||
if (player.getItemInHand() == null || !enchant.getItemWhitelist().contains(player.getItemInHand().getType())) {
|
||||
if (!enchant.getItemWhitelist().contains(player.getItemInHand().getType())) {
|
||||
System.out.println("List = " + enchant.getItemWhitelist());
|
||||
instance.getAction().perform(player, "command.apply.invalid-item", of("enchant", enchant.getIdentifier()));
|
||||
instance.getLocale().getMessage("command.apply.invaliditem")
|
||||
.processPlaceholder("enchant", enchant.getIdentifier())
|
||||
.sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
|
||||
int slot = player.getInventory().getHeldItemSlot();
|
||||
ItemStack before = player.getItemInHand();
|
||||
Pair<ItemStack, EnchantResult> result = instance.getEnchantUtils().apply(before, enchant, level,
|
||||
Tuple<ItemStack, EnchantResult> result = instance.getEnchantUtils().apply(before, enchant, level,
|
||||
successRate == null ? 100 : successRate, destroyRate == null ? 0 : destroyRate);
|
||||
|
||||
instance.getAction().perform(player, getMessageFromResult(result.getRight()), of("enchant", enchant.getIdentifier()));
|
||||
instance.getLocale().getMessage(getMessageFromResult(result.getRight()))
|
||||
.processPlaceholder("enchant", enchant.getIdentifier())
|
||||
.sendPrefixedMessage(player);
|
||||
|
||||
if (result.getRight() == BROKEN_FAILURE) {
|
||||
player.getInventory().clear(slot);
|
||||
|
@ -117,7 +136,7 @@ public class EnchantCommand extends BaseCommand {
|
|||
@CommandPermission("epicenchants.reload")
|
||||
public void onReload(CommandSender sender) {
|
||||
instance.reload();
|
||||
instance.getAction().perform(sender, "command.reload");
|
||||
instance.getLocale().getMessage("command.reload").sendPrefixedMessage(sender);
|
||||
}
|
||||
|
||||
@HelpCommand
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package com.songoda.ultimateclaims.economy;
|
||||
package com.songoda.epicenchants.economy;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface Economy {
|
||||
|
||||
boolean hasBalance(OfflinePlayer player, double cost);
|
||||
|
||||
double getBalance(Player player);
|
||||
|
||||
boolean withdrawBalance(OfflinePlayer player, double cost);
|
||||
|
||||
boolean deposit(OfflinePlayer player, double amount);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.songoda.ultimateclaims.economy;
|
||||
package com.songoda.epicenchants.economy;
|
||||
|
||||
import org.black_ixx.playerpoints.PlayerPoints;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerPointsEconomy implements Economy {
|
||||
|
||||
|
@ -23,6 +24,11 @@ public class PlayerPointsEconomy implements Economy {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(Player player) {
|
||||
return playerPoints.getAPI().look(player.getUniqueId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean withdrawBalance(OfflinePlayer player, double cost) {
|
||||
int amount = convertAmount(cost);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.songoda.ultimateclaims.economy;
|
||||
package com.songoda.epicenchants.economy;
|
||||
|
||||
import net.tnemc.core.Reserve;
|
||||
import net.tnemc.core.economy.EconomyAPI;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
@ -20,6 +21,11 @@ public class ReserveEconomy implements Economy {
|
|||
return economyAPI.hasHoldings(player.getUniqueId(), new BigDecimal(cost));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(Player player) {
|
||||
return economyAPI.getHoldings(player.getUniqueId()).doubleValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean withdrawBalance(OfflinePlayer player, double cost) {
|
||||
return economyAPI.removeHoldings(player.getUniqueId(), new BigDecimal(cost));
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.songoda.ultimateclaims.economy;
|
||||
package com.songoda.epicenchants.economy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class VaultEconomy implements Economy {
|
||||
private final net.milkbowl.vault.economy.Economy vault;
|
||||
|
@ -16,6 +17,11 @@ public class VaultEconomy implements Economy {
|
|||
return vault.has(player, cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(Player player) {
|
||||
return vault.getBalance(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean withdrawBalance(OfflinePlayer player, double cost) {
|
||||
return vault.withdrawPlayer(player, cost).transactionSuccess();
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.songoda.epicenchants.enums.TriggerType;
|
|||
import com.songoda.epicenchants.objects.Condition;
|
||||
import com.songoda.epicenchants.objects.LeveledModifier;
|
||||
import com.songoda.epicenchants.utils.single.GeneralUtils;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -19,11 +18,12 @@ import java.util.Set;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.songoda.epicenchants.effect.EffectExecutor.Who.*;
|
||||
import static com.songoda.epicenchants.effect.EffectExecutor.Who.OPPONENT;
|
||||
import static com.songoda.epicenchants.effect.EffectExecutor.Who.USER;
|
||||
|
||||
public abstract class EffectExecutor {
|
||||
@Getter private final ConfigurationSection section;
|
||||
@Getter private final Set<TriggerType> triggerTypes;
|
||||
private final ConfigurationSection section;
|
||||
private final Set<TriggerType> triggerTypes;
|
||||
private final Set<EffectExecutor> simultaneous;
|
||||
private final Condition condition;
|
||||
|
||||
|
@ -96,6 +96,14 @@ public abstract class EffectExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
public ConfigurationSection getSection() {
|
||||
return this.section;
|
||||
}
|
||||
|
||||
public Set<TriggerType> getTriggerTypes() {
|
||||
return this.triggerTypes;
|
||||
}
|
||||
|
||||
public enum Who {
|
||||
USER, OPPONENT
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ import java.lang.reflect.Constructor;
|
|||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.google.common.base.CaseFormat.*;
|
||||
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
|
||||
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
|
||||
|
||||
public class EffectManager {
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ import org.bukkit.entity.Player;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.songoda.epicenchants.effect.EffectExecutor.Who.OPPONENT;
|
||||
import static com.songoda.epicenchants.enums.EventType.*;
|
||||
import static com.songoda.epicenchants.enums.EventType.NONE;
|
||||
import static com.songoda.epicenchants.enums.EventType.ON;
|
||||
|
||||
public class PlayerCommand extends EffectExecutor {
|
||||
public PlayerCommand(ConfigurationSection section) {
|
||||
|
|
|
@ -3,11 +3,11 @@ package com.songoda.epicenchants.effect.effects;
|
|||
import com.songoda.epicenchants.effect.EffectExecutor;
|
||||
import com.songoda.epicenchants.enums.EventType;
|
||||
import com.songoda.epicenchants.objects.LeveledModifier;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTEntity;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTList;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTListCompound;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTType;
|
||||
import com.songoda.epicenchants.utils.objects.ItemBuilder;
|
||||
import de.tr7zw.itemnbtapi.NBTEntity;
|
||||
import de.tr7zw.itemnbtapi.NBTList;
|
||||
import de.tr7zw.itemnbtapi.NBTListCompound;
|
||||
import de.tr7zw.itemnbtapi.NBTType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.*;
|
||||
|
|
|
@ -8,7 +8,8 @@ import org.bukkit.entity.Player;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static com.songoda.epicenchants.utils.single.Experience.*;
|
||||
import static com.songoda.epicenchants.utils.single.Experience.changeExp;
|
||||
import static com.songoda.epicenchants.utils.single.Experience.getExp;
|
||||
|
||||
public class StealExp extends EffectExecutor {
|
||||
public StealExp(ConfigurationSection section) {
|
||||
|
|
|
@ -2,13 +2,12 @@ package com.songoda.epicenchants.listeners.item;
|
|||
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import com.songoda.epicenchants.objects.Enchant;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTCompound;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTItem;
|
||||
import com.songoda.epicenchants.utils.single.RomanNumber;
|
||||
import de.tr7zw.itemnbtapi.NBTCompound;
|
||||
import de.tr7zw.itemnbtapi.NBTItem;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import static com.songoda.epicenchants.objects.Placeholder.of;
|
||||
import static com.songoda.epicenchants.utils.single.GeneralUtils.getRandomElement;
|
||||
|
||||
public class BlackScrollListener extends ItemListener {
|
||||
|
@ -23,10 +22,11 @@ public class BlackScrollListener extends ItemListener {
|
|||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
NBTCompound compound = current.getCompound("enchants");
|
||||
NBTCompound compound = current.getCompound("src/main/resources/enchants");
|
||||
|
||||
if (compound == null || compound.getKeys().isEmpty()) {
|
||||
instance.getAction().perform(event.getWhoClicked(), "black-scroll.no-enchants");
|
||||
instance.getLocale().getMessage("blackscroll.noenchants")
|
||||
.sendPrefixedMessage(event.getWhoClicked());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -38,11 +38,12 @@ public class BlackScrollListener extends ItemListener {
|
|||
event.getWhoClicked().getInventory().addItem(enchant.getBook().get(enchant, level, cursor.getInteger("success-rate"), 100));
|
||||
event.setCurrentItem(toSet);
|
||||
|
||||
instance.getAction().perform(event.getWhoClicked(), "black-scroll.success",
|
||||
of("enchant", enchant.getIdentifier()),
|
||||
of("group_color", enchant.getGroup().getColor()),
|
||||
of("group_name", enchant.getGroup().getName()),
|
||||
of("level", RomanNumber.toRoman(level)));
|
||||
instance.getLocale().getMessage("black-scroll.success")
|
||||
.processPlaceholder("enchant", enchant.getIdentifier())
|
||||
.processPlaceholder("group_color", enchant.getGroup().getColor())
|
||||
.processPlaceholder("group_name", enchant.getGroup().getName())
|
||||
.processPlaceholder("level", RomanNumber.toRoman(level))
|
||||
.sendPrefixedMessage(event.getWhoClicked());
|
||||
|
||||
useItem(event);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import com.songoda.epicenchants.enums.EnchantResult;
|
|||
import com.songoda.epicenchants.events.EnchantApplyEvent;
|
||||
import com.songoda.epicenchants.objects.Enchant;
|
||||
import com.songoda.epicenchants.objects.Group;
|
||||
import com.songoda.epicenchants.utils.Tuple;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTItem;
|
||||
import com.songoda.epicenchants.utils.single.GeneralUtils;
|
||||
import de.tr7zw.itemnbtapi.NBTItem;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
@ -16,7 +16,6 @@ import org.bukkit.inventory.ItemStack;
|
|||
import java.util.Optional;
|
||||
|
||||
import static com.songoda.epicenchants.enums.EnchantResult.*;
|
||||
import static com.songoda.epicenchants.objects.Placeholder.of;
|
||||
|
||||
public class BookListener extends ItemListener {
|
||||
public BookListener(EpicEnchants instance) {
|
||||
|
@ -49,10 +48,11 @@ public class BookListener extends ItemListener {
|
|||
return;
|
||||
}
|
||||
|
||||
Pair<ItemStack, EnchantResult> result = instance.getEnchantUtils().apply(toApply, enchant, enchantEvent.getLevel(), enchantEvent.getSuccessRate(), enchantEvent.getDestroyRate());
|
||||
Tuple<ItemStack, EnchantResult> result = instance.getEnchantUtils().apply(toApply, enchant, enchantEvent.getLevel(), enchantEvent.getSuccessRate(), enchantEvent.getDestroyRate());
|
||||
|
||||
instance.getAction().perform(event.getWhoClicked(), GeneralUtils.getMessageFromResult(result.getRight()),
|
||||
of("enchant", enchant.getIdentifier()));
|
||||
instance.getLocale().getMessage(GeneralUtils.getMessageFromResult(result.getRight()))
|
||||
.processPlaceholder("enchant", enchant.getIdentifier())
|
||||
.sendPrefixedMessage(event.getWhoClicked());
|
||||
|
||||
if (result.getRight() == BROKEN_FAILURE) {
|
||||
event.getClickedInventory().clear(event.getSlot());
|
||||
|
@ -88,10 +88,10 @@ public class BookListener extends ItemListener {
|
|||
useItem(event);
|
||||
event.getPlayer().getInventory().addItem(enchant.get().getBook().get(enchant.get()));
|
||||
|
||||
instance.getAction().perform(event.getPlayer(), "book.discover",
|
||||
of("group_name", group.getName()),
|
||||
of("group_color", group.getColor()),
|
||||
of("enchant_format", enchant.get().getFormat())
|
||||
);
|
||||
instance.getLocale().getMessage("book.discover")
|
||||
.processPlaceholder("group_name", group.getName())
|
||||
.processPlaceholder("group_color", group.getColor())
|
||||
.processPlaceholder("enchant_format", enchant.get().getFormat())
|
||||
.sendPrefixedMessage(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.songoda.epicenchants.listeners.item;
|
|||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import com.songoda.epicenchants.objects.Enchant;
|
||||
import com.songoda.epicenchants.objects.Group;
|
||||
import de.tr7zw.itemnbtapi.NBTItem;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTItem;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.songoda.epicenchants.listeners.item;
|
||||
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import de.tr7zw.itemnbtapi.NBTItem;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.songoda.epicenchants.listeners.item;
|
||||
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTItem;
|
||||
import com.songoda.epicenchants.utils.objects.ItemBuilder;
|
||||
import de.tr7zw.itemnbtapi.NBTItem;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@ -21,12 +21,13 @@ public class WhiteScrollListener extends ItemListener {
|
|||
event.setCancelled(true);
|
||||
|
||||
if (current.hasKey("protected")) {
|
||||
instance.getAction().perform(event.getWhoClicked(), "white-scroll.already-applied");
|
||||
instance.getLocale().getMessage("whitescroll.alreadyapplied")
|
||||
.sendPrefixedMessage(event.getWhoClicked());
|
||||
return;
|
||||
}
|
||||
|
||||
current.setBoolean("protected", true);
|
||||
instance.getAction().perform(event.getWhoClicked(), "white-scroll.applied");
|
||||
instance.getLocale().getMessage("whitescrollapplied").sendPrefixedMessage(event.getWhoClicked());
|
||||
|
||||
ItemStack toSet = new ItemBuilder(current.getItem()).addLore(instance.getSpecialItems().getWhiteScrollLore()).build();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import com.songoda.epicbuckets.utils.itemnbtapi.utils.MinecraftVersion;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.utils.MinecraftVersion;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
public class NBTContainer extends NBTCompound {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import com.songoda.epicbuckets.utils.itemnbtapi.utils.MinecraftVersion;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.utils.MinecraftVersion;
|
||||
|
||||
public class NBTList {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import com.songoda.epicbuckets.utils.itemnbtapi.utils.GsonWrapper;
|
||||
import com.songoda.epicbuckets.utils.itemnbtapi.utils.MinecraftVersion;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.utils.GsonWrapper;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.utils.MinecraftVersion;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import org.bukkit.block.BlockState;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
public enum NBTType {
|
||||
NBTTagEnd(0),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi;
|
||||
|
||||
import com.songoda.epicbuckets.utils.itemnbtapi.utils.MinecraftVersion;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.utils.MinecraftVersion;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi.utils;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.epicbuckets.utils.itemnbtapi.utils;
|
||||
package com.songoda.epicenchants.utils.itemnbtapi.utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.ultimateclaims.utils.locale;
|
||||
package com.songoda.epicenchants.utils.locale;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.songoda.ultimateclaims.utils.locale;
|
||||
package com.songoda.epicenchants.utils.locale;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
|
|
@ -1,4 +1,40 @@
|
|||
package com.songoda.epicenchants.utils.objects;
|
||||
|
||||
public class FIleLocation {
|
||||
public class FileLocation {
|
||||
private final boolean required, versionDependent;
|
||||
private final String path;
|
||||
|
||||
private FileLocation(String path, boolean required, boolean versionDependent) {
|
||||
this.required = required;
|
||||
this.versionDependent = versionDependent;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public static FileLocation of(String path, boolean required) {
|
||||
return new FileLocation(path, required, false);
|
||||
}
|
||||
|
||||
public static FileLocation of(String path, boolean required, boolean versionDependent) {
|
||||
return new FileLocation(path, required, versionDependent);
|
||||
}
|
||||
|
||||
public String getResourcePath(String dir) {
|
||||
return (versionDependent ? "version-dependent/" + dir + "/" : "") + path;
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return path.endsWith("/");
|
||||
}
|
||||
|
||||
public boolean isRequired() {
|
||||
return required;
|
||||
}
|
||||
|
||||
public boolean isVersionDependent() {
|
||||
return versionDependent;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.songoda.epicenchants.utils.objects;
|
||||
|
||||
import com.songoda.epicenchants.objects.Placeholder;
|
||||
import com.songoda.epicenchants.utils.itemnbtapi.NBTItem;
|
||||
import com.songoda.epicenchants.utils.single.ConfigParser;
|
||||
import com.songoda.epicenchants.utils.single.GeneralUtils;
|
||||
import com.songoda.epicenchants.wrappers.EnchantmentWrapper;
|
||||
import de.tr7zw.itemnbtapi.NBTItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
package com.songoda.ultimateclaims.utils.settings;
|
||||
package com.songoda.epicenchants.utils.settings;
|
||||
|
||||
public enum Category {
|
||||
|
||||
MAIN("General settings and options."),
|
||||
|
||||
INTERFACES("These settings allow you to alter the way interfaces look.",
|
||||
"They are used in GUI's to make paterns, change them up then open up a",
|
||||
"They are used in GUI's to make patterns, change them up then open up a",
|
||||
"GUI to see how it works."),
|
||||
|
||||
ENTITIES("Stacked Entity Settings."),
|
||||
|
||||
ITEMS("Stacked Item Settings."),
|
||||
|
||||
SPAWNERS("Stacked Spawner Settings."),
|
||||
|
||||
DATABASE("Settings regarding the Database."),
|
||||
|
||||
SYSTEM("System related settings.");
|
||||
|
||||
private String[] comments;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.songoda.ultimateclaims.utils.settings;
|
||||
package com.songoda.epicenchants.utils.settings;
|
||||
|
||||
|
||||
import com.songoda.ultimateclaims.UltimateClaims;
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -10,47 +10,10 @@ import java.util.stream.Collectors;
|
|||
|
||||
public enum Setting {
|
||||
|
||||
POWERCELL_RECIPE("Main.PowerCell Recipe",
|
||||
Arrays.asList("3:IRON_INGOT", "4:DIAMOND", "5:IRON_INGOT",
|
||||
"12:DIAMOND", "13:IRON_INGOT", "14:DIAMOND",
|
||||
"21:IRON_INGOT", "22:DIAMOND", "23:IRON_INGOT"),
|
||||
"The recipe players will need to place into a chest",
|
||||
"in order to create a powercell."),
|
||||
ROMAN("Main.Roman Numerals", true),
|
||||
|
||||
ITEM_VALUES("Main.PowerCell Item Values",
|
||||
Arrays.asList("DIAMOND:120", "IRON_INGOT:30"),
|
||||
"The value in minutes of each item put into the powercell."),
|
||||
|
||||
ECONOMY_VALUE("Main.PowerCell Economy Value", 100,
|
||||
"How much money should constitute one minute?"),
|
||||
|
||||
MINIMUM_POWER("Main.Minimum PowerCell power", -30,
|
||||
"The minimum amount of power allowed before a claim",
|
||||
"auto dissolves."),
|
||||
|
||||
POWERCELL_HOLOGRAMS("Main.Powercell Holograms", true,
|
||||
"Should holograms be placed above powercells?"),
|
||||
|
||||
CLAIMS_BOSSBAR("Main.Claims Use Boss Bar", false,
|
||||
"Display a boss bar to players while they're in a claim?",
|
||||
"Default behavior is to show a title on entry/exit."),
|
||||
|
||||
CHUNKS_MUST_TOUCH("Main.Chunks Must Touch", true,
|
||||
"Should chunks have to touch to be claimed?",
|
||||
"This prevents people from claiming little pieces all over the place."),
|
||||
|
||||
INVITE_TIMEOUT("Main.Invite Timeout", 30,
|
||||
"The amount of time before an invite times out."),
|
||||
|
||||
STARTING_POWER("Main.Starting Power", 10,
|
||||
"The starting amount of power in minutes a claim gets.",
|
||||
"This time should be used to create a powercell."),
|
||||
|
||||
MAX_CHUNKS("Main.Max Chunks", 10,
|
||||
"The maximum amount of chunks a claim can have."),
|
||||
|
||||
MAX_MEMBERS("Main.Max Members", 10,
|
||||
"The maximum amount of members a claim can have."),
|
||||
BLACK_MIN("Main.Black Scroll Min", 20),
|
||||
BLACK_MAX("Main.Black Scroll Max", 100),
|
||||
|
||||
VAULT_ECONOMY("Economy.Use Vault Economy", true,
|
||||
"Should Vault be used?"),
|
||||
|
@ -65,17 +28,11 @@ public enum Setting {
|
|||
GLASS_TYPE_2("Interfaces.Glass Type 2", 11),
|
||||
GLASS_TYPE_3("Interfaces.Glass Type 3", 3),
|
||||
|
||||
FIRST_LOAD("System.First Load", true),
|
||||
|
||||
LANGUGE_MODE("System.Language Mode", "en_US",
|
||||
"The enabled language file.",
|
||||
"More language files (if available) can be found in the plugins data folder."),
|
||||
|
||||
MYSQL_ENABLED("MySQL.Enabled", false, "Set to 'true' to use MySQL instead of SQLite for data storage."),
|
||||
MYSQL_HOSTNAME("MySQL.Hostname", "localhost"),
|
||||
MYSQL_PORT("MySQL.Port", 3306),
|
||||
MYSQL_DATABASE("MySQL.Database", "your-database"),
|
||||
MYSQL_USERNAME("MySQL.Username", "user"),
|
||||
MYSQL_PASSWORD("MySQL.Password", "pass"),
|
||||
MYSQL_USE_SSL("MySQL.Use SSL", false);
|
||||
"More language files (if available) can be found in the plugins data folder.");
|
||||
|
||||
private String setting;
|
||||
private Object option;
|
||||
|
@ -112,39 +69,39 @@ public enum Setting {
|
|||
}
|
||||
|
||||
public List<Integer> getIntegerList() {
|
||||
return UltimateClaims.getInstance().getConfig().getIntegerList(setting);
|
||||
return EpicEnchants.getInstance().getConfig().getIntegerList(setting);
|
||||
}
|
||||
|
||||
public List<String> getStringList() {
|
||||
return UltimateClaims.getInstance().getConfig().getStringList(setting);
|
||||
return EpicEnchants.getInstance().getConfig().getStringList(setting);
|
||||
}
|
||||
|
||||
public boolean getBoolean() {
|
||||
return UltimateClaims.getInstance().getConfig().getBoolean(setting);
|
||||
return EpicEnchants.getInstance().getConfig().getBoolean(setting);
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return UltimateClaims.getInstance().getConfig().getInt(setting);
|
||||
return EpicEnchants.getInstance().getConfig().getInt(setting);
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return UltimateClaims.getInstance().getConfig().getLong(setting);
|
||||
return EpicEnchants.getInstance().getConfig().getLong(setting);
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return UltimateClaims.getInstance().getConfig().getString(setting);
|
||||
return EpicEnchants.getInstance().getConfig().getString(setting);
|
||||
}
|
||||
|
||||
public char getChar() {
|
||||
return UltimateClaims.getInstance().getConfig().getString(setting).charAt(0);
|
||||
return EpicEnchants.getInstance().getConfig().getString(setting).charAt(0);
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
return UltimateClaims.getInstance().getConfig().getDouble(setting);
|
||||
return EpicEnchants.getInstance().getConfig().getDouble(setting);
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
String materialStr = UltimateClaims.getInstance().getConfig().getString(setting);
|
||||
String materialStr = EpicEnchants.getInstance().getConfig().getString(setting);
|
||||
Material material = Material.getMaterial(materialStr);
|
||||
|
||||
if (material == null) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.songoda.ultimateclaims.utils.settings;
|
||||
package com.songoda.epicenchants.utils.settings;
|
||||
|
||||
import com.songoda.ultimateclaims.UltimateClaims;
|
||||
import com.songoda.ultimateclaims.utils.Methods;
|
||||
import com.songoda.ultimateclaims.utils.ServerVersion;
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import com.songoda.epicenchants.utils.Methods;
|
||||
import com.songoda.epicenchants.utils.ServerVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
|
@ -25,11 +25,11 @@ import java.util.*;
|
|||
*/
|
||||
public class SettingsManager implements Listener {
|
||||
|
||||
private final UltimateClaims plugin;
|
||||
private final EpicEnchants plugin;
|
||||
private Map<Player, String> cat = new HashMap<>();
|
||||
private Map<Player, String> current = new HashMap<>();
|
||||
|
||||
public SettingsManager(UltimateClaims plugin) {
|
||||
public SettingsManager(EpicEnchants plugin) {
|
||||
this.plugin = plugin;
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class SettingsManager implements Listener {
|
|||
config.set(value, event.getMessage());
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(UltimateClaims.getInstance(), () ->
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(EpicEnchants.getInstance(), () ->
|
||||
this.finishEditing(player), 0L);
|
||||
|
||||
event.setCancelled(true);
|
||||
|
|
|
@ -15,7 +15,10 @@ import org.bukkit.inventory.ItemStack;
|
|||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.script.ScriptException;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.songoda.epicenchants.utils.single;
|
|||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
|
||||
|
@ -128,7 +127,7 @@ public class ItemGroup {
|
|||
HELMETS,
|
||||
ARMOR(BOOTS, LEGGINGS, CHESTPLATES, HELMETS);
|
||||
|
||||
@Getter private final Set<Group> children;
|
||||
private final Set<Group> children;
|
||||
|
||||
Group(Group... child) {
|
||||
children = child == null ? new HashSet<>() : new HashSet<>(Arrays.asList(child));
|
||||
|
@ -141,5 +140,9 @@ public class ItemGroup {
|
|||
public String getName() {
|
||||
return StringUtils.capitalize(toString().toLowerCase());
|
||||
}
|
||||
|
||||
public Set<Group> getChildren() {
|
||||
return this.children;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue