Skip to content

Commit

Permalink
Remove ASCII and fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
iiAhmedYT committed May 15, 2024
1 parent c9ae38b commit ac92f8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
6 changes: 2 additions & 4 deletions src/main/java/to/itsme/itsmyconfig/ItsMyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import to.itsme.itsmyconfig.progress.ProgressBar;
import to.itsme.itsmyconfig.progress.ProgressBarBucket;
import to.itsme.itsmyconfig.requirement.RequirementManager;
import to.itsme.itsmyconfig.util.Utilities;

/**
* ItsMyConfig class represents the main configuration class for the plugin.
Expand All @@ -30,7 +29,6 @@
public final class ItsMyConfig extends JavaPlugin {

private static final boolean ALLOW_ITEM_EDITS = false;
private static final String HYPHEN = "#########################################################";

private static ItsMyConfig instance;
private final PlaceholderManager placeholderManager = new PlaceholderManager();
Expand All @@ -46,7 +44,7 @@ public static ItsMyConfig getInstance() {

@Override
public void onEnable() {
this.getLogger().info("\n\n" + HYPHEN + "\n" + Utilities.getACSIIArt() + "\nLoading ItsMyConfig...");
this.getLogger().info("Loading ItsMyConfig...");
final long start = System.currentTimeMillis();
instance = this;
new DynamicPlaceHolder(this, progressBarBucket).register();
Expand All @@ -66,7 +64,7 @@ public void onEnable() {
protocolManager.addPacketListener(new PacketItemListener(this));
}

this.getLogger().info("ItsMyConfig loaded in " + (System.currentTimeMillis() - start) + "ms\n" + HYPHEN + "\n\n");
this.getLogger().info("ItsMyConfig loaded in " + (System.currentTimeMillis() - start) + "ms");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ public HoverEvent deserialize(
default:
if (element.isJsonPrimitive()) {
event.value = new TextfulComponent(element.getAsString());
} else if (element.isJsonArray() || element.isJsonObject()) {
} else if (element.isJsonArray()) {
event.value = context.deserialize(element.getAsJsonArray().get(0), TextfulComponent.class);
} else if (element.isJsonObject()) {
event.value = context.deserialize(element, TextfulComponent.class);
}
return event;
Expand Down
21 changes: 5 additions & 16 deletions src/main/java/to/itsme/itsmyconfig/util/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,16 @@ private static Component fixClickEvent(final Component component) {
* @return A List of Integer containing the extracted integer arguments.
*/
public static List<Integer> getArguments(final String string) {
if (string == null || string.isEmpty()) {
return Collections.emptyList();
}

final List<Integer> args = new ArrayList<>();
final Matcher matcher = ARGUMENT_PATTERN.matcher(string);
while (matcher.find()) {
args.add(Integer.parseInt(matcher.group(1)));
}

return args;
}

Expand Down Expand Up @@ -529,22 +534,6 @@ public static String toString(final @NotNull List<?> list) {
return String.join(System.lineSeparator(), list.stream().map(Object::toString).toArray(String[]::new));
}

/**
* Retrieves ASCII art representing the text "ItsMyConfig".
* This method returns ASCII art as a string representing the text "ItsMyConfig" in a stylized format.
*
* @return a string containing ASCII art representing the text "ItsMyConfig".
*/
public static String getACSIIArt() {
return " ___ _ __ __ ____ __ _ \n" +
" |_ _| |_ ___| \\/ |_ _ / ___|___ _ __ / _(_) __ _ \n" +
" | || __/ __| |\\/| | | | | | / _ \\| '_ \\| |_| |/ _` |\n" +
" | || |_\\__ \\ | | | |_| | |__| (_) | | | | _| | (_| |\n" +
" |___|\\__|___/_| |_|\\__, |\\____\\___/|_| |_|_| |_|\\__, |\n" +
" |___/ |___/ \n" +
"\n";
}

/**
* Helper method to create Title times with optional values.
*
Expand Down

0 comments on commit ac92f8e

Please sign in to comment.