Skip to content

Commit 891d375

Browse files
committed
removed redundant TextUtil
1 parent 94e1e9e commit 891d375

File tree

4 files changed

+14
-67
lines changed

4 files changed

+14
-67
lines changed

src/main/java/net/azalealibrary/configuration/ConfigureCommand.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import net.azalealibrary.command.CommandNode;
66
import net.azalealibrary.command.TextUtil;
77
import net.azalealibrary.configuration.property.ConfigurableProperty;
8-
import net.azalealibrary.configuration.property.ListProperty;
98
import org.bukkit.ChatColor;
109
import org.bukkit.command.CommandSender;
1110

@@ -74,12 +73,10 @@ public void execute(CommandSender sender, Arguments arguments) {
7473
}
7574
case INFO -> {
7675
ConfigurableProperty<?, ?> property = properties.get(0);
76+
7777
List<String> info = new ArrayList<>();
78-
String type = property.getType().getExpected() + (property instanceof ListProperty<?> ? " (list)" : "");
79-
info.add("Property: " + ChatColor.LIGHT_PURPLE + property.getName() + ChatColor.RESET + " " + type);
80-
info.add("Default: " + ChatColor.AQUA + property.getDefault());
81-
info.add("Value: " + ChatColor.YELLOW + property);
82-
property.getDescription().forEach(l -> info.addAll(TextUtil.split(l, 55).stream().map(i -> " " + i).toList()));
78+
info.add(ChatColor.LIGHT_PURPLE + property.getName() + ChatColor.RESET + "=" + ChatColor.YELLOW + property);
79+
property.getDescription().forEach(l -> info.addAll(TextUtil.split(l, 55).stream().map(i -> ChatColor.GRAY + " " + i).toList()));
8380
sender.sendMessage(info.toArray(String[]::new));
8481
}
8582
}

src/main/java/net/azalealibrary/configuration/FileConfiguration.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package net.azalealibrary.configuration;
22

3+
import net.azalealibrary.command.TextUtil;
34
import net.azalealibrary.configuration.property.ConfigurableProperty;
5+
import net.azalealibrary.configuration.property.ListProperty;
46
import org.bukkit.configuration.file.YamlConfiguration;
57
import org.bukkit.plugin.Plugin;
68

79
import java.io.File;
10+
import java.util.ArrayList;
811
import java.util.List;
912
import java.util.logging.Level;
1013

@@ -50,7 +53,11 @@ public void save(Configurable configurable) {
5053

5154
for (ConfigurableProperty<?, ?> property : configurable.getProperties()) {
5255
property.serialize(configuration);
53-
List<String> comments = TextUtil.getYamlInfo(property, 80).stream().toList();
56+
List<String> comments = new ArrayList<>();
57+
String type = property.getType().getExpected() + (property instanceof ListProperty<?> ? " (list)" : "");
58+
comments.add("Property: " + property.getName() + " of " + type);
59+
comments.add("Default: " + property.getDefault());
60+
property.getDescription().forEach(l -> comments.addAll(TextUtil.split(l, 55).stream().map(i -> " " + i).toList()));
5461
configuration.setComments(property.getName(), comments);
5562
}
5663
configuration.save(file);

src/main/java/net/azalealibrary/configuration/TextUtil.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/main/java/net/azalealibrary/configuration/property/ConfigurableProperty.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ public abstract class ConfigurableProperty<T, P> {
1818
protected final List<AssignmentPolicy<T>> policies;
1919
protected final String name;
2020
protected final Consumer<P> callback;
21-
private final String description;
21+
private final List<String> description;
2222
private final Supplier<P> defaultValue;
2323
private @Nullable P value;
2424

25-
protected ConfigurableProperty(PropertyType<T> type, Supplier<P> defaultValue, String name, String description, Consumer<P> callback, List<AssignmentPolicy<T>> policies) {
25+
protected ConfigurableProperty(PropertyType<T> type, Supplier<P> defaultValue, String name, List<String> description, Consumer<P> callback, List<AssignmentPolicy<T>> policies) {
2626
this.type = type;
2727
this.name = name;
2828
this.description = description;
@@ -40,7 +40,7 @@ public String getName() {
4040
return name;
4141
}
4242

43-
public String getDescription() {
43+
public List<String> getDescription() {
4444
return description;
4545
}
4646

0 commit comments

Comments
 (0)