thufir

send alias, target back to controller

Sep 17th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. package telnet;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. public class Alias {
  6.  
  7.     private static final Logger log = Logger.getLogger(Alias.class.getName());
  8.  
  9.     public Alias() {
  10.     }
  11.  
  12.     public String parse(String line) throws StringIndexOutOfBoundsException {
  13.         char c = line.charAt(0);
  14.         String s = String.valueOf(c);
  15.         if ("/".equals(s)) {
  16.             line = getAlias(line);
  17.         }
  18.         return line;
  19.     }
  20.  
  21.     private String getAlias(String line) {
  22.         String sentence = line.subSequence(1, line.length()).toString();
  23.         String[] words = sentence.split(" ");
  24.         String action = words[0];
  25.         String target = words[1];
  26.  
  27.         if ("t".equals(action)) {
  28.             log.info("targetting correct\t\t" + target);
  29.         }
  30.         return "";
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment