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.gui.log.MessageBufferUpdater;
00025 import com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection;
00026 import com.realtime.crossfire.jxclient.server.crossfire.MessageTypes;
00027 import org.jetbrains.annotations.NotNull;
00028
00034 public class DebugMessagesCommand extends AbstractCommand {
00035
00039 @NotNull
00040 private final CrossfireServerConnection crossfireServerConnection;
00041
00046 public DebugMessagesCommand(@NotNull final CrossfireServerConnection crossfireServerConnection) {
00047 super("debug_messages", crossfireServerConnection);
00048 this.crossfireServerConnection = crossfireServerConnection;
00049 }
00050
00054 @Override
00055 public boolean allArguments() {
00056 return false;
00057 }
00058
00062 @Override
00063 public void execute(@NotNull final String args) {
00064 if (args.equals("colors")) {
00065 for (int color = 0; color < MessageBufferUpdater.NUM_COLORS; color++) {
00066 drawInfo("This line is color #"+color+" ("+MessageBufferUpdater.getColorName(color)+").", color);
00067 }
00068 } else if (args.equals("types")) {
00069 for (final int type : MessageTypes.getAllTypes()) {
00070 crossfireServerConnection.drawextinfo(0, type, 0, "This line is type #"+type+".");
00071 }
00072 } else if (args.equals("on")) {
00073 crossfireServerConnection.drawInfoSetDebugMode(true);
00074 } else if (args.equals("off")) {
00075 crossfireServerConnection.drawInfoSetDebugMode(false);
00076 } else {
00077 drawInfoError("Valid arguments are 'colors', 'types', 'on', or 'off'. 'colors' prints messages using different message types, 'on' and 'off' enable/disable printing of message types.");
00078 return;
00079 }
00080
00081 }
00082
00083 }