mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-27 06:12:56 +00:00
Better Chat Color Utility Handling for Commands
This commit is contained in:
1 parent
3cac4e764f
commit
eb899061bf
24 files changed
+202
-26
No files matched your search
@@ -7,6 +7,9 @@ import net.minecraft.util.ChatComponentTranslation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static kamkeel.npcs.util.ColorUtil.sendError;
|
||||
import static kamkeel.npcs.util.ColorUtil.sendMessage;
|
||||
|
||||
public class CommandHelpProfile extends CommandProfileBase {
|
||||
private CommandProfile parent;
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static kamkeel.npcs.util.ColorUtil.*;
|
||||
|
||||
public class CommandProfileAdmin extends CommandProfileBase {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,10 @@ import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
@@ -16,6 +19,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public abstract class CommandProfileBase extends CommandBase{
|
||||
public Map<String, Method> subcommands = new HashMap<String, Method>();
|
||||
@@ -55,19 +60,7 @@ public abstract class CommandProfileBase extends CommandBase{
|
||||
return !subcommands.isEmpty();
|
||||
}
|
||||
|
||||
protected static void sendMessage(ICommandSender sender, String message, Object... obs) {
|
||||
sender.addChatMessage(new ChatComponentTranslation(message, obs));
|
||||
}
|
||||
|
||||
protected static void sendResult(ICommandSender sender, String message, Object... obs) {
|
||||
sender.addChatMessage(new ChatComponentTranslation("\u00A76[\u00A7eCNPC+\u00A76]\u00A77 " + message, obs));
|
||||
}
|
||||
|
||||
protected static void sendError(ICommandSender sender, String message, Object... obs) {
|
||||
sender.addChatMessage(new ChatComponentTranslation("\u00A76[\u00A7eCNPC+\u00A76]\u00A74 Error:\u00A7c " + message, obs));
|
||||
}
|
||||
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface SubCommand {
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@ import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import static kamkeel.npcs.util.ColorUtil.sendError;
|
||||
import static kamkeel.npcs.util.ColorUtil.sendResult;
|
||||
|
||||
public class CommandProfileChange extends CommandProfileBase {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static kamkeel.npcs.util.ColorUtil.sendError;
|
||||
import static kamkeel.npcs.util.ColorUtil.sendMessage;
|
||||
|
||||
public class CommandProfileList extends CommandProfileBase {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,9 @@ import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import static kamkeel.npcs.util.ColorUtil.sendError;
|
||||
import static kamkeel.npcs.util.ColorUtil.sendResult;
|
||||
|
||||
public class CommandProfileRemove extends CommandProfileBase {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,9 @@ import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import static kamkeel.npcs.util.ColorUtil.sendError;
|
||||
import static kamkeel.npcs.util.ColorUtil.sendResult;
|
||||
|
||||
public class CommandProfileRename extends CommandProfileBase {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user