mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-10-06 04:22:24 +00:00
implement json format changes for 1.21.5
update deps, update message sound and safety wrap it
This commit is contained in:
parent
d964918a7b
commit
c456640e5a
52
pom.xml
52
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>mineverse.Aust1n46.chat</groupId>
|
||||
<artifactId>VentureChat</artifactId>
|
||||
<version>3.7.2</version>
|
||||
<version>3.8.0</version>
|
||||
<url>https://bitbucket.org/Aust1n46/venturechat/src/master</url>
|
||||
<scm>
|
||||
<url>https://bitbucket.org/Aust1n46/venturechat/src/master</url>
|
||||
@ -30,10 +30,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -56,7 +56,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<version>3.4.1</version>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
@ -91,22 +91,10 @@
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>essentialsx-repo</id>
|
||||
<url>https://repo.essentialsx.net/releases/</url>
|
||||
@ -117,14 +105,14 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -134,10 +122,9 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<groupId>com.github.placeholderapi</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.10.9</version>
|
||||
<scope>provided</scope>
|
||||
<version>2.11.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
@ -152,9 +139,9 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<groupId>net.dmulloy2</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
<version>5.4.0</version>
|
||||
</dependency>
|
||||
<!--These are long depreciated. I would've removed them, but that is outside the scope of what I want to do here.
|
||||
I am using the latest builds of these plugins to be published to SpigotMC.-->
|
||||
@ -216,11 +203,22 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-api</artifactId>
|
||||
<version>4.24.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.4.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
@ -10,10 +10,9 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@ -134,14 +133,14 @@ public class Format {
|
||||
} else {
|
||||
final String clickText = escapeJsonChars(Format.FormatStringAll(
|
||||
PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), jsonAttribute.getClickText())));
|
||||
actionJson = ",\"clickEvent\":{\"action\":\"" + jsonAttribute.getClickAction().toString() + "\",\"value\":\"" + clickText
|
||||
actionJson = ",\"click_event\":{\"action\":\"" + jsonAttribute.getClickAction().toString() + "\",\"command\":\"" + clickText
|
||||
+ "\"}";
|
||||
}
|
||||
final String hoverJson;
|
||||
if (hoverText.isEmpty()) {
|
||||
hoverJson = StringUtils.EMPTY;
|
||||
} else {
|
||||
hoverJson = ",\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
||||
hoverJson = ",\"hover_event\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
||||
+ convertToJsonColors(hoverText) + "]}}";
|
||||
}
|
||||
temp += convertToJsonColors(lastCode + formattedPlaceholder, actionJson + hoverJson) + ",";
|
||||
@ -191,9 +190,9 @@ public class Format {
|
||||
https = "s";
|
||||
temp += convertToJsonColors(lastCode + link,
|
||||
",\"underlined\":" + underlineURLs()
|
||||
+ ",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http" + https + "://"
|
||||
+ ",\"click_event\":{\"action\":\"open_url\",\"url\":\"http" + https + "://"
|
||||
+ ChatColor.stripColor(link.replace("http://", "").replace("https://", ""))
|
||||
+ "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
||||
+ "\"},\"hover_event\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
||||
+ convertToJsonColors(lastCode + link) + "]}}")
|
||||
+ ",";
|
||||
lastCode = getLastCode(lastCode + link);
|
||||
@ -455,9 +454,9 @@ public class Format {
|
||||
if (player.hasPermission("venturechat.gui")) {
|
||||
json = json.substring(0, json.length() - 1);
|
||||
json += "," + Format.convertToJsonColors(Format.FormatStringAll(getInstance().getConfig().getString("guiicon")),
|
||||
",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/vchatgui " + sender + " " + channelName
|
||||
",\"click_event\":{\"action\":\"run_command\",\"command\":\"/vchatgui " + sender + " " + channelName
|
||||
+ " " + hash
|
||||
+ "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
||||
+ "\"},\"hover_event\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
||||
+ Format.convertToJsonColors(
|
||||
Format.FormatStringAll(getInstance().getConfig().getString("guitext")))
|
||||
+ "]}}")
|
||||
@ -961,14 +960,22 @@ public class Format {
|
||||
Player player = mcp.getPlayer();
|
||||
String soundName = getInstance().getConfig().getString("message_sound", DEFAULT_MESSAGE_SOUND);
|
||||
if (!soundName.equalsIgnoreCase("None")) {
|
||||
try {
|
||||
Sound messageSound = getSound(soundName);
|
||||
player.playSound(player.getLocation(), messageSound, 1, 0);
|
||||
} catch (final Exception e) {
|
||||
if (MineverseChat.getInstance().getConfig().getString("loglevel", "info").equals("debug")) {
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - Error playing sound, defaulting to none"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Sound getSound(String soundName) {
|
||||
if(Arrays.asList(Sound.values()).stream().map(Sound::toString).collect(Collectors.toList()).contains(soundName)) {
|
||||
return Sound.valueOf(soundName);
|
||||
for (Sound sound : Sound.values()) {
|
||||
if (sound.toString().equalsIgnoreCase(soundName)) {
|
||||
return sound;
|
||||
}
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - Message sound invalid!"));
|
||||
return getDefaultMessageSound();
|
||||
|
Loading…
x
Reference in New Issue
Block a user