Added /report probably (and fixed party chat tab complete)
This commit is contained in:
parent
fecca063e7
commit
56010fb9ad
|
|
@ -410,4 +410,19 @@ public final class Config {
|
||||||
mailSent = getString("settings.mail.mail-sent", mailSent);
|
mailSent = getString("settings.mail.mail-sent", mailSent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashMap<String, Long> serverChannelId = new HashMap<>();
|
||||||
|
private static void loadChannelIds() {
|
||||||
|
serverChannelId.clear();
|
||||||
|
serverChannelId.put("general", getLong("discord-channel-id.general", (long) -1));
|
||||||
|
ConfigurationNode node = config.node("discord-channel-id");
|
||||||
|
Map<Object, ? extends ConfigurationNode> objectMap = node.childrenMap();
|
||||||
|
for (Object o : objectMap.keySet()) {
|
||||||
|
String key = (String) o;
|
||||||
|
if (key.equalsIgnoreCase("general"))
|
||||||
|
continue;
|
||||||
|
ConfigurationNode configurationNode = objectMap.get(o);
|
||||||
|
long channelId = configurationNode.getLong();
|
||||||
|
serverChannelId.put(key.toLowerCase(), channelId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ dependencies {
|
||||||
// compileOnly("com.velocitypowered:velocity-brigadier:1.0.0-SNAPSHOT")
|
// compileOnly("com.velocitypowered:velocity-brigadier:1.0.0-SNAPSHOT")
|
||||||
implementation("mysql:mysql-connector-java:8.0.27") // mysql
|
implementation("mysql:mysql-connector-java:8.0.27") // mysql
|
||||||
implementation("org.spongepowered", "configurate-yaml", "4.1.2")
|
implementation("org.spongepowered", "configurate-yaml", "4.1.2")
|
||||||
|
implementation("com.alttd.proxydiscordlink:ProxyDiscordLink:1.0.0-BETA-SNAPSHOT")
|
||||||
implementation("net.kyori", "adventure-text-minimessage", "4.10.0-SNAPSHOT") {
|
implementation("net.kyori", "adventure-text-minimessage", "4.10.0-SNAPSHOT") {
|
||||||
exclude("net.kyori")
|
exclude("net.kyori")
|
||||||
exclude("net.kyori.examination")
|
exclude("net.kyori.examination")
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,7 @@ import com.alttd.chat.ChatImplementation;
|
||||||
import com.alttd.chat.managers.ChatUserManager;
|
import com.alttd.chat.managers.ChatUserManager;
|
||||||
import com.alttd.chat.managers.PartyManager;
|
import com.alttd.chat.managers.PartyManager;
|
||||||
import com.alttd.chat.objects.ChatUser;
|
import com.alttd.chat.objects.ChatUser;
|
||||||
import com.alttd.velocitychat.commands.GlobalAdminChat;
|
import com.alttd.velocitychat.commands.*;
|
||||||
import com.alttd.velocitychat.commands.MailCommand;
|
|
||||||
import com.alttd.velocitychat.commands.PartyCommand;
|
|
||||||
import com.alttd.velocitychat.commands.Reload;
|
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.alttd.chat.database.DatabaseConnection;
|
import com.alttd.chat.database.DatabaseConnection;
|
||||||
import com.alttd.velocitychat.handlers.ChatHandler;
|
import com.alttd.velocitychat.handlers.ChatHandler;
|
||||||
|
|
@ -37,7 +34,7 @@ import java.nio.file.Path;
|
||||||
@Plugin(id = "chatplugin", name = "ChatPlugin", version = "1.0.0",
|
@Plugin(id = "chatplugin", name = "ChatPlugin", version = "1.0.0",
|
||||||
description = "A chat plugin for Altitude Minecraft Server",
|
description = "A chat plugin for Altitude Minecraft Server",
|
||||||
authors = {"destro174", "teri"},
|
authors = {"destro174", "teri"},
|
||||||
dependencies = {@Dependency(id = "luckperms"), @Dependency(id = "litebans")}
|
dependencies = {@Dependency(id = "luckperms"), @Dependency(id = "litebans"), @Dependency(id = "proxydiscordlink")}
|
||||||
)
|
)
|
||||||
public class VelocityChat {
|
public class VelocityChat {
|
||||||
|
|
||||||
|
|
@ -114,6 +111,7 @@ public class VelocityChat {
|
||||||
new GlobalAdminChat(server);
|
new GlobalAdminChat(server);
|
||||||
new Reload(server);
|
new Reload(server);
|
||||||
new MailCommand(server);
|
new MailCommand(server);
|
||||||
|
new Report(server);
|
||||||
server.getCommandManager().register("party", new PartyCommand());
|
server.getCommandManager().register("party", new PartyCommand());
|
||||||
// all (proxy)commands go here
|
// all (proxy)commands go here
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public class PartyCommand implements SimpleCommand {
|
||||||
List<String> finalValues = new ArrayList<>();
|
List<String> finalValues = new ArrayList<>();
|
||||||
|
|
||||||
for (String str : possibleValues) {
|
for (String str : possibleValues) {
|
||||||
if (str.toLowerCase().startsWith(remaining)) {
|
if (str.toLowerCase().startsWith(remaining.toLowerCase())) {
|
||||||
finalValues.add(StringArgumentType.escapeIfRequired(str));
|
finalValues.add(StringArgumentType.escapeIfRequired(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.alttd.velocitychat.commands;
|
package com.alttd.velocitychat.commands;
|
||||||
|
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
|
import com.alttd.chat.util.Utility;
|
||||||
|
import com.alttd.proxydiscordlink.DiscordLink;
|
||||||
|
import com.alttd.proxydiscordlink.lib.net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import com.alttd.velocitychat.VelocityChat;
|
import com.alttd.velocitychat.VelocityChat;
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
|
@ -15,6 +18,7 @@ import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import com.velocitypowered.api.proxy.ServerConnection;
|
import com.velocitypowered.api.proxy.ServerConnection;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
@ -55,7 +59,23 @@ public class Report {
|
||||||
}
|
}
|
||||||
ServerConnection serverConnection = optionalServerConnection.get();
|
ServerConnection serverConnection = optionalServerConnection.get();
|
||||||
String serverName = serverConnection.getServer().getServerInfo().getName();
|
String serverName = serverConnection.getServer().getServerInfo().getName();
|
||||||
//TODO send message to channel with that server name
|
|
||||||
|
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||||
|
embedBuilder.setAuthor(player.getUsername(),
|
||||||
|
"https://crafatar.com/avatars/" + player.getUniqueId() + "?overlay");
|
||||||
|
embedBuilder.setTitle("Player Report");
|
||||||
|
embedBuilder.setColor(Color.BLUE);
|
||||||
|
embedBuilder.addField("Incident",
|
||||||
|
context.getArgument("report", String.class),
|
||||||
|
false);
|
||||||
|
embedBuilder.addField("Server",
|
||||||
|
serverName.substring(0, 1).toUpperCase() + serverName.substring(1),
|
||||||
|
false);
|
||||||
|
|
||||||
|
Long id = Config.serverChannelId.get(serverName.toLowerCase());
|
||||||
|
if (id <= 0)
|
||||||
|
id = Config.serverChannelId.get("general");
|
||||||
|
DiscordLink.getPlugin().getBot().sendEmbedToDiscord(id, embedBuilder, -1);
|
||||||
return 1;
|
return 1;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user