Bugfixes
This commit is contained in:
@@ -23,7 +23,7 @@ public class TabcompleterTalgive extends AbstractTabCompleter {
|
||||
/**
|
||||
* The cached enchantment names.
|
||||
*/
|
||||
private static final List<String> TALISMAN_NAMES = Talismans.values().stream().filter(Talisman::isEnabled).map(talisman -> talisman.getKey().getKey()).collect(Collectors.toList());
|
||||
private static final List<String> TALISMAN_NAMES = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* The cached numbers.
|
||||
|
||||
@@ -42,12 +42,6 @@ public abstract class Talisman implements Listener, Watcher {
|
||||
@Getter
|
||||
private final NamespacedKey key;
|
||||
|
||||
/**
|
||||
* The config name of the talisman.
|
||||
*/
|
||||
@Getter
|
||||
private final String configName;
|
||||
|
||||
/**
|
||||
* The talisman's config.
|
||||
*/
|
||||
@@ -86,18 +80,7 @@ public abstract class Talisman implements Listener, Watcher {
|
||||
protected Talisman(@NotNull final String key,
|
||||
@NotNull final Prerequisite... prerequisites) {
|
||||
this.key = this.getPlugin().getNamespacedKeyFactory().create(key);
|
||||
this.configName = this.key.getKey().replace("_", "");
|
||||
this.config = new TalismanConfig(this.configName, this.getClass(), this.plugin);
|
||||
|
||||
if (Bukkit.getPluginManager().getPermission("talismans.fromtable." + configName) == null) {
|
||||
Permission permission = new Permission(
|
||||
"talismans.fromtable." + configName,
|
||||
"Allows getting " + configName + " from a Crafting Table",
|
||||
PermissionDefault.TRUE
|
||||
);
|
||||
permission.addParent(Objects.requireNonNull(Bukkit.getPluginManager().getPermission("talismans.fromtable.*")), true);
|
||||
Bukkit.getPluginManager().addPermission(permission);
|
||||
}
|
||||
this.config = new TalismanConfig(this.getKey().getKey(), this.getClass(), this.plugin);
|
||||
|
||||
if (!Prerequisite.areMet(prerequisites)) {
|
||||
return;
|
||||
@@ -113,9 +96,6 @@ public abstract class Talisman implements Listener, Watcher {
|
||||
*/
|
||||
public void update() {
|
||||
config.update();
|
||||
Material material = Material.getMaterial(config.getString(Talismans.GENERAL_LOCATION + "material").toUpperCase());
|
||||
Validate.notNull(material, "Material specified for " + this.getConfigName() + " is invalid!");
|
||||
TalismanUtils.registerTalismanMaterial(material);
|
||||
disabledWorldNames.clear();
|
||||
disabledWorldNames.addAll(config.getStrings(Talismans.GENERAL_LOCATION + "disabled-in-worlds"));
|
||||
disabledWorlds.clear();
|
||||
|
||||
@@ -127,10 +127,10 @@ public class TalismanLevel {
|
||||
this.key = this.getPlugin().getNamespacedKeyFactory().create(talisman.getKey().getKey() + "_" + level);
|
||||
this.uuid = UUID.nameUUIDFromBytes(this.getKey().getKey().getBytes());
|
||||
|
||||
if (Bukkit.getPluginManager().getPermission("talismans.fromtable." + talisman.getConfigName() + "." + level) == null) {
|
||||
if (Bukkit.getPluginManager().getPermission("talismans.fromtable." + this.getKey().getKey()) == null) {
|
||||
Permission permission = new Permission(
|
||||
"talismans.fromtable." + talisman.getConfigName() + "." + level,
|
||||
"Allows getting " + talisman.getConfigName() + " " + level + " from a Crafting Table",
|
||||
"talismans.fromtable." + this.getKey().getKey(),
|
||||
"Allows getting " + this.getKey().getKey() + " from a Crafting Table",
|
||||
PermissionDefault.TRUE
|
||||
);
|
||||
permission.addParent(Objects.requireNonNull(Bukkit.getPluginManager().getPermission("talismans.fromtable.*")), true);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.willfp.talismans.talismans;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.willfp.eco.core.config.ConfigUpdater;
|
||||
import com.willfp.talismans.talismans.talismans.AlchemyTalisman;
|
||||
import com.willfp.talismans.talismans.talismans.ArcheryTalisman;
|
||||
@@ -31,6 +32,7 @@ import com.willfp.talismans.talismans.talismans.ZombieResistanceTalisman;
|
||||
import com.willfp.talismans.talismans.talismans.ZombieTalisman;
|
||||
import com.willfp.talismans.talismans.util.TalismanUtils;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -38,6 +40,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
@UtilityClass
|
||||
@SuppressWarnings({"unused", "checkstyle:JavadocVariable"})
|
||||
@@ -80,8 +83,8 @@ public class Talismans {
|
||||
*
|
||||
* @return A list of all {@link Talisman}s.
|
||||
*/
|
||||
public static List<Talisman> values() {
|
||||
return ImmutableList.copyOf(BY_KEY.values());
|
||||
public static Set<Talisman> values() {
|
||||
return ImmutableSet.copyOf(BY_KEY.values());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,19 +92,8 @@ public class Talismans {
|
||||
*
|
||||
* @return A list of all {@link Talisman}s.
|
||||
*/
|
||||
public static List<NamespacedKey> keySet() {
|
||||
return ImmutableList.copyOf(BY_KEY.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get {@link Talisman} matching config name.
|
||||
*
|
||||
* @param configName The config name to search for.
|
||||
* @return The matching {@link Talisman}, or null if not found.
|
||||
*/
|
||||
public static Talisman getByConfig(@NotNull final String configName) {
|
||||
Optional<Talisman> matching = values().stream().filter(talisman -> talisman.getConfigName().equalsIgnoreCase(configName)).findFirst();
|
||||
return matching.orElse(null);
|
||||
public static Set<NamespacedKey> keySet() {
|
||||
return ImmutableSet.copyOf(BY_KEY.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ public class AttackSpeedTalisman extends Talisman {
|
||||
private final Map<TalismanLevel, AttributeModifier> modifiers = new HashMap<>();
|
||||
|
||||
public AttackSpeedTalisman() {
|
||||
super("speed");
|
||||
super("attack_speed");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@ disabled-in-worlds: []
|
||||
|
||||
levels:
|
||||
1:
|
||||
name: "Alchemy Talisman I"
|
||||
name: "&aAlchemy Talisman I"
|
||||
description: 5% chance double the strength of applied potion effects.
|
||||
|
||||
obtaining:
|
||||
@@ -26,4 +26,54 @@ levels:
|
||||
texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTExYTNjZWM3YWFmOTA0MjEyY2NmOTNiYjY3YTNjYWYzZDY0OTc4M2JhOTBiOGI2MGJiNjNjNzY4N2ViMzlmIn19fQ==
|
||||
|
||||
config:
|
||||
chance: 5
|
||||
chance: 5
|
||||
2:
|
||||
name: "&eAlchemy Talisman II"
|
||||
description: 10% chance double the strength of applied potion effects.
|
||||
|
||||
obtaining:
|
||||
craftable: true
|
||||
recipe:
|
||||
- talismans:alchemy_talisman_1
|
||||
- talismans:alchemy_talisman_1
|
||||
- talismans:alchemy_talisman_1
|
||||
|
||||
- talismans:alchemy_talisman_1
|
||||
- heart_of_the_sea
|
||||
- talismans:alchemy_talisman_1
|
||||
|
||||
- talismans:alchemy_talisman_1
|
||||
- talismans:alchemy_talisman_1
|
||||
- talismans:alchemy_talisman_1
|
||||
|
||||
general-config:
|
||||
material: player_head
|
||||
texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZkNzljMDI2ODc0Nzk0MWRmOWEyYTQ1MTAzY2JkNzMxZmRlZGNiYTU4OGY2NDNiNjcwZmQ3N2FhMmJkOTE4YyJ9fX0=
|
||||
|
||||
config:
|
||||
chance: 10
|
||||
3:
|
||||
name: "&cAlchemy Talisman III"
|
||||
description: 25% chance double the strength of applied potion effects.
|
||||
|
||||
obtaining:
|
||||
craftable: true
|
||||
recipe:
|
||||
- talismans:alchemy_talisman_2
|
||||
- talismans:alchemy_talisman_2
|
||||
- talismans:alchemy_talisman_2
|
||||
|
||||
- talismans:alchemy_talisman_2
|
||||
- nether_star
|
||||
- talismans:alchemy_talisman_2
|
||||
|
||||
- talismans:alchemy_talisman_2
|
||||
- talismans:alchemy_talisman_2
|
||||
- talismans:alchemy_talisman_2
|
||||
|
||||
general-config:
|
||||
material: player_head
|
||||
texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDMwOTNhNWI3NzY0MmQ0MDkyMTEyZjQ2ZWE2ODE0MGZiNWFlMDRiYmQyMzFjZGExMDY2YTA0YzE4Yjg5Yzk0ZSJ9fX0=
|
||||
|
||||
config:
|
||||
chance: 25
|
||||
@@ -3,7 +3,7 @@ disabled-in-worlds: [ ]
|
||||
|
||||
levels:
|
||||
1:
|
||||
name: "Archery Talisman I"
|
||||
name: "&aArchery Talisman I"
|
||||
description: Deal 10% more damage with bows.
|
||||
|
||||
obtaining:
|
||||
@@ -26,4 +26,29 @@ levels:
|
||||
texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDBmOGRmYTVlZmM3NTYzMGNlMGRmNDBhNDliOGY1OWJjMjIyMTRkZTk3ZTNmYjQ0YjNjNTZlOGE5YzhhNTZiNiJ9fX0=
|
||||
|
||||
config:
|
||||
percent-more-damage: 10
|
||||
percent-more-damage: 10
|
||||
2:
|
||||
name: "&eArchery Talisman II"
|
||||
description: Deal 25% more damage with bows.
|
||||
|
||||
obtaining:
|
||||
craftable: true
|
||||
recipe:
|
||||
- talismans:archery_talisman_1
|
||||
- talismans:archery_talisman_1
|
||||
- talismans:archery_talisman_1
|
||||
|
||||
- talismans:archery_talisman_1
|
||||
- heart_of_the_sea
|
||||
- talismans:archery_talisman_1
|
||||
|
||||
- talismans:archery_talisman_1
|
||||
- talismans:archery_talisman_1
|
||||
- talismans:archery_talisman_1
|
||||
|
||||
general-config:
|
||||
material: player_head
|
||||
texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDBmOGRmYTVlZmM3NTYzMGNlMGRmNDBhNDliOGY1OWJjMjIyMTRkZTk3ZTNmYjQ0YjNjNTZlOGE5YzhhNTZiNiJ9fX0=
|
||||
|
||||
config:
|
||||
percent-more-damage: 25
|
||||
@@ -3,7 +3,7 @@ disabled-in-worlds: [ ]
|
||||
|
||||
levels:
|
||||
1:
|
||||
name: "Attack Speed Talisman I"
|
||||
name: "&aAttack Speed Talisman I"
|
||||
description: Attack 5% faster.
|
||||
|
||||
obtaining:
|
||||
@@ -3,7 +3,7 @@ disabled-in-worlds: [ ]
|
||||
|
||||
levels:
|
||||
1:
|
||||
name: "Boss Talisman I"
|
||||
name: "&aBoss Talisman I"
|
||||
description: Deal 10% more damage to bosses.
|
||||
|
||||
obtaining:
|
||||
|
||||
@@ -3,7 +3,7 @@ disabled-in-worlds: [ ]
|
||||
|
||||
levels:
|
||||
1:
|
||||
name: "Creeper Talisman I"
|
||||
name: "&aCreeper Talisman I"
|
||||
description: Deal 10% more damage to creepers.
|
||||
|
||||
obtaining:
|
||||
|
||||
@@ -3,7 +3,7 @@ disabled-in-worlds: [ ]
|
||||
|
||||
levels:
|
||||
1:
|
||||
name: "End Talisman I"
|
||||
name: "&aEnd Talisman I"
|
||||
description: Deal 10% more damage in the end.
|
||||
|
||||
obtaining:
|
||||
|
||||
@@ -3,7 +3,7 @@ disabled-in-worlds: [ ]
|
||||
|
||||
levels:
|
||||
1:
|
||||
name: "Experience Talisman I"
|
||||
name: "&aExperience Talisman I"
|
||||
description: Gain 10% more experience.
|
||||
|
||||
obtaining:
|
||||
|
||||
@@ -3,7 +3,7 @@ disabled-in-worlds: [ ]
|
||||
|
||||
levels:
|
||||
1:
|
||||
name: "Extraction Talisman I"
|
||||
name: "&aExtraction Talisman I"
|
||||
description: 2% chance to get xp randomly while mining.
|
||||
|
||||
obtaining:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 2.0.2
|
||||
version = 3.0.0
|
||||
plugin-name = Talismans
|
||||
Reference in New Issue
Block a user