2.6.0
Add: - 1.18.2 Support Bugfix: - Fixed a bug where bungee commands were executed multiple times when multiple players were on the server. New features: - Bungee commands can now also be executed from the server
This commit is contained in:
parent
e8b5d49822
commit
4cbe8ed802
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>CommandGUI_V2</artifactId>
|
||||
<version>2.5.23</version>
|
||||
<version>2.6.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandGUI</name>
|
||||
@ -53,6 +53,10 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
@ -61,10 +65,7 @@
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -88,11 +89,17 @@
|
||||
<artifactId>LuckyBox-API</artifactId>
|
||||
<version>4.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_18.r2</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.18r2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_18.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.18r1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_17.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
@ -16,13 +17,20 @@ public class BListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getTag().equalsIgnoreCase("cgui:bungee")) {
|
||||
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
ProxiedPlayer player = BungeeCord.getInstance().getPlayer(channel);
|
||||
if (channel.equals("cgui-Console")) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command Console: "+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||
} else {
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
BungeeCord.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command " + player +": "+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -74,7 +74,7 @@ public class GUI_Listener implements Listener {
|
||||
public void run() {
|
||||
if (slot.Command_BungeeCommand && SelectConfig.Bungee) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, player.getName(), cmd.replace("[player]", player.getName()));
|
||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.CommandAsConsole);
|
||||
}
|
||||
} else {
|
||||
if (slot.CommandAsConsole) {
|
||||
@ -238,7 +238,7 @@ public class GUI_Listener implements Listener {
|
||||
if (slot.Command_BungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, player.getName(), cmd.replace("[player]", player.getName()));
|
||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.CommandAsConsole);
|
||||
}
|
||||
} else {
|
||||
send.console(prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
|
@ -7,6 +7,7 @@ import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.eclipse.sisu.space.ClassFinder;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ -110,6 +111,11 @@ public class AliasRegister {
|
||||
org.bukkit.craftbukkit.v1_18_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_18_R2) {
|
||||
send.debug(plugin, "Alias register 1.18_R2");
|
||||
org.bukkit.craftbukkit.v1_18_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R2.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
@ -9,16 +11,32 @@ import java.io.*;
|
||||
|
||||
public class Bungee_Sender_Reciver implements PluginMessageListener {
|
||||
|
||||
public static void sendToBungee(Player player,String channel, String information) {
|
||||
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(channel);
|
||||
if (console) {
|
||||
output.writeUTF("cgui-Console");
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
output.writeUTF(sender.getName());
|
||||
} else {
|
||||
output.writeUTF("cgui-Console");
|
||||
}
|
||||
}
|
||||
output.writeUTF(information);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||
}else {
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user