Merge branch 'development'

This commit is contained in:
Brianna 2020-11-09 12:45:46 -06:00
commit 79173d3567
22 changed files with 33 additions and 25 deletions

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../</relativePath>
</parent>

View File

@ -54,7 +54,7 @@ public class SongodaCore {
/**
* This has been added as of Rev 6
*/
private final static String coreVersion = "2.4.22";
private final static String coreVersion = "2.4.23";
/**
* This is specific to the website api

View File

@ -31,6 +31,10 @@ public class ChatMessage {
}
public ChatMessage fromText(String text) {
return fromText(text, false);
}
public ChatMessage fromText(String text, boolean noHex) {
Pattern pattern = Pattern.compile("(.*?)(?!&(o|m|n|l|k))(?=(\\&(1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|r|#)|$)|"
+ "#([a-f]|[A-F]|[0-9]){6})", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(text);
@ -44,7 +48,7 @@ public class ChatMessage {
colorChar = text.substring(matcher.start() - 1, matcher.start()).charAt(0);
if (colorChar != '-') {
if (colorChar == '#') {
color = new ColorContainer(match1.substring(0, 6));
color = new ColorContainer(match1.substring(0, 6), noHex);
match1 = match1.substring(5);
} else if (colorChar == '&')
color = new ColorContainer(ColorCode.getByChar(match1.charAt(0)));
@ -69,13 +73,17 @@ public class ChatMessage {
}
public String toText() {
return toText(false);
}
public String toText(boolean noHex) {
StringBuilder text = new StringBuilder();
for (JsonObject object : textList) {
if (object.has("color")) {
String color = object.get("color").getAsString();
text.append("&");
if (color.length() == 7) {
text.append(new ColorContainer(color).getColor().getCode());
text.append(new ColorContainer(color, noHex).getColor().getCode());
} else {
text.append(ColorCode.valueOf(color.toUpperCase()).getCode());
}
@ -191,7 +199,7 @@ public class ChatMessage {
enabled = false;
}
} else {
sender.sendMessage(TextUtils.formatText((prefix == null ? "" : prefix.toText() + " ") + toText()));
sender.sendMessage(TextUtils.formatText((prefix == null ? "" : prefix.toText(true) + " ") + toText(true)));
}
}

View File

@ -15,9 +15,9 @@ public class ColorContainer {
this.hexCode = null;
}
public ColorContainer(String hexCode) {
public ColorContainer(String hexCode, boolean noHex) {
this.hexCode = hexCode;
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_16)) {
if (noHex || ServerVersion.isServerVersionBelow(ServerVersion.V1_16)) {
this.colorCode = getColor();
this.hexCode = null;
}

View File

@ -59,7 +59,7 @@ public class MainCommand extends AbstractCommand {
sender.sendMessage(header);
} else {
new ChatMessage().fromText(String.format("#ff8080&l%s &8» &7Version %s Created with <3 by #ec4e74&l&oS#fa5b65&l&oo#ff6c55&l&on#ff7f44&l&og#ff9432&l&oo#ffaa1e&l&od#f4c009&l&oa",
plugin.getDescription().getName(), plugin.getDescription().getVersion()))
plugin.getDescription().getName(), plugin.getDescription().getVersion()), true)
.sendTo(sender);
}

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.22</version>
<version>2.4.23</version>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>