00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 package com.realtime.crossfire.jxclient.commands;
00023
00024 import com.realtime.crossfire.jxclient.server.crossfire.CrossfireDrawinfoListener;
00025 import com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection;
00026 import org.jetbrains.annotations.NotNull;
00027
00032 public abstract class AbstractCommand implements Command {
00033
00037 @NotNull
00038 private final String commandName;
00039
00043 @NotNull
00044 private final CrossfireServerConnection crossfireServerConnection;
00045
00051 protected AbstractCommand(@NotNull final String commandName, @NotNull final CrossfireServerConnection crossfireServerConnection) {
00052 this.commandName = commandName;
00053 this.crossfireServerConnection = crossfireServerConnection;
00054 }
00055
00060 protected void drawInfo(@NotNull final String message) {
00061 drawInfo(message, CrossfireDrawinfoListener.NDI_BLACK);
00062 }
00063
00068 protected void drawInfoError(@NotNull final String message) {
00069 drawInfo(message, CrossfireDrawinfoListener.NDI_RED);
00070 }
00071
00077 protected void drawInfo(@NotNull final String message, final int color) {
00078 crossfireServerConnection.drawInfo(message, color);
00079 }
00080
00084 @NotNull
00085 @Override
00086 public String getCommandName() {
00087 return commandName;
00088 }
00089
00093 @NotNull
00094 public String toString() {
00095 return commandName;
00096 }
00097
00098 }