mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2025-02-21 14:21:30 +01:00
Added more subcommands to the addon
Not sure about the names of the subcommands...
This commit is contained in:
parent
c1f7f38f2b
commit
737c218295
@ -33,7 +33,7 @@ public class MainCommand implements CommandExecutor {
|
|||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
plugin.getManager().connectPlayer((Player) sender, input);
|
plugin.getManager().connectPlayer((Player) sender, input);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("This command variant can only be executed by a player");
|
sender.sendMessage(ChatColor.RED + "This command variant can only be executed by a player");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -60,21 +60,41 @@ public class MainCommand implements CommandExecutor {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
case "bypassconnect": {
|
||||||
case "info": {
|
sender.sendMessage(ChatColor.RED + "This command variant is not implemented yet");
|
||||||
plugin.getManager().getSectionOfPlayer((Player) sender, (a) -> {
|
break;
|
||||||
System.out.println(a);
|
}
|
||||||
sender.sendMessage(a);
|
|
||||||
});
|
case "setbypass": {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This command variant is not implemented yet");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "clearbypass": {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This command variant is not implemented yet");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "overridestatus": {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This command variant is not implemented yet");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "clearoverride": {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This command variant is not implemented yet");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.STRIKETHROUGH + ChatColor.GRAY.toString() + Strings.repeat("-", 53));
|
sender.sendMessage(ChatColor.STRIKETHROUGH + ChatColor.GRAY.toString() + Strings.repeat("-", 53));
|
||||||
sender.sendMessage(ChatColor.GRAY + "Available commands:");
|
sender.sendMessage(ChatColor.GRAY + "Available commands:");
|
||||||
sender.sendMessage(ChatColor.AQUA + "/spb connect <section> [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Connects you or the specified player to that section");
|
sender.sendMessage(ChatColor.AQUA + "/spb connect <section> [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Connects you or the specified player to that section");
|
||||||
sender.sendMessage(ChatColor.AQUA + "/spb fallback [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Connects you or the specified player to the parent of the current section");
|
sender.sendMessage(ChatColor.AQUA + "/spb fallback [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Connects you or the specified player to the parent of the current section");
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "/spb bypassconnect <server> [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Connects you or the specified player to a specific server without balancing");
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "/spb setbypass [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Sets a bypass for you or the specified player");
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "/spb clearbypass [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Clears the bypass for you or the specified player");
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "/spb overridestatus <server> <status>" + ChatColor.GRAY + " - " + ChatColor.RED + "Overrides the accessible status of a specific server, over anything else");
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "/spb clearoverride <server> <status>" + ChatColor.GRAY + " - " + ChatColor.RED + "Clears the overriden status of a specific server");
|
||||||
sender.sendMessage(ChatColor.STRIKETHROUGH + ChatColor.GRAY.toString() + Strings.repeat("-", 53));
|
sender.sendMessage(ChatColor.STRIKETHROUGH + ChatColor.GRAY.toString() + Strings.repeat("-", 53));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,13 @@ public class PluginMessageManager implements PluginMessageListener {
|
|||||||
player.sendPluginMessage(plugin, "PlayerBalancer", out.toByteArray());
|
player.sendPluginMessage(plugin, "PlayerBalancer", out.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fallbackPlayer(Player player) {
|
||||||
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
|
out.writeUTF("FallbackPlayer");
|
||||||
|
out.writeUTF(player.getName());
|
||||||
|
player.sendPluginMessage(plugin, "PlayerBalancer", out.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getSectionByName(String section, Consumer<String> consumer) {
|
public boolean getSectionByName(String section, Consumer<String> consumer) {
|
||||||
Player player = Iterables.getFirst(plugin.getServer().getOnlinePlayers(), null);
|
Player player = Iterables.getFirst(plugin.getServer().getOnlinePlayers(), null);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
@ -92,26 +99,6 @@ public class PluginMessageManager implements PluginMessageListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSectionPlayerCount(String section, Consumer<Integer> consumer) {
|
|
||||||
Player player = Iterables.getFirst(plugin.getServer().getOnlinePlayers(), null);
|
|
||||||
if (player == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
|
||||||
out.writeUTF("GetSectionPlayerCount");
|
|
||||||
out.writeUTF(section);
|
|
||||||
|
|
||||||
contexts.put(new MessageContext(
|
|
||||||
"PlayerBalancer",
|
|
||||||
"GetSectionPlayerCount",
|
|
||||||
player.getUniqueId()
|
|
||||||
), (response) -> consumer.accept(response.readInt()));
|
|
||||||
|
|
||||||
player.sendPluginMessage(plugin, "PlayerBalancer", out.toByteArray());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getSectionOfPlayer(Player player, Consumer<String> consumer) {
|
public void getSectionOfPlayer(Player player, Consumer<String> consumer) {
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF("GetSectionOfPlayer");
|
out.writeUTF("GetSectionOfPlayer");
|
||||||
@ -146,11 +133,24 @@ public class PluginMessageManager implements PluginMessageListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fallbackPlayer(Player player) {
|
public boolean getSectionPlayerCount(String section, Consumer<Integer> consumer) {
|
||||||
|
Player player = Iterables.getFirst(plugin.getServer().getOnlinePlayers(), null);
|
||||||
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF("FallbackPlayer");
|
out.writeUTF("GetSectionPlayerCount");
|
||||||
out.writeUTF(player.getName());
|
out.writeUTF(section);
|
||||||
|
|
||||||
|
contexts.put(new MessageContext(
|
||||||
|
"PlayerBalancer",
|
||||||
|
"GetSectionPlayerCount",
|
||||||
|
player.getUniqueId()
|
||||||
|
), (response) -> consumer.accept(response.readInt()));
|
||||||
|
|
||||||
player.sendPluginMessage(plugin, "PlayerBalancer", out.toByteArray());
|
player.sendPluginMessage(plugin, "PlayerBalancer", out.toByteArray());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clearStatusOverride(String server) {
|
public boolean clearStatusOverride(String server) {
|
||||||
@ -194,7 +194,6 @@ public class PluginMessageManager implements PluginMessageListener {
|
|||||||
player.sendPluginMessage(plugin, "PlayerBalancer", out.toByteArray());
|
player.sendPluginMessage(plugin, "PlayerBalancer", out.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Add this to the /balancer or some other command too
|
|
||||||
public void bypassConnect(Player player, String server) {
|
public void bypassConnect(Player player, String server) {
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF("BypassConnect");
|
out.writeUTF("BypassConnect");
|
||||||
|
Loading…
Reference in New Issue
Block a user