Skip to content

Commit

Permalink
d6
Browse files Browse the repository at this point in the history
  • Loading branch information
boiscljo committed Sep 23, 2023
1 parent 83ca8c7 commit 55e37ea
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SBA_VERSION=1.5.11-dev5-pr28
SBA_VERSION=1.5.11-dev6-pr28
PAPER_LEGACY_VERSION=1.16.5
BEDWARS_VERSION=0.2.30-SNAPSHOT
CLOUD_COMMANDS_VERSION=1.6.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.FilenameFilter;

import org.bukkit.enchantments.Enchantment;
import org.screamingsandals.lib.item.meta.EnchantmentType;

import io.github.pronze.sba.SBA;
import io.github.pronze.sba.config.SBAConfig;
Expand Down Expand Up @@ -64,7 +65,7 @@ public void fix(SBAConfig cfg) {

try{
for (Enchantment values : Enchantment.values()) {
shopReplace(values.getName()+":", values.getKey().getKey()+":");
shopReplace(values.getName()+":", EnchantmentType.of(values).location().path()+":");
}
}
catch(Throwable t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.screamingsandals.bedwars.api.game.ItemSpawnerType;
import org.screamingsandals.bedwars.game.GameStore;
import org.screamingsandals.lib.item.builder.ItemStackFactory;
import org.screamingsandals.lib.item.meta.EnchantmentType;
import org.screamingsandals.lib.player.Players;
import org.screamingsandals.lib.plugin.ServiceManager;
import org.screamingsandals.lib.utils.ConfigurateUtils;
Expand Down Expand Up @@ -610,7 +611,9 @@ public Map.Entry<Boolean, Boolean> handlePurchase(Player player, AtomicReference
break;
default:
if (Arrays.stream(Enchantment.values())
.anyMatch(x -> x.getName().equalsIgnoreCase(propertyName))) {
.anyMatch(x -> x.getName().equalsIgnoreCase(propertyName)
||EnchantmentType.of(x).location().path().equalsIgnoreCase(propertyName)
)) {

if (isAdd) {
team.getConnectedPlayers().forEach(teamPlayer -> {
Expand All @@ -620,7 +623,7 @@ public Map.Entry<Boolean, Boolean> handlePurchase(Player player, AtomicReference
.replace("%player%", player.getDisplayName() + ChatColor.RESET)
.send(Players.wrapPlayer(teamPlayer));
Optional<Enchantment> ech = Arrays.stream(Enchantment.values())
.filter(x -> x.getName().equalsIgnoreCase(propertyName))
.filter(x -> x.getName().equalsIgnoreCase(propertyName)||EnchantmentType.of(x).location().path().equalsIgnoreCase(propertyName))
.findAny();

Arrays.stream(teamPlayer.getInventory().getContents())
Expand Down
8 changes: 5 additions & 3 deletions plugin/src/main/java/io/github/pronze/sba/utils/ShopUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import io.github.pronze.sba.lib.lang.LanguageService;
import io.github.pronze.sba.service.PlayerWrapperService;
import io.github.pronze.sba.wrapper.SBAPlayerWrapper;

import org.screamingsandals.lib.item.meta.EnchantmentType;
import org.screamingsandals.lib.player.Players;
import org.screamingsandals.lib.spectator.Component;

Expand Down Expand Up @@ -181,7 +183,7 @@ public static ItemStack applyTeamEnchants(Player player, ItemStack newItem) {
List<String> ignoredKeys = List.of("sharpness", "knockback", "protection", "efficiency");
SBAConfig.getInstance().upgrades().enchants().keys().forEach(ench -> {
Optional<Enchantment> ec = Arrays.stream(Enchantment.values())
.filter(x -> x.getName().equalsIgnoreCase(ench))
.filter(x -> x.getName().equalsIgnoreCase(ench)||EnchantmentType.of(x).location().path().equalsIgnoreCase(ench))
.findFirst();
if (ignoredKeys.contains(ench))
return;
Expand Down Expand Up @@ -234,7 +236,7 @@ public static org.screamingsandals.lib.item.ItemStack applyTeamEnchants(Player p
List<String> ignoredKeys = List.of("sharpness", "knockback", "protection", "efficiency");
for (String ench : SBAConfig.getInstance().upgrades().enchants().keys()) {
Optional<Enchantment> ec = Arrays.stream(Enchantment.values())
.filter(x -> x.getName().equalsIgnoreCase(ench))
.filter(x -> x.getName().equalsIgnoreCase(ench)||EnchantmentType.of(x).location().path().equalsIgnoreCase(ench))
.findFirst();
if (ignoredKeys.contains(ench))
continue;
Expand Down Expand Up @@ -299,7 +301,7 @@ private static String getName(Enchantment ech) {
AtomicReference<String> str = new AtomicReference<>();
SBAConfig.getInstance().upgrades().enchants().keys().forEach(ench -> {
Optional<Enchantment> ec = Arrays.stream(Enchantment.values())
.filter(x -> x.getName().equalsIgnoreCase(ench))
.filter(x -> x.getName().equalsIgnoreCase(ench)||EnchantmentType.of(x).location().path().equalsIgnoreCase(ench))
.findFirst();
if (ec.isPresent() && ec.get().equals(ech))
str.set(ench);
Expand Down

0 comments on commit 55e37ea

Please sign in to comment.