made togglegc command
This commit is contained in:
parent
c15da75114
commit
599de2647f
|
|
@ -1,11 +1,15 @@
|
|||
package com.alttd.chat.commands;
|
||||
|
||||
import com.alttd.chat.ChatPlugin;
|
||||
import com.alttd.chat.managers.ChatUserManager;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class GlobalChat implements CommandExecutor {
|
||||
|
||||
|
|
@ -16,11 +20,17 @@ public class GlobalChat implements CommandExecutor {
|
|||
}
|
||||
Player player = (Player) sender;
|
||||
if(args.length == 0) return false;
|
||||
if(args[0].equalsIgnoreCase("toggle")) {
|
||||
// todo is this how we want to toggle or use a /togglegc command? or /toggle chatoptions?
|
||||
if(args[0].equalsIgnoreCase("togglegc")) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Objects.requireNonNull(ChatUserManager.getChatUser(((Player) sender).getUniqueId())).toggleGc();
|
||||
|
||||
String message = StringUtils.join(args, " ", 0, args.length);
|
||||
ChatPlugin.getInstance().getChatHandler().globalChat(player, message);
|
||||
}
|
||||
}.runTask(ChatPlugin.getInstance());
|
||||
}
|
||||
String message = StringUtils.join(args, " ", 0, args.length);
|
||||
ChatPlugin.getInstance().getChatHandler().globalChat(player, message);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user