示例#1
0
 public static void print(String message) {
   if (enabled) {
     if (MINECRAFT.thePlayer != null) {
       MINECRAFT.thePlayer.addChatComponentMessage(new ChatComponentText(PREFIX + message));
     } else {
       XIV.getInstance().getLogger().info(message);
     }
   }
 }
示例#2
0
  @Override
  public void run() {
    status = "\247e\247kLogging in...";
    Field session = null;
    for (Field field : Minecraft.class.getDeclaredFields()) {
      if (field.getName().equalsIgnoreCase("session") || field.getType() == Session.class) {
        session = field;
      }
    }

    if (session == null) session = Minecraft.class.getDeclaredFields()[28];

    session.setAccessible(true);

    if (account.getPassword().equals("")) {
      Session newSession = new Session(account.getUsername(), "", "", "mojang");
      try {
        session.set(mc, newSession);
        if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) account.setKeyword(newSession.getUsername());
        status = "\247aLogged in as\247r " + newSession.getUsername();
      } catch (IllegalAccessException e) {
        XIV.getInstance()
            .getLogger()
            .warn("Failed to set session for alt login, a stacktrace has been printed.");
        e.printStackTrace();
      }
    } else {
      Session newSession = createSession(account.getUsername(), account.getPassword());
      if (newSession != null) {
        try {
          session.set(mc, newSession);
          if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) account.setKeyword(newSession.getUsername());
          status = "\247aLogged in as\247r " + newSession.getUsername();
        } catch (IllegalAccessException e) {
          XIV.getInstance()
              .getLogger()
              .warn("Failed to set session for alt login, a stacktrace has been printed.");
          e.printStackTrace();
        }
      }
    }
  }
示例#3
0
 protected void channelRead0(ChannelHandlerContext p_channelRead0_1_, Packet p_channelRead0_2_) {
   ReadPacketEvent event = new ReadPacketEvent(p_channelRead0_2_);
   XIV.getInstance().getListenerManager().call(event);
   if (event.isCancelled()) return;
   p_channelRead0_2_ = event.getPacket();
   if (this.channel.isOpen()) {
     try {
       p_channelRead0_2_.processPacket(this.packetListener);
     } catch (ThreadQuickExitException var4) {;
     }
   }
 }
示例#4
0
文件: Commands.java 项目: McSwede/XIV
 @Override
 public void onDisabled() {
   XIV.getInstance().getListenerManager().remove(this);
   XIV.getInstance().getListenerManager().remove(renderChatListener);
 }
示例#5
0
文件: Commands.java 项目: McSwede/XIV
 @Override
 public void onEnabled() {
   XIV.getInstance().getListenerManager().add(this);
   XIV.getInstance().getListenerManager().add(renderChatListener);
 }
示例#6
0
文件: Commands.java 项目: McSwede/XIV
 public void onEventCalled(SendPacketEvent event) {
   if (event.getPacket() instanceof C01PacketChatMessage) {
     C01PacketChatMessage packet = (C01PacketChatMessage) event.getPacket();
     event.setCancelled(XIV.getInstance().getCommandManager().parseCommand(packet.getMessage()));
   }
 }