Chat/galaxy/src/main/java/com/alttd/chat/commands/Continue.java

33 lines
1.1 KiB
Java
Raw Normal View History

2022-04-21 13:45:50 +00:00
package com.alttd.chat.commands;
import com.alttd.chat.ChatPlugin;
import com.alttd.chat.managers.ChatUserManager;
import com.alttd.chat.objects.ChatUser;
2022-09-03 10:46:04 +00:00
import org.apache.commons.lang3.StringUtils;
2022-04-21 13:45:50 +00:00
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
2025-06-20 22:53:55 +00:00
import org.jetbrains.annotations.NotNull;
2022-04-21 13:45:50 +00:00
public class Continue implements CommandExecutor {
@Override
2025-06-20 22:53:55 +00:00
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (!(sender instanceof Player player)) {
2022-04-21 13:45:50 +00:00
return true;
}
ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
2025-06-20 22:53:55 +00:00
if (user.getReplyContinueTarget() == null) {
return false;
}
if (args.length == 0) {
return false; // todo error message or command info
}
2022-04-21 13:45:50 +00:00
String message = StringUtils.join(args, " ", 0, args.length);
ChatPlugin.getInstance().getChatHandler().continuePrivateMessage(player, user.getReplyContinueTarget(), message);
return false;
}
}