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>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>CommandGUI_V2</artifactId>
|
<artifactId>CommandGUI_V2</artifactId>
|
||||||
<version>2.5.23</version>
|
<version>2.6.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>CommandGUI</name>
|
<name>CommandGUI</name>
|
||||||
@ -53,6 +53,10 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>Builders-Paradise</id>
|
<id>Builders-Paradise</id>
|
||||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||||
@ -61,10 +65,7 @@
|
|||||||
<id>T2Code</id>
|
<id>T2Code</id>
|
||||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>spigot-repo</id>
|
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -88,11 +89,17 @@
|
|||||||
<artifactId>LuckyBox-API</artifactId>
|
<artifactId>LuckyBox-API</artifactId>
|
||||||
<version>4.2.2</version>
|
<version>4.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.t2code.minecraft.1_18.r2</groupId>
|
||||||
|
<artifactId>spigot</artifactId>
|
||||||
|
<version>1.18r2</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code.minecraft.1_18.r1</groupId>
|
<groupId>net.t2code.minecraft.1_18.r1</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.18r1</version>
|
<version>1.18r1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code.minecraft.1_17.r1</groupId>
|
<groupId>net.t2code.minecraft.1_17.r1</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package de.jatitv.commandguiv2.Bungee;
|
package de.jatitv.commandguiv2.Bungee;
|
||||||
|
|
||||||
import net.md_5.bungee.BungeeCord;
|
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.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
@ -16,13 +17,20 @@ public class BListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginmessage(PluginMessageEvent event) {
|
public void onPluginmessage(PluginMessageEvent event) {
|
||||||
if (event.getTag().equalsIgnoreCase("cgui:bungee")) {
|
if (event.getTag().equalsIgnoreCase("cgui:bungee")) {
|
||||||
|
|
||||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||||
try {
|
try {
|
||||||
String channel = stream.readUTF();
|
String channel = stream.readUTF();
|
||||||
String input = 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) {
|
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) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -74,7 +74,7 @@ public class GUI_Listener implements Listener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (slot.Command_BungeeCommand && SelectConfig.Bungee) {
|
if (slot.Command_BungeeCommand && SelectConfig.Bungee) {
|
||||||
for (String cmd : slot.Command) {
|
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 {
|
} else {
|
||||||
if (slot.CommandAsConsole) {
|
if (slot.CommandAsConsole) {
|
||||||
@ -238,7 +238,7 @@ public class GUI_Listener implements Listener {
|
|||||||
if (slot.Command_BungeeCommand) {
|
if (slot.Command_BungeeCommand) {
|
||||||
if (SelectConfig.Bungee) {
|
if (SelectConfig.Bungee) {
|
||||||
for (String cmd : slot.Command) {
|
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 {
|
} else {
|
||||||
send.console(prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
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 net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.eclipse.sisu.space.ClassFinder;
|
||||||
|
|
||||||
import java.io.File;
|
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();
|
org.bukkit.craftbukkit.v1_18_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R1.CraftServer) plugin.getServer();
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
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 de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
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.entity.Player;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
@ -9,16 +11,32 @@ import java.io.*;
|
|||||||
|
|
||||||
public class Bungee_Sender_Reciver implements PluginMessageListener {
|
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();
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
DataOutputStream output = new DataOutputStream(stream);
|
DataOutputStream output = new DataOutputStream(stream);
|
||||||
try {
|
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);
|
output.writeUTF(information);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
Player player = (Player) sender;
|
||||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||||
|
}else {
|
||||||
|
for(Player player : Bukkit.getOnlinePlayers()){
|
||||||
|
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user