mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 02:19:05 +00:00
Cleanup format API function calls to allow for easier usage.
This commit is contained in:
parent
a84e00aec1
commit
96edb124f0
@ -110,7 +110,6 @@ import org.bukkit.Sound;
|
|||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
|
|
||||||
@ -747,8 +746,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String json = Format.formatModerationGUI(globalJSON, p.getPlayer(), senderName, chatchannel, hash);
|
String json = Format.formatModerationGUI(globalJSON, p.getPlayer(), senderName, chatchannel, hash);
|
||||||
WrappedChatComponent chatComponent = WrappedChatComponent.fromJson(json);
|
PacketContainer packet = Format.createPacketPlayOutChat(json);
|
||||||
PacketContainer packet = Format.createPacketPlayOutChat(chatComponent);
|
|
||||||
|
|
||||||
if(this.getConfig().getBoolean("ignorechat", false)) {
|
if(this.getConfig().getBoolean("ignorechat", false)) {
|
||||||
if(!p.getIgnores().contains(senderUUID)) {
|
if(!p.getIgnores().contains(senderUUID)) {
|
||||||
|
@ -20,7 +20,7 @@ import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|||||||
import mineverse.Aust1n46.chat.utilities.Format;
|
import mineverse.Aust1n46.chat.utilities.Format;
|
||||||
|
|
||||||
public class Edit extends MineverseCommand {
|
public class Edit extends MineverseCommand {
|
||||||
private PacketContainer emptyLinePacketContainer = Format.createPacketPlayOutChat(WrappedChatComponent.fromJson("{\"extra\":[\" \"],\"text\":\"\"}"));
|
private PacketContainer emptyLinePacketContainer = Format.createPacketPlayOutChat("{\"extra\":[\" \"],\"text\":\"\"}");
|
||||||
private MineverseChat plugin = MineverseChat.getInstance();
|
private MineverseChat plugin = MineverseChat.getInstance();
|
||||||
private WrappedChatComponent messageDeletedComponentPlayer;
|
private WrappedChatComponent messageDeletedComponentPlayer;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
|
|
||||||
public class Removemessage extends MineverseCommand {
|
public class Removemessage extends MineverseCommand {
|
||||||
private PacketContainer emptyLinePacketContainer = Format.createPacketPlayOutChat(WrappedChatComponent.fromJson("{\"extra\":[\" \"],\"text\":\"\"}"));
|
private PacketContainer emptyLinePacketContainer = Format.createPacketPlayOutChat("{\"extra\":[\" \"],\"text\":\"\"}");
|
||||||
private MineverseChat plugin = MineverseChat.getInstance();
|
private MineverseChat plugin = MineverseChat.getInstance();
|
||||||
private WrappedChatComponent messageDeletedComponentPlayer;
|
private WrappedChatComponent messageDeletedComponentPlayer;
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
@ -501,8 +500,7 @@ public class ChatListener implements Listener {
|
|||||||
}
|
}
|
||||||
for(Player p : recipients) {
|
for(Player p : recipients) {
|
||||||
String json = Format.formatModerationGUI(globalJSON, p, mcp.getName(), channel.getName(), hash);
|
String json = Format.formatModerationGUI(globalJSON, p, mcp.getName(), channel.getName(), hash);
|
||||||
WrappedChatComponent chatComponent = WrappedChatComponent.fromJson(json);
|
PacketContainer packet = Format.createPacketPlayOutChat(json);
|
||||||
PacketContainer packet = Format.createPacketPlayOutChat(chatComponent);
|
|
||||||
Format.sendPacketPlayOutChat(p, packet);
|
Format.sendPacketPlayOutChat(p, packet);
|
||||||
}
|
}
|
||||||
Bukkit.getConsoleSender().sendMessage(consoleChat);
|
Bukkit.getConsoleSender().sendMessage(consoleChat);
|
||||||
|
@ -124,7 +124,7 @@ public class Format {
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String convertLinks(String s) {
|
public static String convertLinks(String s) {
|
||||||
String remaining = s;
|
String remaining = s;
|
||||||
String temp = "";
|
String temp = "";
|
||||||
int indexLink = -1;
|
int indexLink = -1;
|
||||||
@ -294,6 +294,14 @@ public class Format {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PacketContainer createPacketPlayOutChat(String json) {
|
||||||
|
WrappedChatComponent component = WrappedChatComponent.fromJson(json);
|
||||||
|
PacketContainer container = new PacketContainer(PacketType.Play.Server.CHAT);
|
||||||
|
container.getModifier().writeDefaults();
|
||||||
|
container.getChatComponents().write(0, component);
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
public static PacketContainer createPacketPlayOutChat(WrappedChatComponent component) {
|
public static PacketContainer createPacketPlayOutChat(WrappedChatComponent component) {
|
||||||
PacketContainer container = new PacketContainer(PacketType.Play.Server.CHAT);
|
PacketContainer container = new PacketContainer(PacketType.Play.Server.CHAT);
|
||||||
container.getModifier().writeDefaults();
|
container.getModifier().writeDefaults();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user