support for discord 1.22
This commit is contained in:
parent
dad91c24d9
commit
4bbbcafa1f
12
pom.xml
12
pom.xml
|
@ -24,6 +24,12 @@
|
|||
<url>http://repo.chrisnaude.com/</url>
|
||||
</repository>
|
||||
|
||||
<!-- DiscordSRV -->
|
||||
<repository>
|
||||
<id>Scarsz-Nexus</id>
|
||||
<url>https://nexus.scarsz.me/content/groups/public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>sonatype-nexus-public</id>
|
||||
<name>SonaType public snapshots and releases repository</name>
|
||||
|
@ -418,9 +424,9 @@
|
|||
|
||||
<!-- DiscordSRV -->
|
||||
<dependency>
|
||||
<groupId>com.cnaude.discordsrv</groupId>
|
||||
<artifactId>DiscordSRV</artifactId>
|
||||
<version>1.18.4</version>
|
||||
<groupId>com.discordsrv</groupId>
|
||||
<artifactId>discordsrv</artifactId>
|
||||
<version>1.22.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.pircbotx.User;
|
||||
import github.scarsz.discordsrv.objects.MessageFormat;
|
||||
|
||||
/**
|
||||
* Main class containing all message template token expanding methods
|
||||
|
@ -497,27 +498,17 @@ public class ChatTokenizer {
|
|||
* @return
|
||||
*/
|
||||
public String discordChatToIRCTokenizer(String template, String username, String nickname, String effectiveName, Color color, String discordChannel, String message) {
|
||||
String hex = color != null ? Integer.toHexString(color.getRGB()).toUpperCase() : "99AAB5";
|
||||
if (hex.length() == 8) {
|
||||
hex = hex.substring(2);
|
||||
}
|
||||
// String hex = color != null ? Integer.toHexString(color.getRGB()).toUpperCase() : "99AAB5";
|
||||
// if (hex.length() == 8) {
|
||||
// hex = hex.substring(2);
|
||||
// }
|
||||
if (nickname == null) {
|
||||
nickname = "";
|
||||
}
|
||||
if (effectiveName == null) {
|
||||
effectiveName = "";
|
||||
}
|
||||
String translatedColor = DiscordSRV.getPlugin().getColors().get(hex);
|
||||
String colorCode;
|
||||
try {
|
||||
colorCode = ChatColor.translateAlternateColorCodes('&', translatedColor);
|
||||
} catch (Exception ex) {
|
||||
colorCode = "";
|
||||
plugin.logDebug(ex.getMessage());
|
||||
}
|
||||
if (colorCode == null) {
|
||||
colorCode = "";
|
||||
}
|
||||
String colorCode = "";
|
||||
return plugin.colorConverter.gameColorsToIrc(template
|
||||
.replace("%NAME%", username)
|
||||
.replace("%NICKNAME%", nickname)
|
||||
|
|
Loading…
Reference in New Issue