Esempio n. 1
0
 @Override
 public boolean runCommand(
     final CommandSender cs, final Command cmd, final String label, final String[] args) {
   if (args.length < 1) {
     cs.sendMessage(cmd.getDescription());
     return false;
   }
   final OfflinePlayer t = RUtils.getOfflinePlayer(args[0]);
   if (t.isOnline() && !this.plugin.isVanished((Player) t, cs)) {
     cs.sendMessage(
         MessageColor.POSITIVE
             + "The player "
             + MessageColor.NEUTRAL
             + t.getName()
             + MessageColor.POSITIVE
             + " was last seen "
             + MessageColor.NEUTRAL
             + "now"
             + MessageColor.POSITIVE
             + ".");
     return true;
   }
   final PlayerConfiguration pcm = PlayerConfigurationManager.getConfiguration(t);
   if (!pcm.exists()) {
     cs.sendMessage(MessageColor.NEGATIVE + "That player doesn't exist!");
     return true;
   }
   if (pcm.get("seen") == null) {
     cs.sendMessage(MessageColor.NEGATIVE + "I don't know when that player was last seen!");
     return true;
   }
   final long seen = pcm.getLong("seen");
   if (seen < 1L) {
     cs.sendMessage(MessageColor.NEGATIVE + "I don't know when that player was last seen!");
     return true;
   }
   final String lastseen = RUtils.formatDateDiff(seen);
   cs.sendMessage(
       MessageColor.POSITIVE
           + "The player "
           + MessageColor.NEUTRAL
           + t.getName()
           + MessageColor.POSITIVE
           + " was last seen"
           + MessageColor.NEUTRAL
           + lastseen
           + MessageColor.POSITIVE
           + " ago.");
   return true;
 }