Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.masloid.ubot;
- import com.github.steveice10.mc.protocol.MinecraftProtocol;
- import com.github.steveice10.mc.protocol.data.message.Message;
- import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket;
- import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket;
- import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket;
- import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
- import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
- import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
- import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
- import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket;
- import com.github.steveice10.packetlib.Client;
- import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
- import com.github.steveice10.packetlib.event.session.PacketReceivedEvent;
- import com.github.steveice10.packetlib.event.session.SessionAdapter;
- import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
- import com.github.steveice10.packetlib.Session;
- import java.net.Proxy;
- /**
- * Created by Masloid on 2018-01-23.
- */
- public class Main {
- public static int DELAY = 0;
- public static String SERVERIP = "ucraft.pl";
- public static int SERVERPORT = 25565;
- public static String USER = "nick";
- public static String pass = "/login <haslo>";
- public static boolean bolean = true;
- public static void main(String[] args) {
- String username = "IxidiXX";
- try {
- login(username,SERVERIP,SERVERPORT);
- Thread.sleep(DELAY);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- System.out.println(username + " " + "Connected!");
- }
- private static double x;
- private static double y;
- private static double z;
- private static float yaw;
- private static float pitch;
- private static void login(String username, String host, int port)
- {
- MinecraftProtocol protocol = null;
- protocol = new MinecraftProtocol(username);
- Client client = new Client(host, port, protocol, new TcpSessionFactory(Proxy.NO_PROXY));
- client.getSession().addListener(new SessionAdapter()
- //{
- //}
- {
- public void packetReceived(PacketReceivedEvent event) {
- //if(bolean == true) {
- // event.getSession().send(new ClientChatPacket("/login eloelo123"));
- //bolean = false;
- // }
- if ((event.getPacket() instanceof ServerKeepAlivePacket))
- {
- event.getSession().send(new ClientKeepAlivePacket(1));
- }else if ((event.getPacket() instanceof ServerPlayerPositionRotationPacket))
- {
- x = ((ServerPlayerPositionRotationPacket)event.getPacket()).getX();
- z = ((ServerPlayerPositionRotationPacket)event.getPacket()).getZ();
- y = ((ServerPlayerPositionRotationPacket)event.getPacket()).getY();
- System.out.println("start: " + x + " " + "start: " + z + " " + "start: " + y);
- }else if ((event.getPacket() instanceof ServerSpawnPositionPacket)) {
- move(event.getSession());
- }else if(event.getPacket() instanceof ServerChatPacket){
- String msg = ((ServerChatPacket)event.getPacket()).getMessage().getFullText();
- System.out.println(msg.toString());
- if(msg.contains("Zal")) {
- System.out.println("logowanie!");
- event.getSession().send(new ClientChatPacket(pass));
- //kolejna pierdolona proba move kurwa mac
- Thread mv = new Thread(new Runnable()
- {
- public void run()
- {
- for (;;)
- {
- x -= 0.15D;
- event.getSession().send(new ClientPlayerPositionPacket(true, x , y, z));
- event.getSession().send(new ClientPlayerPositionRotationPacket(true, x, y, z, 0.0f, 0.0f));
- try
- {
- Thread.sleep(50L);
- }
- catch (InterruptedException ex)
- {
- }
- }
- }
- });
- mv.start();
- }
- if(msg.contains("Masloid")) {
- if(msg.contains("say")) {
- String message;
- System.out.println("Said!");
- String[] splitted = msg.split("say ", 2);
- for(int i =0;i<1;i++) {
- message = splitted[1];
- event.getSession().send(new ClientChatPacket(message));
- }
- if(msg.contains("dc")){
- event.getSession().send(new ClientChatPacket(null));
- }
- }
- }
- }
- }
- public void disconnected(DisconnectedEvent event)
- {
- if(event.getReason().contains("antybot") | event.getReason().contains("ponownie") | event.getReason().contains("Ponownie")) {
- System.out.println("[" + username + "] Przechodzi weryfikacje antybot!");
- try {
- Thread.sleep(3000);
- System.out.println(username+"Przeszedl weryfikacje!");
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- event.getSession().connect();
- }else {
- System.out.println("\n[Bot] >> Disconnected: " + Message.fromString(event.getReason()).getFullText());
- }
- }
- });
- client.getSession().connect();
- }
- //jakas proba
- public static void move(Session session)
- {
- Thread t = new Thread(new Runnable()
- {
- public void run()
- {
- for (;;)
- {
- session.send(new ClientPlayerPositionPacket(true, x -= 0.15D, y, z));
- try
- {
- Thread.sleep(50L);
- }
- catch (InterruptedException ex)
- {
- }
- }
- }
- });
- t.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement