mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 02:19:05 +00:00
Updated message remover to work in 1.12 (and hopefully beyond)
This commit is contained in:
parent
c6c4694056
commit
28139c5fd8
17
.classpath
Normal file
17
.classpath
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="MineverseChat"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.11.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/plugins/Vault.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/plugins/PlaceholderAPI.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.8.8-R0.1-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/MineverseChat Dependencies/Factions-2.7.3/Factions-2.7.3/Factions.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/MineverseChat Dependencies/Factions-2.7.3/Factions-2.7.3/MassiveCore.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/MineverseChat Dependencies/Upload/Plugins/Towny.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/MineverseChat Dependencies/BungeeCord.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/MineverseChat Dependencies/Upload/Plugins/Heroes.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/MineverseChat Dependencies/pircbotx-2.0.1.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/plugins/ProtocolLib.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/bin/
|
17
.project
Normal file
17
.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>venturechat</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,4 +1,4 @@
|
||||
name: VentureChat
|
||||
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
|
||||
version: 2.11.1
|
||||
version: 2.12.0
|
||||
author: Aust1n46
|
@ -136,6 +136,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
public static String lastJson;
|
||||
public static Method messageMethod;
|
||||
public static Field posField;
|
||||
public static Class chatMessageType;
|
||||
private static Field commandMap;
|
||||
private static Field knownCommands;
|
||||
|
||||
@ -418,6 +419,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.quickchat = false;
|
||||
if(cmap == null) {
|
||||
this.quickchat = false;
|
||||
// log.info(String.format("[" + String.format("VentureChat" + "]" +
|
||||
@ -429,6 +431,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
// getDescription().getName())));
|
||||
}
|
||||
else {
|
||||
/*Don't run this code right now
|
||||
for(ChatChannel c : ccInfo.getChannelsInfo()) {
|
||||
CCommand cmd = new CCommand(c.getAlias());
|
||||
cmap.register("", cmd);
|
||||
@ -440,6 +443,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Registering Alias commands"));
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Registering Quickchat commands"));
|
||||
*/
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Establishing BungeeCord"));
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "VentureChat");
|
||||
@ -597,9 +601,28 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
catch(SecurityException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
MineverseChat.chatMessageType = getNMSClass("ChatMessageType");
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Class<?> getNMSClass(String name) {
|
||||
try {
|
||||
return Class.forName("net.minecraft.server." + getVersion() + "." + name);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String getVersion() {
|
||||
return Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||
}
|
||||
|
||||
private boolean setupPermissions() {
|
||||
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
|
||||
if(permissionProvider != null) {
|
||||
|
@ -21,6 +21,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.ChatType;
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
|
||||
public class Removemessage extends MineverseCommand {
|
||||
@ -147,6 +148,7 @@ public class Removemessage extends MineverseCommand {
|
||||
for(Player p : packets.keySet()) {
|
||||
List<PacketContainer> pPackets = packets.get(p);
|
||||
for(PacketContainer c : pPackets) {
|
||||
//System.out.println("test packet send");
|
||||
Removemessage.this.sendPacketPlayOutChat(p, c);
|
||||
}
|
||||
}
|
||||
@ -159,6 +161,7 @@ public class Removemessage extends MineverseCommand {
|
||||
private PacketContainer createPacketPlayOutChat(WrappedChatComponent component) {
|
||||
PacketContainer container = new PacketContainer(PacketType.Play.Server.CHAT);
|
||||
container.getChatComponents().write(0, component);
|
||||
container.getChatTypes().write(0, ChatType.CHAT);
|
||||
return container;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class Venturechat extends MineverseCommand {
|
||||
public void execute(CommandSender sender, String command, String[] args) {
|
||||
sender.sendMessage(ChatColor.GOLD + "VentureChat Version: " + plugin.getDescription().getVersion());
|
||||
sender.sendMessage(ChatColor.GOLD + "Written by Aust1n46");
|
||||
if (sender instanceof Player) {
|
||||
if (sender instanceof Player && plugin.getConfig().getString("loglevel", "info").equals("debug")) {
|
||||
Player player = (Player) sender;
|
||||
String title = ChatColor.GOLD + " | " + ChatColor.BLUE.toString() + ChatColor.BOLD + "Click here to begin..." + ChatColor.RESET + ChatColor.GOLD + " | ";
|
||||
String spaces = " ";
|
||||
|
@ -120,6 +120,7 @@ public class CapeListener implements Listener {
|
||||
return new EulerAngle(0.0D, d.doubleValue(), 0.0D);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void capeInHand(Player p) {
|
||||
if(p.getName().equals("Aust1n46")) {
|
||||
if(p.getInventory().getItemInHand().getType().equals(Material.BANNER)) {
|
||||
|
@ -213,6 +213,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
||||
}
|
||||
}
|
||||
|
||||
//old 1.8 command map
|
||||
@EventHandler
|
||||
public void onServerCommand(ServerCommandEvent event) {
|
||||
if(plugin.irc && bot.bot.isConnected() && !event.getCommand().equalsIgnoreCase("say ") && event.getCommand().toLowerCase().startsWith("say ")) {
|
||||
|
@ -75,16 +75,21 @@ public class PacketListener extends PacketAdapter {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(VersionHandler.is1_8()) {
|
||||
else if(VersionHandler.is1_8()) {
|
||||
if((MineverseChat.posField != null) && (((Byte) MineverseChat.posField.get(event.getPacket().getHandle())).intValue() > 1)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(VersionHandler.is1_9() || VersionHandler.is1_10()) {
|
||||
else if(VersionHandler.is1_9() || VersionHandler.is1_10() || VersionHandler.is1_11()){
|
||||
if((MineverseChat.posField != null) && (((Byte) MineverseChat.posField.get(event.getPacket().getHandle())).intValue() > 1)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if((MineverseChat.posField != null) && ((Object) MineverseChat.posField.get(event.getPacket().getHandle())) == MineverseChat.chatMessageType.getEnumConstants()[2]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -53,6 +53,14 @@ public class VersionHandler {
|
||||
return Bukkit.getVersion().contains("1.10");
|
||||
}
|
||||
|
||||
public static boolean is1_11() {
|
||||
return Bukkit.getVersion().contains("1.11");
|
||||
}
|
||||
|
||||
public static boolean is1_12() {
|
||||
return Bukkit.getVersion().contains("1.12");
|
||||
}
|
||||
|
||||
public static boolean isCauldron() {
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: VentureChat
|
||||
version: 2.11.1
|
||||
version: 2.12.0
|
||||
main: mineverse.Aust1n46.chat.MineverseChat
|
||||
depend: [Vault, ProtocolLib, PlaceholderAPI]
|
||||
softdepend: [Towny, Factions, Heroes]
|
||||
|
Loading…
x
Reference in New Issue
Block a user