Skip to content

Commit ab6e7e5

Browse files
Fix giveCharm autocomplete, give charm remover model data, and make
charm name on item non-italicized
1 parent 669eafb commit ab6e7e5

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88

99
group = 'org.parallelmc'
1010

11-
version = '2.5.0'
11+
version = '2.5.2'
1212
description = 'A set of utilities and features for use on the Parallel Minecraft server'
1313

1414
java {

src/main/java/parallelmc/parallelutils/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class Constants {
44

5-
public static final Version VERSION = new Version(2, 5, 0);
5+
public static final Version VERSION = new Version(2, 5, 2);
66
public static final String PLUGIN_NAME = "ParallelUtils";
77
public static final String DEFAULT_WORLD = "world2";
88
}

src/main/java/parallelmc/parallelutils/modules/charms/commands/GiveCharm.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.Collections;
1818
import java.util.HashMap;
1919
import java.util.List;
20+
import java.util.stream.Collectors;
2021

2122
public class GiveCharm extends ParallelCommand {
2223

@@ -92,6 +93,7 @@ public boolean execute(@NotNull CommandSender sender, @NotNull Command command,
9293
@Override
9394
public List<String> getTabComplete(@NotNull CommandSender sender, @NotNull String[] args) {
9495
if (args.length == 2) {
96+
String currVal = args[1];
9597
List<String> charmsNoSpaces = new ArrayList<>();
9698
// First all names that are online, then charms noSpaces
9799

@@ -103,9 +105,10 @@ public List<String> getTabComplete(@NotNull CommandSender sender, @NotNull Strin
103105
if (s.contains(" ")) continue;
104106
charmsNoSpaces.add(s);
105107
}
106-
return charmsNoSpaces;
108+
return charmsNoSpaces.stream().filter(x -> x.startsWith(currVal)).collect(Collectors.toList());
107109
} else if (args.length == 3) {
108-
return List.copyOf(options.keySet());
110+
String currVal = args[2];
111+
return List.copyOf(options.keySet()).stream().filter(x -> x.startsWith(currVal)).collect(Collectors.toList());
109112
}
110113

111114
return null;

src/main/java/parallelmc/parallelutils/modules/charms/commands/GiveRemover.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public boolean execute(@NotNull CommandSender sender, @NotNull Command command,
5454
if (meta == null) return false;
5555

5656
meta.displayName(MiniMessage.miniMessage().deserialize("<italic:false><yellow>Charm Remover"));
57+
meta.setCustomModelData(1000000);
5758

5859
PersistentDataContainer pdc = meta.getPersistentDataContainer();
5960

src/main/java/parallelmc/parallelutils/modules/charms/data/Charm.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
77
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
88
import org.bukkit.Bukkit;
9+
import org.bukkit.Material;
910
import org.bukkit.NamespacedKey;
1011
import org.bukkit.entity.Player;
1112
import org.bukkit.event.Event;
@@ -104,7 +105,7 @@ public boolean apply(ItemStack item, Player player, boolean startRunnables, bool
104105
List<Component> lore = meta.lore();
105106
if (lore == null) lore = new ArrayList<>();
106107

107-
lore.add(MiniMessage.miniMessage().deserialize("<aqua>Charm: " + options.getName()));
108+
lore.add(MiniMessage.miniMessage().deserialize("<italic:false><aqua>Charm: " + options.getName()));
108109
meta.lore(lore);
109110

110111
PersistentDataContainer pdc = meta.getPersistentDataContainer();

0 commit comments

Comments
 (0)