Fix some stuff

This commit is contained in:
GregTCLTK 2020-06-08 13:40:48 +02:00
parent e40a59fe14
commit 4c4389b392
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
5 changed files with 10 additions and 82 deletions

View file

@ -99,7 +99,6 @@ public class Hadder {
new AvatarCommand(),
new EvalCommand(),
new JoinCommand(),
new LeaveCommand(),
new GuildLeaveCommand(),
new MemeCommand(),
new InviteDetectCommand(),

View file

@ -1,69 +0,0 @@
/*
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
*
* Licensed under the GNU Affero General Public License, Version 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.en.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bbn.hadder.commands.music;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
public class LeaveCommand implements Command {
@Override
public void executed(String[] args, CommandEvent e) {
if (e.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
e.getGuild().getAudioManager().closeAudioConnection();
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.INFO,
"commands.music.leave.success.title",
"commands.music.leave.success.description")
.build()).queue();
} else {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.leave.error.channel.title",
"commands.music.leave.error.channel.description")
.build()).queue();
}
} else {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,
"commands.music.leave.error.connected.tile",
"commands.music.leave.error.connected.description")
.build()).queue();
}
}
@Override
public String[] labels() {
return new String[]{"leave", "quit"};
}
@Override
public String description() {
return "commands.music.leave.help.description";
}
@Override
public String usage() {
return null;
}
@Override
public String example() {
return null;
}
}

View file

@ -26,10 +26,14 @@ public class SkipCommand implements Command {
public void executed(String[] args, CommandEvent e) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && !e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks().isEmpty()) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
if (!e.getAudioManager().getTrackManager(e.getGuild()).isLoop()) {
e.getAudioManager().forceSkipTrack(e);
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
"commands.music.skip.success.title",
"commands.music.skip.success.description").build()).queue();
} else {
e.getTextChannel().sendMessage("Get rekt lol Mach Loop aus noob").queue();
}
} else {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.music.skip.error.connected.title",

View file

@ -26,6 +26,7 @@ public class StopCommand implements Command {
public void executed(String[] args, CommandEvent e) {
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(false);
e.getAudioManager().players.remove(e.getGuild().getId());
e.getAudioManager().getPlayer(e.getGuild()).destroy();
e.getAudioManager().getTrackManager(e.getGuild()).purgeQueue();
@ -48,7 +49,7 @@ public class StopCommand implements Command {
@Override
public String[] labels() {
return new String[]{"stop"};
return new String[]{"stop", "leave"};
}
@Override

View file

@ -223,13 +223,6 @@ commands.music.join.error.channel.description = You aren't in a Voice Channel.
commands.music.join.error.permission.title = No permission
commands.music.join.error.permission.description = I am not allowed to join your voice channel.
commands.music.join.help.description = Joins your voice channel.
commands.music.leave.success.title = Successfully disconnected
commands.music.leave.success.description = I successfully disconnected from the Voice Channel
commands.music.leave.error.channel.title = No channel
commands.music.leave.error.channel.description = You have to be in the same voice channel as the bot.
commands.music.leave.error.connected.tile = Not connected
commands.music.leave.error.connected.description = I'm currently in no Voice Channel on this Guild
commands.music.leave.help.description = Leaves your voice channel.
commands.music.play.load.title = %extra% Now loading %extra%
commands.music.play.load.description = Trying to load the song...
commands.music.play.success.loading.title = %extra% Now playing %extra%