Blacklist i18n

This commit is contained in:
GregTCLTK 2020-01-29 08:26:36 +01:00
parent 6fc9dd126b
commit 0b4cc1e792
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
2 changed files with 13 additions and 10 deletions

View file

@ -21,7 +21,6 @@ import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm; import com.bbn.hadder.core.Perm;
import com.bbn.hadder.core.Perms; import com.bbn.hadder.core.Perms;
import com.bbn.hadder.utils.MessageEditor; import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.User; import net.dv8tion.jda.api.entities.User;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,7 +41,7 @@ public class BlacklistCommand implements Command {
if (args.length == 3) { if (args.length == 3) {
String blacklisted = e.getRethinkUser().getBlacklisted(); String blacklisted = e.getRethinkUser().getBlacklisted();
List<String> commands = new ArrayList<>(); List<String> commands = new ArrayList<>();
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(","))); if (!(null == blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
commands.addAll(Arrays.asList(args[1].split(","))); commands.addAll(Arrays.asList(args[1].split(",")));
LinkedHashSet<String> hashSet = new LinkedHashSet<>(commands); LinkedHashSet<String> hashSet = new LinkedHashSet<>(commands);
@ -50,9 +49,9 @@ public class BlacklistCommand implements Command {
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none"); String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
e.getRethinkUser().setBlacklisted(newblacklisted); e.getRethinkUser().setBlacklisted(newblacklisted);
e.getTextChannel().sendMessage( e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO) e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
.setTitle("Removed Blacklisted Commands from User") "commands.owner.blacklist.success.add.title", "",
.setDescription("Blacklisted commands: "+newblacklisted) "commands.owner.blacklist.success.add.description", newblacklisted)
.build()).queue(); .build()).queue();
e.getRethinkUser().push(); e.getRethinkUser().push();
} }
@ -62,7 +61,7 @@ public class BlacklistCommand implements Command {
if (args.length == 3) { if (args.length == 3) {
String blacklisted = e.getRethinkUser().getBlacklisted(); String blacklisted = e.getRethinkUser().getBlacklisted();
List<String> commands = new ArrayList<>(); List<String> commands = new ArrayList<>();
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(","))); if (!(null == blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
commands.removeAll(Arrays.asList(args[1].split(","))); commands.removeAll(Arrays.asList(args[1].split(",")));
LinkedHashSet<String> hashSet = new LinkedHashSet<>(commands); LinkedHashSet<String> hashSet = new LinkedHashSet<>(commands);
@ -70,9 +69,9 @@ public class BlacklistCommand implements Command {
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none"); String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
e.getRethinkUser().setBlacklisted(newblacklisted); e.getRethinkUser().setBlacklisted(newblacklisted);
e.getTextChannel().sendMessage( e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO) e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
.setTitle("Removed Blacklisted Commands from User") "commands.owner.blacklist.success.remove.title", "",
.setDescription("Blacklisted commands: "+newblacklisted) "commands.owner.blacklist.success.remove.description", newblacklisted)
.build()).queue(); .build()).queue();
e.getRethinkUser().push(); e.getRethinkUser().push();
} }
@ -83,7 +82,7 @@ public class BlacklistCommand implements Command {
for (User user : e.getJDA().getUsers()) { for (User user : e.getJDA().getUsers()) {
if (!user.getId().equals(e.getJDA().getSelfUser().getId())) { if (!user.getId().equals(e.getJDA().getSelfUser().getId())) {
String blacklisted = e.getRethinkUser().getBlacklisted(); String blacklisted = e.getRethinkUser().getBlacklisted();
if (!"none".equals(blacklisted)) { if (!(null == blacklisted)) {
stringBuilder.append(user.getAsTag()).append(" (").append(user.getId()).append(") - ").append(blacklisted).append("\n"); stringBuilder.append(user.getAsTag()).append(" (").append(user.getId()).append(") - ").append(blacklisted).append("\n");
} }
} }

View file

@ -299,6 +299,10 @@ commands.owner.shutdown.success.title = Shutdown
commands.owner.shutdown.help.description = Shuts the Bot down commands.owner.shutdown.help.description = Shuts the Bot down
commands.owner.test.success = TEST my friends commands.owner.test.success = TEST my friends
commands.owner.test.help.description = Just a little Test Command commands.owner.test.help.description = Just a little Test Command
commands.owner.blacklist.success.add.title = Successfully blacklisted the specified commands
commands.owner.blacklist.success.add.description = I successfully added the following commands from the blacklist:\n %extra%
commands.owner.blacklist.success.remove.title = Successfully removed the commands from the blacklist
commands.owner.blacklist.success.remove.description = I successfully removed the following commands from the blacklist:\n %extra%
commands.owner.blacklist.help.description = Blacklist a user for specific commands commands.owner.blacklist.help.description = Blacklist a user for specific commands
commands.settings.language.success.title = Language set commands.settings.language.success.title = Language set