mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 19:34:58 -05:00
General cleanup, fixes, and re-versioning.
This commit is contained in:
parent
2b39ead979
commit
b22cd66d4f
240 changed files with 9618 additions and 9445 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,12 +1,13 @@
|
||||||
bin
|
bin
|
||||||
lib
|
lib
|
||||||
|
target
|
||||||
|
testing
|
||||||
|
|
||||||
.settings
|
.settings
|
||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
|
.directory
|
||||||
|
|
||||||
*.iml
|
*.iml
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
target
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Copyright (C) 2013-2014 Steveice10
|
Copyright (C) 2013-2015 Steveice10
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|
30
README.md
30
README.md
|
@ -1,30 +1,14 @@
|
||||||
<b><center><h1>MCProtocolLib</h></center></b>
|
# MCProtocolLib
|
||||||
==========
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<b>About MCProtocolLib</b>
|
|
||||||
--------
|
|
||||||
|
|
||||||
MCProtocolLib is a simple library for communicating with a Minecraft client/server. It aims to allow people to make custom bots, clients, or servers for Minecraft easily.
|
MCProtocolLib is a simple library for communicating with a Minecraft client/server. It aims to allow people to make custom bots, clients, or servers for Minecraft easily.
|
||||||
|
|
||||||
|
## Example Code
|
||||||
|
See example/org/spacehq/mc/protocol/test
|
||||||
|
|
||||||
<b>Example Code</b>
|
## Building the Source
|
||||||
--------
|
|
||||||
|
|
||||||
See example/org/spacehq/mc/protocol/test/Test.java
|
|
||||||
|
|
||||||
|
|
||||||
<b>Building the Source</b>
|
|
||||||
--------
|
|
||||||
|
|
||||||
MCProtocolLib uses Maven to manage dependencies. Simply run 'mvn clean install' in the source's directory.
|
MCProtocolLib uses Maven to manage dependencies. Simply run 'mvn clean install' in the source's directory.
|
||||||
Snapshots (if any exist) can be downloaded <b>[here](http://repo.spacehq.org/content/repositories/snapshots/org/spacehq/mcprotocollib)</b>.
|
|
||||||
Releases (if any exist) can be downloaded <b>[here](http://repo.spacehq.org/content/repositories/release/org/spacehq/mcprotocollib)</b>.
|
|
||||||
|
|
||||||
|
Builds can be downloaded **[here](http://build.spacehq.org/job/MCProtocolLib)**.
|
||||||
|
|
||||||
<b>License</b>
|
## License
|
||||||
---------
|
MCProtocolLib is licensed under the **[MIT license](http://www.opensource.org/licenses/mit-license.html)**.
|
||||||
|
|
||||||
MCProtocolLib is licensed under the <b>[MIT license](http://www.opensource.org/licenses/mit-license.html)</b>.
|
|
||||||
|
|
||||||
|
|
183
example/org/spacehq/mc/protocol/test/MinecraftProtocolTest.java
Normal file
183
example/org/spacehq/mc/protocol/test/MinecraftProtocolTest.java
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
package org.spacehq.mc.protocol.test;
|
||||||
|
|
||||||
|
import org.spacehq.mc.auth.GameProfile;
|
||||||
|
import org.spacehq.mc.auth.exception.AuthenticationException;
|
||||||
|
import org.spacehq.mc.protocol.MinecraftProtocol;
|
||||||
|
import org.spacehq.mc.protocol.ProtocolConstants;
|
||||||
|
import org.spacehq.mc.protocol.ProtocolMode;
|
||||||
|
import org.spacehq.mc.protocol.ServerLoginHandler;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.setting.Difficulty;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.WorldType;
|
||||||
|
import org.spacehq.mc.protocol.data.message.ChatColor;
|
||||||
|
import org.spacehq.mc.protocol.data.message.ChatFormat;
|
||||||
|
import org.spacehq.mc.protocol.data.message.Message;
|
||||||
|
import org.spacehq.mc.protocol.data.message.MessageStyle;
|
||||||
|
import org.spacehq.mc.protocol.data.message.TextMessage;
|
||||||
|
import org.spacehq.mc.protocol.data.message.TranslationMessage;
|
||||||
|
import org.spacehq.mc.protocol.data.status.PlayerInfo;
|
||||||
|
import org.spacehq.mc.protocol.data.status.ServerStatusInfo;
|
||||||
|
import org.spacehq.mc.protocol.data.status.VersionInfo;
|
||||||
|
import org.spacehq.mc.protocol.data.status.handler.ServerInfoBuilder;
|
||||||
|
import org.spacehq.mc.protocol.data.status.handler.ServerInfoHandler;
|
||||||
|
import org.spacehq.mc.protocol.data.status.handler.ServerPingTimeHandler;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||||
|
import org.spacehq.packetlib.Client;
|
||||||
|
import org.spacehq.packetlib.Server;
|
||||||
|
import org.spacehq.packetlib.Session;
|
||||||
|
import org.spacehq.packetlib.event.server.ServerAdapter;
|
||||||
|
import org.spacehq.packetlib.event.server.SessionAddedEvent;
|
||||||
|
import org.spacehq.packetlib.event.server.SessionRemovedEvent;
|
||||||
|
import org.spacehq.packetlib.event.session.DisconnectedEvent;
|
||||||
|
import org.spacehq.packetlib.event.session.PacketReceivedEvent;
|
||||||
|
import org.spacehq.packetlib.event.session.SessionAdapter;
|
||||||
|
import org.spacehq.packetlib.tcp.TcpSessionFactory;
|
||||||
|
|
||||||
|
import java.net.Proxy;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class MinecraftProtocolTest {
|
||||||
|
private static final boolean SPAWN_SERVER = true;
|
||||||
|
private static final boolean VERIFY_USERS = false;
|
||||||
|
private static final String HOST = "127.0.0.1";
|
||||||
|
private static final int PORT = 25565;
|
||||||
|
private static final Proxy PROXY = Proxy.NO_PROXY;
|
||||||
|
private static final Proxy AUTH_PROXY = Proxy.NO_PROXY;
|
||||||
|
private static final String USERNAME = "Username";
|
||||||
|
private static final String PASSWORD = "Password";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
if(SPAWN_SERVER) {
|
||||||
|
Server server = new Server(HOST, PORT, MinecraftProtocol.class, new TcpSessionFactory(PROXY));
|
||||||
|
server.setGlobalFlag(ProtocolConstants.AUTH_PROXY_KEY, AUTH_PROXY);
|
||||||
|
server.setGlobalFlag(ProtocolConstants.VERIFY_USERS_KEY, VERIFY_USERS);
|
||||||
|
server.setGlobalFlag(ProtocolConstants.SERVER_INFO_BUILDER_KEY, new ServerInfoBuilder() {
|
||||||
|
@Override
|
||||||
|
public ServerStatusInfo buildInfo(Session session) {
|
||||||
|
return new ServerStatusInfo(new VersionInfo(ProtocolConstants.GAME_VERSION, ProtocolConstants.PROTOCOL_VERSION), new PlayerInfo(100, 0, new GameProfile[0]), new TextMessage("Hello world!"), null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.setGlobalFlag(ProtocolConstants.SERVER_LOGIN_HANDLER_KEY, new ServerLoginHandler() {
|
||||||
|
@Override
|
||||||
|
public void loggedIn(Session session) {
|
||||||
|
session.send(new ServerJoinGamePacket(0, false, GameMode.SURVIVAL, 0, Difficulty.PEACEFUL, 10, WorldType.DEFAULT, false));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.setGlobalFlag(ProtocolConstants.SERVER_COMPRESSION_THRESHOLD, 100);
|
||||||
|
server.addListener(new ServerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void sessionAdded(SessionAddedEvent event) {
|
||||||
|
event.getSession().addListener(new SessionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void packetReceived(PacketReceivedEvent event) {
|
||||||
|
if(event.getPacket() instanceof ClientChatPacket) {
|
||||||
|
ClientChatPacket packet = event.getPacket();
|
||||||
|
GameProfile profile = event.getSession().getFlag(ProtocolConstants.PROFILE_KEY);
|
||||||
|
System.out.println(profile.getName() + ": " + packet.getMessage());
|
||||||
|
Message msg = new TextMessage("Hello, ").setStyle(new MessageStyle().setColor(ChatColor.GREEN));
|
||||||
|
Message name = new TextMessage(profile.getName()).setStyle(new MessageStyle().setColor(ChatColor.AQUA).addFormat(ChatFormat.UNDERLINED));
|
||||||
|
Message end = new TextMessage("!");
|
||||||
|
msg.addExtra(name);
|
||||||
|
msg.addExtra(end);
|
||||||
|
event.getSession().send(new ServerChatPacket(msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sessionRemoved(SessionRemovedEvent event) {
|
||||||
|
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
||||||
|
if(protocol.getMode() == ProtocolMode.GAME) {
|
||||||
|
System.out.println("Closing server.");
|
||||||
|
event.getServer().close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.bind();
|
||||||
|
}
|
||||||
|
|
||||||
|
status();
|
||||||
|
login();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void status() {
|
||||||
|
MinecraftProtocol protocol = new MinecraftProtocol(ProtocolMode.STATUS);
|
||||||
|
Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(PROXY));
|
||||||
|
client.getSession().setFlag(ProtocolConstants.AUTH_PROXY_KEY, AUTH_PROXY);
|
||||||
|
client.getSession().setFlag(ProtocolConstants.SERVER_INFO_HANDLER_KEY, new ServerInfoHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(Session session, ServerStatusInfo info) {
|
||||||
|
System.out.println("Version: " + info.getVersionInfo().getVersionName() + ", " + info.getVersionInfo().getProtocolVersion());
|
||||||
|
System.out.println("Player Count: " + info.getPlayerInfo().getOnlinePlayers() + " / " + info.getPlayerInfo().getMaxPlayers());
|
||||||
|
System.out.println("Players: " + Arrays.toString(info.getPlayerInfo().getPlayers()));
|
||||||
|
System.out.println("Description: " + info.getDescription().getFullText());
|
||||||
|
System.out.println("Icon: " + info.getIcon());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.getSession().setFlag(ProtocolConstants.SERVER_PING_TIME_HANDLER_KEY, new ServerPingTimeHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(Session session, long pingTime) {
|
||||||
|
System.out.println("Server ping took " + pingTime + "ms");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.getSession().connect();
|
||||||
|
while(client.getSession().isConnected()) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(5);
|
||||||
|
} catch(InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void login() {
|
||||||
|
MinecraftProtocol protocol = null;
|
||||||
|
if(VERIFY_USERS) {
|
||||||
|
try {
|
||||||
|
protocol = new MinecraftProtocol(USERNAME, PASSWORD, false);
|
||||||
|
System.out.println("Successfully authenticated user.");
|
||||||
|
} catch(AuthenticationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
protocol = new MinecraftProtocol(USERNAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(PROXY));
|
||||||
|
client.getSession().addListener(new SessionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void packetReceived(PacketReceivedEvent event) {
|
||||||
|
if(event.getPacket() instanceof ServerJoinGamePacket) {
|
||||||
|
event.getSession().send(new ClientChatPacket("Hello, this is a test of MCProtocolLib."));
|
||||||
|
} else if(event.getPacket() instanceof ServerChatPacket) {
|
||||||
|
Message message = event.<ServerChatPacket>getPacket().getMessage();
|
||||||
|
System.out.println("Received Message: " + message.getFullText());
|
||||||
|
if(message instanceof TranslationMessage) {
|
||||||
|
System.out.println("Received Translation Components: " + Arrays.toString(((TranslationMessage) message).getTranslationParams()));
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getSession().disconnect("Finished");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disconnected(DisconnectedEvent event) {
|
||||||
|
System.out.println("Disconnected: " + Message.fromString(event.getReason()).getFullText());
|
||||||
|
if(event.getCause() != null) {
|
||||||
|
event.getCause().printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.getSession().connect();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,177 +0,0 @@
|
||||||
package org.spacehq.mc.protocol.test;
|
|
||||||
|
|
||||||
import org.spacehq.mc.auth.GameProfile;
|
|
||||||
import org.spacehq.mc.auth.exception.AuthenticationException;
|
|
||||||
import org.spacehq.mc.protocol.MinecraftProtocol;
|
|
||||||
import org.spacehq.mc.protocol.ProtocolConstants;
|
|
||||||
import org.spacehq.mc.protocol.ProtocolMode;
|
|
||||||
import org.spacehq.mc.protocol.ServerLoginHandler;
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.setting.Difficulty;
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.WorldType;
|
|
||||||
import org.spacehq.mc.protocol.data.message.*;
|
|
||||||
import org.spacehq.mc.protocol.data.status.PlayerInfo;
|
|
||||||
import org.spacehq.mc.protocol.data.status.ServerStatusInfo;
|
|
||||||
import org.spacehq.mc.protocol.data.status.VersionInfo;
|
|
||||||
import org.spacehq.mc.protocol.data.status.handler.ServerInfoBuilder;
|
|
||||||
import org.spacehq.mc.protocol.data.status.handler.ServerInfoHandler;
|
|
||||||
import org.spacehq.mc.protocol.data.status.handler.ServerPingTimeHandler;
|
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket;
|
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
|
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
|
||||||
import org.spacehq.packetlib.Client;
|
|
||||||
import org.spacehq.packetlib.Server;
|
|
||||||
import org.spacehq.packetlib.Session;
|
|
||||||
import org.spacehq.packetlib.event.server.ServerAdapter;
|
|
||||||
import org.spacehq.packetlib.event.server.SessionAddedEvent;
|
|
||||||
import org.spacehq.packetlib.event.server.SessionRemovedEvent;
|
|
||||||
import org.spacehq.packetlib.event.session.DisconnectedEvent;
|
|
||||||
import org.spacehq.packetlib.event.session.PacketReceivedEvent;
|
|
||||||
import org.spacehq.packetlib.event.session.SessionAdapter;
|
|
||||||
import org.spacehq.packetlib.tcp.TcpSessionFactory;
|
|
||||||
|
|
||||||
import java.net.Proxy;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class Test {
|
|
||||||
|
|
||||||
private static final boolean SPAWN_SERVER = true;
|
|
||||||
private static final boolean VERIFY_USERS = false;
|
|
||||||
private static final String HOST = "127.0.0.1";
|
|
||||||
private static final int PORT = 25565;
|
|
||||||
private static final Proxy PROXY = Proxy.NO_PROXY;
|
|
||||||
private static final Proxy AUTH_PROXY = Proxy.NO_PROXY;
|
|
||||||
private static final String USERNAME = "Username";
|
|
||||||
private static final String PASSWORD = "Password";
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
if(SPAWN_SERVER) {
|
|
||||||
Server server = new Server(HOST, PORT, MinecraftProtocol.class, new TcpSessionFactory(PROXY));
|
|
||||||
server.setGlobalFlag(ProtocolConstants.AUTH_PROXY_KEY, AUTH_PROXY);
|
|
||||||
server.setGlobalFlag(ProtocolConstants.VERIFY_USERS_KEY, VERIFY_USERS);
|
|
||||||
server.setGlobalFlag(ProtocolConstants.SERVER_INFO_BUILDER_KEY, new ServerInfoBuilder() {
|
|
||||||
@Override
|
|
||||||
public ServerStatusInfo buildInfo(Session session) {
|
|
||||||
return new ServerStatusInfo(new VersionInfo(ProtocolConstants.GAME_VERSION, ProtocolConstants.PROTOCOL_VERSION), new PlayerInfo(100, 0, new GameProfile[0]), new TextMessage("Hello world!"), null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
server.setGlobalFlag(ProtocolConstants.SERVER_LOGIN_HANDLER_KEY, new ServerLoginHandler() {
|
|
||||||
@Override
|
|
||||||
public void loggedIn(Session session) {
|
|
||||||
session.send(new ServerJoinGamePacket(0, false, GameMode.SURVIVAL, 0, Difficulty.PEACEFUL, 10, WorldType.DEFAULT, false));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
server.setGlobalFlag(ProtocolConstants.SERVER_COMPRESSION_THRESHOLD, 100);
|
|
||||||
server.addListener(new ServerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void sessionAdded(SessionAddedEvent event) {
|
|
||||||
event.getSession().addListener(new SessionAdapter() {
|
|
||||||
@Override
|
|
||||||
public void packetReceived(PacketReceivedEvent event) {
|
|
||||||
if(event.getPacket() instanceof ClientChatPacket) {
|
|
||||||
ClientChatPacket packet = event.getPacket();
|
|
||||||
GameProfile profile = event.getSession().getFlag(ProtocolConstants.PROFILE_KEY);
|
|
||||||
System.out.println(profile.getName() + ": " + packet.getMessage());
|
|
||||||
Message msg = new TextMessage("Hello, ").setStyle(new MessageStyle().setColor(ChatColor.GREEN));
|
|
||||||
Message name = new TextMessage(profile.getName()).setStyle(new MessageStyle().setColor(ChatColor.AQUA).addFormat(ChatFormat.UNDERLINED));
|
|
||||||
Message end = new TextMessage("!");
|
|
||||||
msg.addExtra(name);
|
|
||||||
msg.addExtra(end);
|
|
||||||
event.getSession().send(new ServerChatPacket(msg));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sessionRemoved(SessionRemovedEvent event) {
|
|
||||||
MinecraftProtocol protocol = (MinecraftProtocol) event.getSession().getPacketProtocol();
|
|
||||||
if(protocol.getMode() == ProtocolMode.GAME) {
|
|
||||||
System.out.println("Closing server.");
|
|
||||||
event.getServer().close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
server.bind();
|
|
||||||
}
|
|
||||||
|
|
||||||
status();
|
|
||||||
login();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void status() {
|
|
||||||
MinecraftProtocol protocol = new MinecraftProtocol(ProtocolMode.STATUS);
|
|
||||||
Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(PROXY));
|
|
||||||
client.getSession().setFlag(ProtocolConstants.AUTH_PROXY_KEY, AUTH_PROXY);
|
|
||||||
client.getSession().setFlag(ProtocolConstants.SERVER_INFO_HANDLER_KEY, new ServerInfoHandler() {
|
|
||||||
@Override
|
|
||||||
public void handle(Session session, ServerStatusInfo info) {
|
|
||||||
System.out.println("Version: " + info.getVersionInfo().getVersionName() + ", " + info.getVersionInfo().getProtocolVersion());
|
|
||||||
System.out.println("Player Count: " + info.getPlayerInfo().getOnlinePlayers() + " / " + info.getPlayerInfo().getMaxPlayers());
|
|
||||||
System.out.println("Players: " + Arrays.toString(info.getPlayerInfo().getPlayers()));
|
|
||||||
System.out.println("Description: " + info.getDescription().getFullText());
|
|
||||||
System.out.println("Icon: " + info.getIcon());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
client.getSession().setFlag(ProtocolConstants.SERVER_PING_TIME_HANDLER_KEY, new ServerPingTimeHandler() {
|
|
||||||
@Override
|
|
||||||
public void handle(Session session, long pingTime) {
|
|
||||||
System.out.println("Server ping took " + pingTime + "ms");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
client.getSession().connect();
|
|
||||||
while(client.getSession().isConnected()) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(5);
|
|
||||||
} catch(InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void login() {
|
|
||||||
MinecraftProtocol protocol = null;
|
|
||||||
if(VERIFY_USERS) {
|
|
||||||
try {
|
|
||||||
protocol = new MinecraftProtocol(USERNAME, PASSWORD, false);
|
|
||||||
System.out.println("Successfully authenticated user.");
|
|
||||||
} catch(AuthenticationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
protocol = new MinecraftProtocol(USERNAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Client client = new Client(HOST, PORT, protocol, new TcpSessionFactory(PROXY));
|
|
||||||
client.getSession().addListener(new SessionAdapter() {
|
|
||||||
@Override
|
|
||||||
public void packetReceived(PacketReceivedEvent event) {
|
|
||||||
if(event.getPacket() instanceof ServerJoinGamePacket) {
|
|
||||||
event.getSession().send(new ClientChatPacket("Hello, this is a test of MCProtocolLib."));
|
|
||||||
} else if(event.getPacket() instanceof ServerChatPacket) {
|
|
||||||
Message message = event.<ServerChatPacket>getPacket().getMessage();
|
|
||||||
System.out.println("Received Message: " + message.getFullText());
|
|
||||||
if(message instanceof TranslationMessage) {
|
|
||||||
System.out.println("Received Translation Components: " + Arrays.toString(((TranslationMessage) message).getTranslationParams()));
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getSession().disconnect("Finished");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disconnected(DisconnectedEvent event) {
|
|
||||||
System.out.println("Disconnected: " + Message.fromString(event.getReason()).getFullText());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
client.getSession().connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
62
pom.xml
62
pom.xml
|
@ -11,6 +11,16 @@
|
||||||
<description>A library for communicating with a Minecraft client or server.</description>
|
<description>A library for communicating with a Minecraft client or server.</description>
|
||||||
<url>http://github.com/Steveice10/MCProtocolLib/</url>
|
<url>http://github.com/Steveice10/MCProtocolLib/</url>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:git@github.com:Steveice10/MCProtocolLib.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:Steveice10/MCProtocolLib.git</developerConnection>
|
||||||
|
<url>git@github.com:Steveice10/MCProtocolLib/</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
<name>MIT</name>
|
<name>MIT</name>
|
||||||
|
@ -19,25 +29,6 @@
|
||||||
</license>
|
</license>
|
||||||
</licenses>
|
</licenses>
|
||||||
|
|
||||||
<scm>
|
|
||||||
<connection>scm:git:git@github.com:Steveice10/MCProtocolLib.git</connection>
|
|
||||||
<developerConnection>scm:git:git@github.com:Steveice10/MCProtocolLib.git</developerConnection>
|
|
||||||
<url>git@github.com:Steveice10/MCProtocolLib/</url>
|
|
||||||
</scm>
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>spacehq</id>
|
|
||||||
<name>spacehq-releases</name>
|
|
||||||
<url>http://repo.spacehq.org/content/repositories/release/</url>
|
|
||||||
</repository>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>spacehq</id>
|
|
||||||
<name>spacehq-snapshots</name>
|
|
||||||
<url>http://repo.spacehq.org/content/repositories/snapshots/</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
<developer>
|
<developer>
|
||||||
<id>steveice10</id>
|
<id>steveice10</id>
|
||||||
|
@ -46,10 +37,23 @@
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>spacehq</id>
|
||||||
|
<name>spacehq-releases</name>
|
||||||
|
<url>http://repo.spacehq.org/content/repositories/releases/</url>
|
||||||
|
</repository>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>spacehq</id>
|
||||||
|
<name>spacehq-snapshots</name>
|
||||||
|
<url>http://repo.spacehq.org/content/repositories/snapshots/</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spacehq-releases</id>
|
<id>spacehq-releases</id>
|
||||||
<url>http://repo.spacehq.org/content/repositories/release/</url>
|
<url>http://repo.spacehq.org/content/repositories/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spacehq-snapshots</id>
|
<id>spacehq-snapshots</id>
|
||||||
|
@ -57,22 +61,17 @@
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<!-- Dependencies -->
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spacehq</groupId>
|
<groupId>org.spacehq</groupId>
|
||||||
<artifactId>opennbt</artifactId>
|
<artifactId>opennbt</artifactId>
|
||||||
<version>1.4</version>
|
<version>1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spacehq</groupId>
|
<groupId>org.spacehq</groupId>
|
||||||
<artifactId>packetlib</artifactId>
|
<artifactId>packetlib</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -89,23 +88,21 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.5.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>1.6</source>
|
||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- JAR creation plugin -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.6</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- JAR dependency addition plugin -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>1.5</version>
|
<version>2.4.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
@ -115,6 +112,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||||
<filters>
|
<filters>
|
||||||
<filter>
|
<filter>
|
||||||
<artifact>*:*</artifact>
|
<artifact>*:*</artifact>
|
||||||
|
|
|
@ -4,22 +4,106 @@ import org.spacehq.mc.auth.GameProfile;
|
||||||
import org.spacehq.mc.auth.UserAuthentication;
|
import org.spacehq.mc.auth.UserAuthentication;
|
||||||
import org.spacehq.mc.auth.exception.AuthenticationException;
|
import org.spacehq.mc.auth.exception.AuthenticationException;
|
||||||
import org.spacehq.mc.protocol.packet.handshake.client.HandshakePacket;
|
import org.spacehq.mc.protocol.packet.handshake.client.HandshakePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.*;
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientKeepAlivePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientPluginMessagePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientRequestPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientResourcePackStatusPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientSettingsPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientTabCompletePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientChangeHeldItemPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket;
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerStatePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientSpectatePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientSteerVehiclePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientSwingArmPacket;
|
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientSwingArmPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.player.*;
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientCloseWindowPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.window.*;
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientEnchantItemPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientUpdateSignPacket;
|
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientUpdateSignPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.entity.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerCombatPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerDifficultyPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerDisconnectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerPlayerListDataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerPlayerListEntryPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerResourcePackSendPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerRespawnPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerSetCompressionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerStatisticsPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerSwitchCameraPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerTabCompletePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerTitlePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerAnimationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerCollectItemPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerDestroyEntitiesPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityAttachPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityEffectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityMovementPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityNBTUpdatePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPositionRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPropertiesPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityRemoveEffectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerChangeHeldItemPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerUseBedPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerSetExperiencePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerUpdateHealthPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnGlobalEntityPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnMobPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnObjectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.window.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerCloseWindowPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.world.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerConfirmTransactionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerOpenWindowPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerWindowPropertyPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerBlockBreakAnimPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerBlockChangePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerBlockValuePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerChunkDataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerExplosionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerMapDataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerMultiBlockChangePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerMultiChunkDataPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerOpenTileEntityEditorPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlayEffectPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlaySoundPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerSpawnParticlePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerUpdateSignPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerUpdateTileEntityPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerWorldBorderPacket;
|
||||||
import org.spacehq.mc.protocol.packet.login.client.EncryptionResponsePacket;
|
import org.spacehq.mc.protocol.packet.login.client.EncryptionResponsePacket;
|
||||||
import org.spacehq.mc.protocol.packet.login.client.LoginStartPacket;
|
import org.spacehq.mc.protocol.packet.login.client.LoginStartPacket;
|
||||||
import org.spacehq.mc.protocol.packet.login.server.EncryptionRequestPacket;
|
import org.spacehq.mc.protocol.packet.login.server.EncryptionRequestPacket;
|
||||||
|
@ -116,13 +200,8 @@ public class MinecraftProtocol extends PacketProtocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needsPacketSizer() {
|
public String getSRVRecordPrefix() {
|
||||||
return true;
|
return "_minecraft";
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean needsPacketEncryptor() {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,14 +40,14 @@ public class Chunk {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Chunk chunk = (Chunk) o;
|
Chunk chunk = (Chunk) o;
|
||||||
|
|
||||||
if (!blocklight.equals(chunk.blocklight)) return false;
|
if(!blocklight.equals(chunk.blocklight)) return false;
|
||||||
if (!blocks.equals(chunk.blocks)) return false;
|
if(!blocks.equals(chunk.blocks)) return false;
|
||||||
if (skylight != null ? !skylight.equals(chunk.skylight) : chunk.skylight != null) return false;
|
if(skylight != null ? !skylight.equals(chunk.skylight) : chunk.skylight != null) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,14 @@ public class EntityMetadata {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
EntityMetadata metadata = (EntityMetadata) o;
|
EntityMetadata metadata = (EntityMetadata) o;
|
||||||
|
|
||||||
if (id != metadata.id) return false;
|
if(id != metadata.id) return false;
|
||||||
if (type != metadata.type) return false;
|
if(type != metadata.type) return false;
|
||||||
if (!value.equals(metadata.value)) return false;
|
if(!value.equals(metadata.value)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,15 +46,15 @@ public class ItemStack {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ItemStack itemStack = (ItemStack) o;
|
ItemStack itemStack = (ItemStack) o;
|
||||||
|
|
||||||
if (amount != itemStack.amount) return false;
|
if(amount != itemStack.amount) return false;
|
||||||
if (data != itemStack.data) return false;
|
if(data != itemStack.data) return false;
|
||||||
if (id != itemStack.id) return false;
|
if(id != itemStack.id) return false;
|
||||||
if (nbt != null ? !nbt.equals(itemStack.nbt) : itemStack.nbt != null) return false;
|
if(nbt != null ? !nbt.equals(itemStack.nbt) : itemStack.nbt != null) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,12 +50,12 @@ public class NibbleArray3d {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
NibbleArray3d that = (NibbleArray3d) o;
|
NibbleArray3d that = (NibbleArray3d) o;
|
||||||
|
|
||||||
if (!Arrays.equals(data, that.data)) return false;
|
if(!Arrays.equals(data, that.data)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,14 +26,14 @@ public class Position {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Position position = (Position) o;
|
Position position = (Position) o;
|
||||||
|
|
||||||
if (x != position.x) return false;
|
if(x != position.x) return false;
|
||||||
if (y != position.y) return false;
|
if(y != position.y) return false;
|
||||||
if (z != position.z) return false;
|
if(z != position.z) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,14 @@ public class Rotation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Rotation rotation = (Rotation) o;
|
Rotation rotation = (Rotation) o;
|
||||||
|
|
||||||
if (Float.compare(rotation.pitch, pitch) != 0) return false;
|
if(Float.compare(rotation.pitch, pitch) != 0) return false;
|
||||||
if (Float.compare(rotation.roll, roll) != 0) return false;
|
if(Float.compare(rotation.roll, roll) != 0) return false;
|
||||||
if (Float.compare(rotation.yaw, yaw) != 0) return false;
|
if(Float.compare(rotation.yaw, yaw) != 0) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,12 +52,12 @@ public class ShortArray3d {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ShortArray3d that = (ShortArray3d) o;
|
ShortArray3d that = (ShortArray3d) o;
|
||||||
|
|
||||||
if (!Arrays.equals(data, that.data)) return false;
|
if(!Arrays.equals(data, that.data)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,14 +39,14 @@ public class Attribute {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Attribute attribute = (Attribute) o;
|
Attribute attribute = (Attribute) o;
|
||||||
|
|
||||||
if (Double.compare(attribute.value, value) != 0) return false;
|
if(Double.compare(attribute.value, value) != 0) return false;
|
||||||
if (!modifiers.equals(attribute.modifiers)) return false;
|
if(!modifiers.equals(attribute.modifiers)) return false;
|
||||||
if (type != attribute.type) return false;
|
if(type != attribute.type) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,14 @@ public class AttributeModifier {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
AttributeModifier that = (AttributeModifier) o;
|
AttributeModifier that = (AttributeModifier) o;
|
||||||
|
|
||||||
if (Double.compare(that.amount, amount) != 0) return false;
|
if(Double.compare(that.amount, amount) != 0) return false;
|
||||||
if (operation != that.operation) return false;
|
if(operation != that.operation) return false;
|
||||||
if (type != that.type) return false;
|
if(type != that.type) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,45 @@
|
||||||
package org.spacehq.mc.protocol.data.game.values;
|
package org.spacehq.mc.protocol.data.game.values;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.entity.*;
|
import org.spacehq.mc.protocol.data.game.values.entity.Art;
|
||||||
import org.spacehq.mc.protocol.data.game.values.entity.player.*;
|
import org.spacehq.mc.protocol.data.game.values.entity.AttributeType;
|
||||||
import org.spacehq.mc.protocol.data.game.values.scoreboard.*;
|
import org.spacehq.mc.protocol.data.game.values.entity.Effect;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.EntityStatus;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.GlobalEntityType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.HangingDirection;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.MetadataType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.MinecartType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.MobType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.ModifierOperation;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.ModifierType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.ObjectType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.Animation;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.BlockBreakStage;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.CombatState;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.InteractAction;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.PlayerAction;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.PlayerState;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.player.PositionElement;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.scoreboard.NameTagVisibility;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.scoreboard.ObjectiveAction;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.scoreboard.ScoreType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.scoreboard.ScoreboardAction;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.scoreboard.ScoreboardPosition;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.scoreboard.TeamAction;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.scoreboard.TeamColor;
|
||||||
import org.spacehq.mc.protocol.data.game.values.setting.ChatVisibility;
|
import org.spacehq.mc.protocol.data.game.values.setting.ChatVisibility;
|
||||||
import org.spacehq.mc.protocol.data.game.values.setting.Difficulty;
|
import org.spacehq.mc.protocol.data.game.values.setting.Difficulty;
|
||||||
import org.spacehq.mc.protocol.data.game.values.statistic.Achievement;
|
import org.spacehq.mc.protocol.data.game.values.statistic.Achievement;
|
||||||
import org.spacehq.mc.protocol.data.game.values.statistic.GenericStatistic;
|
import org.spacehq.mc.protocol.data.game.values.statistic.GenericStatistic;
|
||||||
import org.spacehq.mc.protocol.data.game.values.window.*;
|
import org.spacehq.mc.protocol.data.game.values.window.ClickItemParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.CreativeGrabParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.DropItemParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.FillStackParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.MoveToHotbarParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.ShiftClickItemParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.SpreadItemParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.WindowAction;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.WindowType;
|
||||||
import org.spacehq.mc.protocol.data.game.values.window.property.AnvilProperty;
|
import org.spacehq.mc.protocol.data.game.values.window.property.AnvilProperty;
|
||||||
import org.spacehq.mc.protocol.data.game.values.window.property.BrewingStandProperty;
|
import org.spacehq.mc.protocol.data.game.values.window.property.BrewingStandProperty;
|
||||||
import org.spacehq.mc.protocol.data.game.values.window.property.EnchantmentTableProperty;
|
import org.spacehq.mc.protocol.data.game.values.window.property.EnchantmentTableProperty;
|
||||||
|
@ -17,7 +49,12 @@ import org.spacehq.mc.protocol.data.game.values.world.Particle;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.WorldBorderAction;
|
import org.spacehq.mc.protocol.data.game.values.world.WorldBorderAction;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.WorldType;
|
import org.spacehq.mc.protocol.data.game.values.world.WorldType;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.block.UpdatedTileType;
|
import org.spacehq.mc.protocol.data.game.values.world.block.UpdatedTileType;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.block.value.*;
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.ChestValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.GenericBlockValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.MobSpawnerValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.NoteBlockValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.PistonValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.PistonValueType;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.effect.ParticleEffect;
|
import org.spacehq.mc.protocol.data.game.values.world.effect.ParticleEffect;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.effect.SmokeEffectData;
|
import org.spacehq.mc.protocol.data.game.values.world.effect.SmokeEffectData;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.effect.SoundEffect;
|
import org.spacehq.mc.protocol.data.game.values.world.effect.SoundEffect;
|
||||||
|
|
|
@ -55,15 +55,15 @@ public class PlayerListEntry {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
PlayerListEntry entry = (PlayerListEntry) o;
|
PlayerListEntry entry = (PlayerListEntry) o;
|
||||||
|
|
||||||
if (ping != entry.ping) return false;
|
if(ping != entry.ping) return false;
|
||||||
if (displayName != null ? !displayName.equals(entry.displayName) : entry.displayName != null) return false;
|
if(displayName != null ? !displayName.equals(entry.displayName) : entry.displayName != null) return false;
|
||||||
if (gameMode != entry.gameMode) return false;
|
if(gameMode != entry.gameMode) return false;
|
||||||
if (!profile.equals(entry.profile)) return false;
|
if(!profile.equals(entry.profile)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,13 @@ public class FallingBlockData implements ObjectData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
FallingBlockData that = (FallingBlockData) o;
|
FallingBlockData that = (FallingBlockData) o;
|
||||||
|
|
||||||
if (id != that.id) return false;
|
if(id != that.id) return false;
|
||||||
if (metadata != that.metadata) return false;
|
if(metadata != that.metadata) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class ProjectileData implements ObjectData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ProjectileData that = (ProjectileData) o;
|
ProjectileData that = (ProjectileData) o;
|
||||||
|
|
||||||
if (ownerId != that.ownerId) return false;
|
if(ownerId != that.ownerId) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class SplashPotionData implements ObjectData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
SplashPotionData that = (SplashPotionData) o;
|
SplashPotionData that = (SplashPotionData) o;
|
||||||
|
|
||||||
if (potionData != that.potionData) return false;
|
if(potionData != that.potionData) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class BreakItemStatistic implements Statistic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
BreakItemStatistic that = (BreakItemStatistic) o;
|
BreakItemStatistic that = (BreakItemStatistic) o;
|
||||||
|
|
||||||
if (id != that.id) return false;
|
if(id != that.id) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class CraftItemStatistic implements Statistic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
CraftItemStatistic that = (CraftItemStatistic) o;
|
CraftItemStatistic that = (CraftItemStatistic) o;
|
||||||
|
|
||||||
if (id != that.id) return false;
|
if(id != that.id) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class UseItemStatistic implements Statistic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
UseItemStatistic that = (UseItemStatistic) o;
|
UseItemStatistic that = (UseItemStatistic) o;
|
||||||
|
|
||||||
if (id != that.id) return false;
|
if(id != that.id) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,24 +27,28 @@ public enum EnchantmentTableProperty implements WindowProperty {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The enchantment for slot 1.
|
* The enchantment for slot 1.
|
||||||
|
*
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
*/
|
*/
|
||||||
ENCHANTMENT_SLOT_1,
|
ENCHANTMENT_SLOT_1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The enchantment for slot 2.
|
* The enchantment for slot 2.
|
||||||
|
*
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
*/
|
*/
|
||||||
ENCHANTMENT_SLOT_2,
|
ENCHANTMENT_SLOT_2,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The enchantment for slot 3.
|
* The enchantment for slot 3.
|
||||||
|
*
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
*/
|
*/
|
||||||
ENCHANTMENT_SLOT_3;
|
ENCHANTMENT_SLOT_3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packs enchantment type and level into one integer as used for the ENCHANTMENT_SLOT_X properties.
|
* Packs enchantment type and level into one integer as used for the ENCHANTMENT_SLOT_X properties.
|
||||||
|
*
|
||||||
* @param type Id of the enchantment
|
* @param type Id of the enchantment
|
||||||
* @param level Level of the enchantment
|
* @param level Level of the enchantment
|
||||||
* @return Packed value
|
* @return Packed value
|
||||||
|
@ -57,6 +61,7 @@ public enum EnchantmentTableProperty implements WindowProperty {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unpacks the enchantment type from one integer as used for the ENCHANTMENT_SLOT_X properties.
|
* Unpacks the enchantment type from one integer as used for the ENCHANTMENT_SLOT_X properties.
|
||||||
|
*
|
||||||
* @param enchantmentInfo Packed value
|
* @param enchantmentInfo Packed value
|
||||||
* @return Id of the enchantment
|
* @return Id of the enchantment
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
|
@ -67,6 +72,7 @@ public enum EnchantmentTableProperty implements WindowProperty {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unpacks the enchantment level from one integer as used for the ENCHANTMENT_SLOT_X properties.
|
* Unpacks the enchantment level from one integer as used for the ENCHANTMENT_SLOT_X properties.
|
||||||
|
*
|
||||||
* @param enchantmentInfo Packed value
|
* @param enchantmentInfo Packed value
|
||||||
* @return Level of the enchantment
|
* @return Level of the enchantment
|
||||||
* @see #getEnchantment(int, int)
|
* @see #getEnchantment(int, int)
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class CustomSound implements Sound {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
CustomSound that = (CustomSound) o;
|
CustomSound that = (CustomSound) o;
|
||||||
|
|
||||||
if (!name.equals(that.name)) return false;
|
if(!name.equals(that.name)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,13 @@ public class BlockChangeRecord {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
BlockChangeRecord record = (BlockChangeRecord) o;
|
BlockChangeRecord record = (BlockChangeRecord) o;
|
||||||
|
|
||||||
if (block != record.block) return false;
|
if(block != record.block) return false;
|
||||||
if (!position.equals(record.position)) return false;
|
if(!position.equals(record.position)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,14 +26,14 @@ public class ExplodedBlockRecord {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ExplodedBlockRecord that = (ExplodedBlockRecord) o;
|
ExplodedBlockRecord that = (ExplodedBlockRecord) o;
|
||||||
|
|
||||||
if (x != that.x) return false;
|
if(x != that.x) return false;
|
||||||
if (y != that.y) return false;
|
if(y != that.y) return false;
|
||||||
if (z != that.z) return false;
|
if(z != that.z) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class ChestValue implements BlockValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ChestValue that = (ChestValue) o;
|
ChestValue that = (ChestValue) o;
|
||||||
|
|
||||||
if (viewers != that.viewers) return false;
|
if(viewers != that.viewers) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class GenericBlockValue implements BlockValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
GenericBlockValue that = (GenericBlockValue) o;
|
GenericBlockValue that = (GenericBlockValue) o;
|
||||||
|
|
||||||
if (value != that.value) return false;
|
if(value != that.value) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,12 @@ public class NoteBlockValue implements BlockValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
NoteBlockValue that = (NoteBlockValue) o;
|
NoteBlockValue that = (NoteBlockValue) o;
|
||||||
|
|
||||||
if (pitch != that.pitch) return false;
|
if(pitch != that.pitch) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class BreakBlockEffectData implements WorldEffectData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
BreakBlockEffectData that = (BreakBlockEffectData) o;
|
BreakBlockEffectData that = (BreakBlockEffectData) o;
|
||||||
|
|
||||||
if (blockId != that.blockId) return false;
|
if(blockId != that.blockId) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class BreakPotionEffectData implements WorldEffectData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
BreakPotionEffectData that = (BreakPotionEffectData) o;
|
BreakPotionEffectData that = (BreakPotionEffectData) o;
|
||||||
|
|
||||||
if (potionId != that.potionId) return false;
|
if(potionId != that.potionId) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class HardLandingEffectData implements WorldEffectData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
HardLandingEffectData that = (HardLandingEffectData) o;
|
HardLandingEffectData that = (HardLandingEffectData) o;
|
||||||
|
|
||||||
if (damagingDistance != that.damagingDistance) return false;
|
if(damagingDistance != that.damagingDistance) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ public class RecordEffectData implements WorldEffectData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
RecordEffectData that = (RecordEffectData) o;
|
RecordEffectData that = (RecordEffectData) o;
|
||||||
|
|
||||||
if (recordId != that.recordId) return false;
|
if(recordId != that.recordId) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,16 +39,16 @@ public class MapData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
MapData mapData = (MapData) o;
|
MapData mapData = (MapData) o;
|
||||||
|
|
||||||
if (columns != mapData.columns) return false;
|
if(columns != mapData.columns) return false;
|
||||||
if (rows != mapData.rows) return false;
|
if(rows != mapData.rows) return false;
|
||||||
if (x != mapData.x) return false;
|
if(x != mapData.x) return false;
|
||||||
if (y != mapData.y) return false;
|
if(y != mapData.y) return false;
|
||||||
if (!Arrays.equals(data, mapData.data)) return false;
|
if(!Arrays.equals(data, mapData.data)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,15 +32,15 @@ public class MapPlayer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
MapPlayer mapPlayer = (MapPlayer) o;
|
MapPlayer mapPlayer = (MapPlayer) o;
|
||||||
|
|
||||||
if (centerX != mapPlayer.centerX) return false;
|
if(centerX != mapPlayer.centerX) return false;
|
||||||
if (centerZ != mapPlayer.centerZ) return false;
|
if(centerZ != mapPlayer.centerZ) return false;
|
||||||
if (iconRotation != mapPlayer.iconRotation) return false;
|
if(iconRotation != mapPlayer.iconRotation) return false;
|
||||||
if (iconSize != mapPlayer.iconSize) return false;
|
if(iconSize != mapPlayer.iconSize) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,12 @@ public class RainStrengthValue implements ClientNotificationValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
RainStrengthValue that = (RainStrengthValue) o;
|
RainStrengthValue that = (RainStrengthValue) o;
|
||||||
|
|
||||||
if (Float.compare(that.strength, strength) != 0) return false;
|
if(Float.compare(that.strength, strength) != 0) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,12 @@ public class ThunderStrengthValue implements ClientNotificationValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ThunderStrengthValue that = (ThunderStrengthValue) o;
|
ThunderStrengthValue that = (ThunderStrengthValue) o;
|
||||||
|
|
||||||
if (Float.compare(that.strength, strength) != 0) return false;
|
if(Float.compare(that.strength, strength) != 0) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,13 +25,13 @@ public class ClickEvent implements Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ClickEvent that = (ClickEvent) o;
|
ClickEvent that = (ClickEvent) o;
|
||||||
|
|
||||||
if (action != that.action) return false;
|
if(action != that.action) return false;
|
||||||
if (!value.equals(that.value)) return false;
|
if(!value.equals(that.value)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,13 +25,13 @@ public class HoverEvent implements Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
HoverEvent that = (HoverEvent) o;
|
HoverEvent that = (HoverEvent) o;
|
||||||
|
|
||||||
if (action != that.action) return false;
|
if(action != that.action) return false;
|
||||||
if (!value.equals(that.value)) return false;
|
if(!value.equals(that.value)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,13 +77,13 @@ public abstract class Message implements Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
Message message = (Message) o;
|
Message message = (Message) o;
|
||||||
|
|
||||||
if (!extra.equals(message.extra)) return false;
|
if(!extra.equals(message.extra)) return false;
|
||||||
if (!style.equals(message.style)) return false;
|
if(!style.equals(message.style)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,17 +103,17 @@ public class MessageStyle implements Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
MessageStyle style = (MessageStyle) o;
|
MessageStyle style = (MessageStyle) o;
|
||||||
|
|
||||||
if (click != null ? !click.equals(style.click) : style.click != null) return false;
|
if(click != null ? !click.equals(style.click) : style.click != null) return false;
|
||||||
if (color != style.color) return false;
|
if(color != style.color) return false;
|
||||||
if (!formats.equals(style.formats)) return false;
|
if(!formats.equals(style.formats)) return false;
|
||||||
if (hover != null ? !hover.equals(style.hover) : style.hover != null) return false;
|
if(hover != null ? !hover.equals(style.hover) : style.hover != null) return false;
|
||||||
if (insertion != null ? !insertion.equals(style.insertion) : style.insertion != null) return false;
|
if(insertion != null ? !insertion.equals(style.insertion) : style.insertion != null) return false;
|
||||||
if (!parent.equals(style.parent)) return false;
|
if(!parent.equals(style.parent)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,13 +40,13 @@ public class TextMessage extends Message {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
if (!super.equals(o)) return false;
|
if(!super.equals(o)) return false;
|
||||||
|
|
||||||
TextMessage that = (TextMessage) o;
|
TextMessage that = (TextMessage) o;
|
||||||
|
|
||||||
if (!text.equals(that.text)) return false;
|
if(!text.equals(that.text)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,14 +73,14 @@ public class TranslationMessage extends Message {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
if (!super.equals(o)) return false;
|
if(!super.equals(o)) return false;
|
||||||
|
|
||||||
TranslationMessage that = (TranslationMessage) o;
|
TranslationMessage that = (TranslationMessage) o;
|
||||||
|
|
||||||
if (!translationKey.equals(that.translationKey)) return false;
|
if(!translationKey.equals(that.translationKey)) return false;
|
||||||
if (!Arrays.equals(translationParams, that.translationParams)) return false;
|
if(!Arrays.equals(translationParams, that.translationParams)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,14 @@ public class PlayerInfo {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
PlayerInfo that = (PlayerInfo) o;
|
PlayerInfo that = (PlayerInfo) o;
|
||||||
|
|
||||||
if (max != that.max) return false;
|
if(max != that.max) return false;
|
||||||
if (online != that.online) return false;
|
if(online != that.online) return false;
|
||||||
if (!Arrays.equals(players, that.players)) return false;
|
if(!Arrays.equals(players, that.players)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,15 +36,15 @@ public class ServerStatusInfo {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ServerStatusInfo that = (ServerStatusInfo) o;
|
ServerStatusInfo that = (ServerStatusInfo) o;
|
||||||
|
|
||||||
if (!description.equals(that.description)) return false;
|
if(!description.equals(that.description)) return false;
|
||||||
if (icon != null ? !icon.equals(that.icon) : that.icon != null) return false;
|
if(icon != null ? !icon.equals(that.icon) : that.icon != null) return false;
|
||||||
if (!players.equals(that.players)) return false;
|
if(!players.equals(that.players)) return false;
|
||||||
if (!version.equals(that.version)) return false;
|
if(!version.equals(that.version)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,13 @@ public class VersionInfo {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
VersionInfo that = (VersionInfo) o;
|
VersionInfo that = (VersionInfo) o;
|
||||||
|
|
||||||
if (protocol != that.protocol) return false;
|
if(protocol != that.protocol) return false;
|
||||||
if (!name.equals(that.name)) return false;
|
if(!name.equals(that.name)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,15 @@ package org.spacehq.mc.protocol.packet.ingame.client.window;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.ItemStack;
|
import org.spacehq.mc.protocol.data.game.ItemStack;
|
||||||
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
||||||
import org.spacehq.mc.protocol.data.game.values.window.*;
|
import org.spacehq.mc.protocol.data.game.values.window.ClickItemParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.CreativeGrabParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.DropItemParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.FillStackParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.MoveToHotbarParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.ShiftClickItemParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.SpreadItemParam;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.WindowAction;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.window.WindowActionParam;
|
||||||
import org.spacehq.mc.protocol.util.NetUtil;
|
import org.spacehq.mc.protocol.util.NetUtil;
|
||||||
import org.spacehq.packetlib.io.NetInput;
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
import org.spacehq.packetlib.io.NetOutput;
|
import org.spacehq.packetlib.io.NetOutput;
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
package org.spacehq.mc.protocol.packet.ingame.server;
|
package org.spacehq.mc.protocol.packet.ingame.server;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
||||||
import org.spacehq.mc.protocol.data.game.values.statistic.*;
|
import org.spacehq.mc.protocol.data.game.values.statistic.Achievement;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.statistic.BreakBlockStatistic;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.statistic.BreakItemStatistic;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.statistic.CraftItemStatistic;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.statistic.GenericStatistic;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.statistic.Statistic;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.statistic.UseItemStatistic;
|
||||||
import org.spacehq.packetlib.io.NetInput;
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
import org.spacehq.packetlib.io.NetOutput;
|
import org.spacehq.packetlib.io.NetOutput;
|
||||||
import org.spacehq.packetlib.packet.Packet;
|
import org.spacehq.packetlib.packet.Packet;
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
package org.spacehq.mc.protocol.packet.ingame.server.entity.spawn;
|
package org.spacehq.mc.protocol.packet.ingame.server.entity.spawn;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
||||||
import org.spacehq.mc.protocol.data.game.values.entity.*;
|
import org.spacehq.mc.protocol.data.game.values.entity.FallingBlockData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.HangingDirection;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.MinecartType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.ObjectData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.ObjectType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.ProjectileData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.entity.SplashPotionData;
|
||||||
import org.spacehq.packetlib.io.NetInput;
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
import org.spacehq.packetlib.io.NetOutput;
|
import org.spacehq.packetlib.io.NetOutput;
|
||||||
import org.spacehq.packetlib.packet.Packet;
|
import org.spacehq.packetlib.packet.Packet;
|
||||||
|
|
|
@ -139,10 +139,10 @@ public class ServerTeamPacket implements Packet {
|
||||||
out.writeString(this.prefix);
|
out.writeString(this.prefix);
|
||||||
out.writeString(this.suffix);
|
out.writeString(this.suffix);
|
||||||
byte flags = 0;
|
byte flags = 0;
|
||||||
if (this.friendlyFire) {
|
if(this.friendlyFire) {
|
||||||
flags |= 0x1;
|
flags |= 0x1;
|
||||||
}
|
}
|
||||||
if (this.seeFriendlyInvisibles) {
|
if(this.seeFriendlyInvisibles) {
|
||||||
flags |= 0x2;
|
flags |= 0x2;
|
||||||
}
|
}
|
||||||
out.writeByte(flags);
|
out.writeByte(flags);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ServerBlockBreakAnimPacket implements Packet {
|
||||||
this.breakerEntityId = in.readVarInt();
|
this.breakerEntityId = in.readVarInt();
|
||||||
this.position = NetUtil.readPosition(in);
|
this.position = NetUtil.readPosition(in);
|
||||||
this.stage = MagicValues.key(BlockBreakStage.class, in.readUnsignedByte());
|
this.stage = MagicValues.key(BlockBreakStage.class, in.readUnsignedByte());
|
||||||
if (this.stage == null) {
|
if(this.stage == null) {
|
||||||
this.stage = BlockBreakStage.RESET;
|
this.stage = BlockBreakStage.RESET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,18 @@ package org.spacehq.mc.protocol.packet.ingame.server.world;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.Position;
|
import org.spacehq.mc.protocol.data.game.Position;
|
||||||
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.block.value.*;
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.BlockValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.BlockValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.ChestValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.ChestValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.GenericBlockValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.GenericBlockValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.MobSpawnerValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.MobSpawnerValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.NoteBlockValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.NoteBlockValueType;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.PistonValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.block.value.PistonValueType;
|
||||||
import org.spacehq.mc.protocol.util.NetUtil;
|
import org.spacehq.mc.protocol.util.NetUtil;
|
||||||
import org.spacehq.packetlib.io.NetInput;
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
import org.spacehq.packetlib.io.NetOutput;
|
import org.spacehq.packetlib.io.NetOutput;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.spacehq.mc.protocol.packet.ingame.server.world;
|
package org.spacehq.mc.protocol.packet.ingame.server.world;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.map.*;
|
import org.spacehq.mc.protocol.data.game.values.world.map.MapData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.map.MapPlayer;
|
||||||
import org.spacehq.packetlib.io.NetInput;
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
import org.spacehq.packetlib.io.NetOutput;
|
import org.spacehq.packetlib.io.NetOutput;
|
||||||
import org.spacehq.packetlib.packet.Packet;
|
import org.spacehq.packetlib.packet.Packet;
|
||||||
|
|
|
@ -2,7 +2,11 @@ package org.spacehq.mc.protocol.packet.ingame.server.world;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
||||||
import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
|
import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.notify.*;
|
import org.spacehq.mc.protocol.data.game.values.world.notify.ClientNotification;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.notify.ClientNotificationValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.notify.DemoMessageValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.notify.RainStrengthValue;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.notify.ThunderStrengthValue;
|
||||||
import org.spacehq.packetlib.io.NetInput;
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
import org.spacehq.packetlib.io.NetOutput;
|
import org.spacehq.packetlib.io.NetOutput;
|
||||||
import org.spacehq.packetlib.packet.Packet;
|
import org.spacehq.packetlib.packet.Packet;
|
||||||
|
|
|
@ -2,7 +2,15 @@ package org.spacehq.mc.protocol.packet.ingame.server.world;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.Position;
|
import org.spacehq.mc.protocol.data.game.Position;
|
||||||
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
||||||
import org.spacehq.mc.protocol.data.game.values.world.effect.*;
|
import org.spacehq.mc.protocol.data.game.values.world.effect.BreakBlockEffectData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.effect.BreakPotionEffectData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.effect.HardLandingEffectData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.effect.ParticleEffect;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.effect.RecordEffectData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.effect.SmokeEffectData;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.effect.SoundEffect;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.effect.WorldEffect;
|
||||||
|
import org.spacehq.mc.protocol.data.game.values.world.effect.WorldEffectData;
|
||||||
import org.spacehq.mc.protocol.util.NetUtil;
|
import org.spacehq.mc.protocol.util.NetUtil;
|
||||||
import org.spacehq.packetlib.io.NetInput;
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
import org.spacehq.packetlib.io.NetOutput;
|
import org.spacehq.packetlib.io.NetOutput;
|
||||||
|
|
|
@ -6,7 +6,15 @@ import javax.crypto.SecretKey;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.*;
|
import java.security.GeneralSecurityException;
|
||||||
|
import java.security.Key;
|
||||||
|
import java.security.KeyFactory;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.KeyPairGenerator;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
import java.security.PublicKey;
|
||||||
import java.security.spec.X509EncodedKeySpec;
|
import java.security.spec.X509EncodedKeySpec;
|
||||||
|
|
||||||
public class CryptUtil {
|
public class CryptUtil {
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
package org.spacehq.mc.protocol.util;
|
package org.spacehq.mc.protocol.util;
|
||||||
|
|
||||||
import org.spacehq.mc.protocol.data.game.*;
|
import org.spacehq.mc.protocol.data.game.Chunk;
|
||||||
|
import org.spacehq.mc.protocol.data.game.EntityMetadata;
|
||||||
|
import org.spacehq.mc.protocol.data.game.ItemStack;
|
||||||
|
import org.spacehq.mc.protocol.data.game.NibbleArray3d;
|
||||||
|
import org.spacehq.mc.protocol.data.game.Position;
|
||||||
|
import org.spacehq.mc.protocol.data.game.Rotation;
|
||||||
|
import org.spacehq.mc.protocol.data.game.ShortArray3d;
|
||||||
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
import org.spacehq.mc.protocol.data.game.values.MagicValues;
|
||||||
import org.spacehq.mc.protocol.data.game.values.entity.MetadataType;
|
import org.spacehq.mc.protocol.data.game.values.entity.MetadataType;
|
||||||
import org.spacehq.opennbt.NBTIO;
|
import org.spacehq.opennbt.NBTIO;
|
||||||
|
@ -8,7 +14,11 @@ import org.spacehq.opennbt.tag.builtin.CompoundTag;
|
||||||
import org.spacehq.packetlib.io.NetInput;
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
import org.spacehq.packetlib.io.NetOutput;
|
import org.spacehq.packetlib.io.NetOutput;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.nio.ShortBuffer;
|
import java.nio.ShortBuffer;
|
||||||
|
|
|
@ -32,14 +32,14 @@ public class NetworkChunkData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
NetworkChunkData that = (NetworkChunkData) o;
|
NetworkChunkData that = (NetworkChunkData) o;
|
||||||
|
|
||||||
if (fullChunk != that.fullChunk) return false;
|
if(fullChunk != that.fullChunk) return false;
|
||||||
if (mask != that.mask) return false;
|
if(mask != that.mask) return false;
|
||||||
if (sky != that.sky) return false;
|
if(sky != that.sky) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,13 @@ public class ParsedChunkData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if(this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if(o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
ParsedChunkData that = (ParsedChunkData) o;
|
ParsedChunkData that = (ParsedChunkData) o;
|
||||||
|
|
||||||
if (!Arrays.equals(biomes, that.biomes)) return false;
|
if(!Arrays.equals(biomes, that.biomes)) return false;
|
||||||
if (!Arrays.equals(chunks, that.chunks)) return false;
|
if(!Arrays.equals(chunks, that.chunks)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue