Advertisement
Guest User

Untitled

a guest
Feb 6th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.30 KB | None | 0 0
  1. package me.masloid.ubot;
  2.  
  3.  
  4. import com.github.steveice10.mc.protocol.MinecraftProtocol;
  5. import com.github.steveice10.mc.protocol.data.message.Message;
  6. import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket;
  7. import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket;
  8. import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket;
  9. import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
  10. import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
  11. import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
  12. import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
  13. import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket;
  14. import com.github.steveice10.packetlib.Client;
  15. import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
  16. import com.github.steveice10.packetlib.event.session.PacketReceivedEvent;
  17. import com.github.steveice10.packetlib.event.session.SessionAdapter;
  18. import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
  19. import com.github.steveice10.packetlib.Session;
  20.  
  21. import java.net.Proxy;
  22.  
  23.  
  24. /**
  25. * Created by Masloid on 2018-01-23.
  26. */
  27. public class Main {
  28. public static int DELAY = 0;
  29. public static String SERVERIP = "ucraft.pl";
  30. public static int SERVERPORT = 25565;
  31. public static String USER = "nick";
  32. public static String pass = "/login <haslo>";
  33. public static boolean bolean = true;
  34.  
  35. public static void main(String[] args) {
  36. String username = "IxidiXX";
  37.  
  38.  
  39. try {
  40. login(username,SERVERIP,SERVERPORT);
  41. Thread.sleep(DELAY);
  42. } catch (InterruptedException e) {
  43. // TODO Auto-generated catch block
  44. e.printStackTrace();
  45. }
  46. System.out.println(username + " " + "Connected!");
  47.  
  48. }
  49. private static double x;
  50. private static double y;
  51. private static double z;
  52.  
  53. private static float yaw;
  54. private static float pitch;
  55.  
  56. private static void login(String username, String host, int port)
  57. {
  58. MinecraftProtocol protocol = null;
  59.  
  60. protocol = new MinecraftProtocol(username);
  61. Client client = new Client(host, port, protocol, new TcpSessionFactory(Proxy.NO_PROXY));
  62. client.getSession().addListener(new SessionAdapter()
  63. //{
  64.  
  65.  
  66. //}
  67.  
  68.  
  69. {
  70.  
  71.  
  72.  
  73. public void packetReceived(PacketReceivedEvent event) {
  74. //if(bolean == true) {
  75. // event.getSession().send(new ClientChatPacket("/login eloelo123"));
  76. //bolean = false;
  77. // }
  78. if ((event.getPacket() instanceof ServerKeepAlivePacket))
  79. {
  80. event.getSession().send(new ClientKeepAlivePacket(1));
  81. }else if ((event.getPacket() instanceof ServerPlayerPositionRotationPacket))
  82. {
  83. x = ((ServerPlayerPositionRotationPacket)event.getPacket()).getX();
  84. z = ((ServerPlayerPositionRotationPacket)event.getPacket()).getZ();
  85. y = ((ServerPlayerPositionRotationPacket)event.getPacket()).getY();
  86. System.out.println("start: " + x + " " + "start: " + z + " " + "start: " + y);
  87. }else if ((event.getPacket() instanceof ServerSpawnPositionPacket)) {
  88. move(event.getSession());
  89. }else if(event.getPacket() instanceof ServerChatPacket){
  90. String msg = ((ServerChatPacket)event.getPacket()).getMessage().getFullText();
  91. System.out.println(msg.toString());
  92. if(msg.contains("Zal")) {
  93. System.out.println("logowanie!");
  94. event.getSession().send(new ClientChatPacket(pass));
  95. //kolejna pierdolona proba move kurwa mac
  96. Thread mv = new Thread(new Runnable()
  97. {
  98. public void run()
  99. {
  100. for (;;)
  101. {
  102. x -= 0.15D;
  103. event.getSession().send(new ClientPlayerPositionPacket(true, x , y, z));
  104. event.getSession().send(new ClientPlayerPositionRotationPacket(true, x, y, z, 0.0f, 0.0f));
  105. try
  106. {
  107. Thread.sleep(50L);
  108. }
  109. catch (InterruptedException ex)
  110. {
  111.  
  112. }
  113.  
  114. }
  115. }
  116. });
  117. mv.start();
  118.  
  119.  
  120.  
  121. }
  122. if(msg.contains("Masloid")) {
  123. if(msg.contains("say")) {
  124. String message;
  125. System.out.println("Said!");
  126. String[] splitted = msg.split("say ", 2);
  127. for(int i =0;i<1;i++) {
  128. message = splitted[1];
  129.  
  130.  
  131. event.getSession().send(new ClientChatPacket(message));
  132. }
  133. if(msg.contains("dc")){
  134. event.getSession().send(new ClientChatPacket(null));
  135.  
  136. }
  137.  
  138.  
  139. }
  140. }
  141. }
  142.  
  143. }
  144. public void disconnected(DisconnectedEvent event)
  145. {
  146. if(event.getReason().contains("antybot") | event.getReason().contains("ponownie") | event.getReason().contains("Ponownie")) {
  147. System.out.println("[" + username + "] Przechodzi weryfikacje antybot!");
  148. try {
  149. Thread.sleep(3000);
  150. System.out.println(username+"Przeszedl weryfikacje!");
  151. } catch (InterruptedException e) {
  152. // TODO Auto-generated catch block
  153. e.printStackTrace();
  154. }
  155. event.getSession().connect();
  156.  
  157. }else {
  158. System.out.println("\n[Bot] >> Disconnected: " + Message.fromString(event.getReason()).getFullText());
  159.  
  160. }
  161. }
  162. });
  163. client.getSession().connect();
  164. }
  165. //jakas proba
  166. public static void move(Session session)
  167. {
  168. Thread t = new Thread(new Runnable()
  169. {
  170. public void run()
  171. {
  172. for (;;)
  173. {
  174. session.send(new ClientPlayerPositionPacket(true, x -= 0.15D, y, z));
  175. try
  176. {
  177. Thread.sleep(50L);
  178. }
  179. catch (InterruptedException ex)
  180. {
  181.  
  182. }
  183.  
  184. }
  185. }
  186. });
  187. t.start();
  188. }
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement