Skip to content

Commit

Permalink
MiniText from paperMC
Browse files Browse the repository at this point in the history
  • Loading branch information
divios committed Jan 13, 2022
1 parent f087a71 commit 3a13ba5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
apply plugin: 'maven-publish'

group = 'io.github.divios'
version = '2.4'
version = '3.0'

sourceCompatibility = 1.8 // java 8
targetCompatibility = 1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,27 @@ public class miniTextParser {
private static MiniMessage builder;

public miniTextParser() {
builder = MiniMessage.miniMessage();
if (adventureIsInstalled())
builder = MiniMessage.miniMessage();
}

public String parse(final String s) {
if (!adventureIsInstalled()) return s;
if (builder != null) return s;
return LegacyComponentSerializer.legacyAmpersand().serialize(
builder.parse(s));
}

public String unParse(final String s) {
if (!adventureIsInstalled()) return null;
if (builder != null) return null;
return null;
}

private boolean adventureIsInstalled() {
try {
Class.forName("net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer");
} catch (ClassNotFoundException e) {
System.out.println("Adventure not found");
return false;
}
System.out.println("Adventure found");
return true;
}

Expand Down

0 comments on commit 3a13ba5

Please sign in to comment.