+ * After parsing use the following methods: {@link #getPaste()} {@link PastebinPaste#getContents()}
+ */
+ public void fetchContent() {
+ if(getPaste().getContents() != null) {
+ throw new IllegalStateException("Contents already fetched.");
+ }
+ getPaste().setContents(getContents(getKey()));
+ }
+
+ /**
+ * Sets the paste page hits
+ *
+ * @param hits
+ * amount of times paste has been visited
+ */
+ public void setHits(int hits) {
+ if (hits < 0) {
+ throw new IllegalArgumentException("Hits must be positive: " + hits);
+ }
+ this.hits = hits;
+ }
+
+ /**
+ * Gets the paste page hits
+ *
+ * @return paste page hits
+ */
+ public int getHits() {
+ return this.hits;
+ }
+
+ /**
+ * Gets the paste date
+ *
+ * @return paste date
+ */
+ public Date getPasteDate() {
+ return this.pasteDate;
+ }
+
+ /**
+ * Deletes this paste
+ *
+ * @param account
+ * the account which was used to create this paste
+ * @param developerKey
+ * a developer key which can be fetched from the pastebin API
+ * page
+ * @throws PasteException if it failed to delete the paste
+ */
+ public void delete(String developerKey, PastebinAccount account) throws PasteException {
+ if(developerKey == null || developerKey.isEmpty()) {
+ throw new IllegalArgumentException("Developer key can't be null or empty.");
+ }
+ if(account.getUserSessionId() == null || account.getUserSessionId().isEmpty()) {
+ throw new IllegalArgumentException("Account user session id is missing.");
+ }
+ Post post = new Post();
+ post.put("api_dev_key", developerKey);
+ post.put("api_user_key", account.getUserSessionId());
+ post.put("api_paste_key", getKey());
+ post.put("api_option", "delete");
+
+ String response = Web.getContents(Pastebin.API_POST_LINK, post);
+ if(response.equals("Paste Removed")) {
+ return;
+ }
+ throw new PasteException("Failed to delete paste: " + response);
+ }
+
+ /**
+ * Deletes this paste
+ * @throws PasteException if it failed to delete the paste
+ */
+ public void delete() throws PasteException {
+ delete(getPaste().getDeveloperKey(), getPaste().getAccount());
+ }
+
+ /**
+ * Fetches a paste text from pastebin
+ *
+ * @param pasteKey
+ * the unique paste key
+ * @return contents of the paste
+ */
+ public static String getContents(String pasteKey) {
+ return Web.getContents("https://pastebin.com/raw.php?i=" + pasteKey);
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/PastebinPaste.java b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/PastebinPaste.java
new file mode 100644
index 0000000..605a6b3
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/PastebinPaste.java
@@ -0,0 +1,314 @@
+package net.aeroclient.pastebin.pastebin;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import net.aeroclient.pastebin.AbstractPaste;
+import net.aeroclient.pastebin.exceptions.PasteException;
+import net.aeroclient.pastebin.pastebin.Pastebin;
+import net.aeroclient.pastebin.pastebin.PastebinLink;
+import net.aeroclient.pastebin.pastebin.account.PastebinAccount;
+import net.aeroclient.pastebin.utils.web.Post;
+import net.aeroclient.pastebin.utils.web.Web;
+
+/**
+ *
+ * A representation of a new or existing paste.
+ *
+ *
+ * This class holds the contents of the paste itself. You can get and modify
+ * settings and then 'push' this paste onto pastebin.
+ *
+ *
+ * {
+ /**
+ * Makes a paste public.
+ */
+ public static final int VISIBILITY_PUBLIC = 0;
+ /**
+ * Makes a paste unlisted.
+ */
+ public static final int VISIBILITY_UNLISTED = 1;
+ /**
+ * Makes a paste private.
+ *
+ * Requires an {@link PastebinAccount
+ * net.aeroclient.pastebin.pastebin.account.PastebinAccount PastebinAccount}
+ *
+ */
+ public static final int VISIBILITY_PRIVATE = 2;
+ private String developerKey;
+ private PastebinAccount account;
+ private String pasteTitle;
+ private String pasteFormat;
+ private PasteExpireDate expireDate;
+ private int visibility;
+
+ /**
+ * Creates a new empty PastebinPaste
instance.
+ */
+ public PastebinPaste() {
+ this(null, null, null);
+ }
+
+ /**
+ * Creates a new PastebinPaste
instance.
+ *
+ * @param contents
+ * the paste contents
+ */
+ public PastebinPaste(String contents) {
+ this(null, contents, null);
+ }
+
+ /**
+ * Creates a new PastebinPaste
instance.
+ *
+ * @param account
+ * a pastebin account
+ */
+ public PastebinPaste(PastebinAccount account) {
+ this(account.getDeveloperKey(), null, account);
+ }
+
+ /**
+ * Creates a new PastebinPaste
instance.
+ *
+ * @param developerKey
+ * a developer key which can be fetched from the pastebin API
+ * page
+ * @param contents
+ * the contents of the paste
+ */
+ public PastebinPaste(String developerKey, String contents) {
+ this(developerKey, contents, null);
+ }
+
+ /**
+ * Creates a new PastebinPaste
instance.
+ *
+ * @param developerKey
+ * a developer key which can be fetched from the pastebin API
+ * page
+ * @param contents
+ * the contents of the paste
+ * @param account
+ * a pastebin account
+ */
+ public PastebinPaste(String developerKey, String contents,
+ PastebinAccount account) {
+ super(contents);
+ this.developerKey = developerKey;
+ this.account = account;
+ }
+
+ /**
+ * Sets the pastebin account If you set an account the pastes will be listed
+ * on your account.
+ *
+ * @param account
+ * a pastebin account
+ */
+ public void setAccount(PastebinAccount account) {
+ this.account = account;
+ }
+
+ /**
+ * Gets the pastebin account
+ *
+ * @return pastebin account
+ */
+ public PastebinAccount getAccount() {
+ return this.account;
+ }
+
+ /**
+ * Sets the developer key The developer key is required to paste contents on
+ * pastebin
+ *
+ * @param developerKey
+ * a developer key which can be fetched from the pastebin API
+ * page
+ */
+ public void setDeveloperKey(String developerKey) {
+ if (developerKey == null || developerKey.isEmpty()) {
+ throw new IllegalArgumentException(
+ "Developer key can not be null or empty.");
+ }
+ this.developerKey = developerKey;
+ }
+
+ /**
+ * Sets the paste expire date
+ *
+ * @param date
+ * date when the paste will be removed
+ */
+ public void setPasteExpireDate(PasteExpireDate date) {
+ this.expireDate = date;
+ }
+
+ /**
+ * Gets the developer key
+ *
+ * @return developer key
+ */
+ public String getDeveloperKey() {
+ return this.developerKey;
+ }
+
+ /**
+ * Sets the paste title
+ *
+ * @param title
+ * title of the paste
+ */
+ public void setPasteTitle(String title) {
+ this.pasteTitle = title;
+ }
+
+ /**
+ * Gets paste title
+ *
+ * @return paste title
+ */
+ public String getPasteTitle() {
+ return this.pasteTitle;
+ }
+
+ /**
+ * Gets paste expire date
+ * @return paste expire date
+ */
+ public PasteExpireDate getPasteExpireDate() {
+ return this.expireDate;
+ }
+
+ /**
+ * Sets the paste format The format is used for syntax highlighting
+ *
+ * @see available syntax highlighting
+ * formats
+ * @param format
+ * format of the paste
+ */
+ public void setPasteFormat(String format) {
+ this.pasteFormat = format;
+ }
+
+ /**
+ * Gets paste format
+ *
+ * @return paste format
+ */
+ public String getPasteFormat() {
+ return this.pasteFormat;
+ }
+
+ /**
+ * Makes this paste private, unlisted or public Default visibility is public
+ *
+ * Valid visibilities
+ *
+ *
+ * {@link PastebinPaste#VISIBILITY_PUBLIC}
+ *
+ *
+ * {@link PastebinPaste#VISIBILITY_UNLISTED}
+ *
+ *
+ * {@link PastebinPaste#VISIBILITY_PRIVATE}
+ *
+ *
+ * @param visibility
+ * the paste it's visibility
+ */
+ public void setVisibility(int visibility) {
+ if (visibility < 0 || visibility > 2) {
+ throw new IllegalArgumentException("Unknown visibility: "
+ + visibility);
+ }
+ this.visibility = visibility;
+ }
+
+ /**
+ * Gets this paste visibility
+ *
+ * Valid visibilities
+ *
+ *
+ * {@link PastebinPaste#VISIBILITY_PUBLIC}
+ *
+ *
+ * {@link PastebinPaste#VISIBILITY_UNLISTED}
+ *
+ *
+ * {@link PastebinPaste#VISIBILITY_PRIVATE}
+ *
+ *
+ * @return visibility of this paste
+ */
+ public int getVisibility() {
+ return this.visibility;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public net.aeroclient.pastebin.pastebin.PastebinLink paste() throws PasteException {
+ if (getContents() == null || getContents().isEmpty()) {
+ throw new IllegalStateException("Paste can not be null or empty.");
+ }
+ if (getDeveloperKey() == null || getDeveloperKey().isEmpty()) {
+ throw new IllegalStateException("Developer key is missing.");
+ }
+
+ Post post = new Post();
+
+ // required parameters
+ post.put("api_dev_key", getDeveloperKey());
+ post.put("api_option", "paste");
+ post.put("api_paste_code", getContents());
+
+ // optional parameters
+ if (this.account != null && this.account.getUserSessionId() != null) {
+ post.put("api_user_key", this.account.getUserSessionId());
+ }
+ if (this.pasteTitle != null) {
+ post.put("api_paste_name", getPasteTitle());
+ }
+ if (this.pasteFormat != null) {
+ post.put("api_paste_format", getPasteFormat());
+ }
+ post.put("api_paste_private", Integer.toString(getVisibility()));
+ if (this.expireDate != null) {
+ post.put("api_paste_expire_date", expireDate.getValue());
+ }
+
+ try {
+ String pageResponse = Web.getContents(Pastebin.API_POST_LINK, post);
+ if (pageResponse.startsWith("http")) {
+ // success
+ net.aeroclient.pastebin.pastebin.PastebinLink result = new PastebinLink(this, new URL(
+ pageResponse));
+ return result;
+ }
+ throw new PasteException("Failed to generate paste: "
+ + pageResponse);
+ } catch (MalformedURLException e) {
+ // shouldn't happen
+ throw new PasteException("Failed to generate paste: " + e);
+ }
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/account/PastebinAccount.java b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/account/PastebinAccount.java
new file mode 100644
index 0000000..fa425c7
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/account/PastebinAccount.java
@@ -0,0 +1,370 @@
+package net.aeroclient.pastebin.pastebin.account;
+
+import java.io.ByteArrayInputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import net.aeroclient.pastebin.pastebin.PasteExpireDate;
+import net.aeroclient.pastebin.pastebin.Pastebin;
+import net.aeroclient.pastebin.pastebin.PastebinLink;
+import net.aeroclient.pastebin.pastebin.PastebinPaste;
+import net.aeroclient.pastebin.pastebin.exceptions.LoginException;
+import net.aeroclient.pastebin.pastebin.exceptions.ParseException;
+import net.aeroclient.pastebin.utils.web.Post;
+import net.aeroclient.pastebin.utils.web.Web;
+import net.aeroclient.pastebin.utils.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/**
+ *
+ * Represents an account on Pastebin .
+ *
+ *
+ * This class can fetch a non-expiring user session id. This session id is used
+ * for generating private pasted, fetching user details, fetching user his
+ * pastes, adding pastes to his account & more account based interactions.
+ *
+ *
+ *
+ * A reference manual for generating a user session id can be found here .
+ *
+ * @author Brian B
+ *
+ */
+public class PastebinAccount {
+ private String username, password, userSessionId, developerKey;
+
+ /**
+ * Creates a new empty PastebinAccount
instance.
+ */
+ public PastebinAccount() {
+ this(null, null, null);
+ }
+
+ /**
+ * Creates a new PastebinAccount
instance.
+ *
+ * When you use this constructor, you'll need to use the {@link #login()} to
+ * fetch an user session id
+ *
+ * @param developerKey
+ * a developer key which can be fetched from the pastebin API
+ * page
+ * @param username
+ * the username of the pastebin account
+ * @param password
+ * the password of the pastebin account
+ */
+ public PastebinAccount(String developerKey, String username, String password) {
+ this.developerKey = developerKey;
+ this.username = username;
+ this.password = password;
+ }
+
+ /**
+ * Creates a new PastebinAccount
instance.
+ *
+ * @param userSessionId
+ * the user session id of the pastebin account.
+ */
+ public PastebinAccount(String userSessionId) {
+ this(null, userSessionId);
+ }
+
+ /**
+ * Creates a new PastebinAccount
instance.
+ *
+ * @param developerKey
+ * a developer key which can be fetched from the pastebin API
+ * page
+ * @param userSessionId
+ * the user session id of the pastebin account.
+ */
+ public PastebinAccount(String developerKey, String userSessionId) {
+ this.developerKey = developerKey;
+ this.userSessionId = userSessionId;
+ }
+
+ /**
+ * Sets the user session id The user session id can be used to paste private
+ * pastes and will add pastes to your account
+ *
+ * @param userSessionId
+ * the user session id of the pastebin account
+ */
+ public void setUserSessionId(String userSessionId) {
+ this.userSessionId = userSessionId;
+ }
+
+ /**
+ * Gets the user session id
+ *
+ * @return user session id
+ */
+ public String getUserSessionId() {
+ return this.userSessionId;
+ }
+
+ /**
+ * Sets the username
+ *
+ * @param username
+ * the username of the pastebin account
+ */
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ /**
+ * Gets username of the pastebin account
+ *
+ * @return username of the pastebin account. Could be null if only an user
+ * session is was provided.
+ */
+ public String getUsername() {
+ return this.username;
+ }
+
+ /**
+ * Sets the password
+ *
+ * @param password
+ * the password of the pastebin account
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ /**
+ * Gets password of the pastebin account
+ *
+ * @return password of the pastebin account. Could be null if only an user
+ * session id was provided.
+ */
+ public String getPassword() {
+ return this.password;
+ }
+
+ /**
+ * Sets the developer key The developer key is required to paste contents on
+ * pastebin
+ *
+ * @param developerKey
+ * a developer key which can be fetched from the pastebin API
+ * page
+ */
+ public void setDeveloperKey(String developerKey) {
+ if (developerKey == null || developerKey.isEmpty()) {
+ throw new IllegalArgumentException(
+ "Developer key can not be null or empty.");
+ }
+ this.developerKey = developerKey;
+ }
+
+ /**
+ * Gets the developer key
+ *
+ * @return developer key
+ */
+ public String getDeveloperKey() {
+ return this.developerKey;
+ }
+
+ /**
+ * Fetches an user session id.
+ *
+ * @throws LoginException
+ * if fetching the user session id failed
+ */
+ public void login() throws LoginException {
+ if (getUserSessionId() != null) {
+ throw new IllegalStateException("Already logged in.");
+ }
+ if (getUsername() == null || getPassword() == null) {
+ throw new IllegalStateException("Username or password null.");
+ }
+ if (getDeveloperKey() == null || getDeveloperKey().isEmpty()) {
+ throw new IllegalStateException("Developer key is missing.");
+ }
+
+ Post post = new Post();
+
+ post.put("api_dev_key", getDeveloperKey());
+ post.put("api_user_name", username);
+ post.put("api_user_password", password);
+
+ String response = Web.getContents(Pastebin.API_LOGIN_LINK, post);
+ if (response == null || response.isEmpty()) {
+ throw new LoginException("Empty response from login API server.");
+ }
+ if (response.toLowerCase().startsWith("bad")) {
+ throw new LoginException("Failed to login: " + response);
+ }
+
+ this.userSessionId = response;
+ }
+
+ /**
+ * Gets all pasted pastes by this user
+ *
+ * @param limit
+ * maximum amount of pastes to receive
+ *
+ * 0 > limit > 1000
+ *
+ * @return all pasted pastes made by this user/account
+ * @throws ParseException
+ * if it failed to parse the pastes
+ */
+ public PastebinLink[] getPastes(int limit) throws ParseException {
+ if (limit > 1000) {
+ limit = 1000;
+ }
+ if (limit < 1) {
+ limit = 1;
+ }
+ if (getUserSessionId() == null) {
+ throw new IllegalStateException("User session id missing.");
+ }
+ if (getDeveloperKey() == null || getDeveloperKey().isEmpty()) {
+ throw new IllegalStateException("Developer key is missing.");
+ }
+
+ Post post = new Post();
+
+ post.put("api_dev_key", getDeveloperKey());
+ post.put("api_user_key", getUserSessionId());
+ post.put("api_results_limit", Integer.toString(limit));
+ post.put("api_option", "list");
+
+ String response = Web.getContents(Pastebin.API_POST_LINK, post);
+ if (response.equals("No pastes found.")) {
+ return null;
+ }
+
+ if (response.startsWith("")) {
+ // success
+ try {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ response = "" + response + " "; // requires root
+ // element
+ Document doc = dBuilder.parse(new InputSource(
+ new ByteArrayInputStream(response.getBytes("utf-8"))));
+ doc.getDocumentElement().normalize();
+
+ NodeList nodes = doc.getElementsByTagName("paste");
+ ArrayList pastes = new ArrayList(
+ nodes.getLength());
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node node = nodes.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) node;
+
+ String pasteFormat = XMLUtils.getText(element,
+ "paste_format_short");
+ String title = XMLUtils.getText(element, "paste_title");
+ int visibility = Integer.parseInt(XMLUtils.getText(
+ element, "paste_private"));
+ int hits = Integer.parseInt(XMLUtils.getText(element,
+ "paste_hits"));
+
+ long expireDate = Long.parseLong(XMLUtils.getText(
+ element, "paste_expire_date"));
+ long pasteDate = Long.parseLong(XMLUtils.getText(
+ element, "paste_date"));
+
+ URL pasteURL = new URL(XMLUtils.getText(element,
+ "paste_url"));
+
+ PastebinPaste paste = new PastebinPaste(this);
+ paste.setPasteFormat(pasteFormat);
+ paste.setPasteTitle(title);
+ paste.setVisibility(visibility);
+ paste.setPasteExpireDate(expireDate == 0L ? PasteExpireDate.NEVER
+ : PasteExpireDate
+ .getExpireDate((int) (expireDate - pasteDate)));
+
+ PastebinLink pastebinLink = new PastebinLink(paste,
+ pasteURL, new Date(pasteDate * 1000));
+ pastebinLink.setHits(hits);
+
+ pastes.add(pastebinLink);
+ }
+ }
+
+ return pastes.toArray(new PastebinLink[pastes.size()]);
+ } catch (Exception e) {
+ throw new ParseException("Failed to parse pastes: "
+ + e.getMessage());
+ }
+
+ }
+
+ throw new ParseException("Failed to parse pastes: " + response);
+ }
+
+ /**
+ * Gets pasted pastes (max 50) by this user
+ *
+ * @return all pasted pastes made by this user/account
+ * @throws ParseException
+ * if it failed to parse the pastes
+ */
+ public PastebinLink[] getPastes() throws ParseException {
+ return getPastes(50);
+ }
+
+ /**
+ * Fetches the account details of this account
+ *
+ * @return account details
+ * @throws ParseException
+ * if it failed to parse the account details
+ */
+ public PastebinAccountDetails getAccountDetails() throws ParseException {
+ if (getUserSessionId() == null) {
+ throw new IllegalStateException("User session id missing.");
+ }
+ if (getDeveloperKey() == null || getDeveloperKey().isEmpty()) {
+ throw new IllegalStateException("Developer key is missing.");
+ }
+
+ Post post = new Post();
+ post.put("api_dev_key", getDeveloperKey());
+ post.put("api_user_key", getUserSessionId());
+ post.put("api_option", "userdetails");
+
+ String response = Web.getContents(Pastebin.API_POST_LINK, post);
+
+ if (!response.startsWith("")) {
+ throw new ParseException("Failed to parse account details: "
+ + response);
+ }
+
+ try {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ Document doc = dBuilder.parse(new InputSource(
+ new ByteArrayInputStream(response.getBytes("utf-8"))));
+ doc.getDocumentElement().normalize();
+
+ return new PastebinAccountDetails((Element) doc
+ .getElementsByTagName("user").item(0));
+ } catch (Exception e) {
+ throw new ParseException("Failed to parse account details: " + e);
+ }
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/account/PastebinAccountDetails.java b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/account/PastebinAccountDetails.java
new file mode 100644
index 0000000..a45423f
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/account/PastebinAccountDetails.java
@@ -0,0 +1,135 @@
+package net.aeroclient.pastebin.pastebin.account;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+
+import net.aeroclient.pastebin.utils.xml.XMLUtils;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * Holds information and settings of a pastebin account.
+ *
+ * @author Brian B
+ *
+ */
+public class PastebinAccountDetails {
+ private String username, format, expiration, avatarURL, website, email, location;
+ private int userPrivate, accountType;
+
+ /**
+ * Creates a new PastebinAccountDetails
instance.
+ *
+ * @param userElement
+ * the 'user' xml elements received from the pastebin API
+ */
+ public PastebinAccountDetails(Element userElement) {
+ this.username = XMLUtils.getText(userElement, "user_name");
+ this.format = XMLUtils.getText(userElement, "user_format_short");
+ this.expiration = XMLUtils.getText(userElement, "user_expiration");
+ this.avatarURL = XMLUtils.getText(userElement, "user_avatar_url");
+ this.userPrivate = Integer.parseInt(XMLUtils.getText(userElement, "user_private"));
+ this.website = XMLUtils.getText(userElement, "user_website");
+ this.email = XMLUtils.getText(userElement, "user_email");
+ this.location = XMLUtils.getText(userElement, "user_location");
+ this.accountType = Integer.parseInt(XMLUtils.getText(userElement, "user_account_type"));
+ }
+
+ /**
+ * Gets the username of this account
+ * @return username
+ */
+ public String getUsername() {
+ return this.username;
+ }
+
+ /**
+ * Gets user text format
+ * @return user text format
+ */
+ public String getFormat() {
+ return this.format;
+ }
+
+ /**
+ * Gets this account expiration time
+ *
+ * N = never (default)
+ *
+ * @return account expiration time
+ */
+ public String getExpiration() {
+ return this.expiration;
+ }
+
+ /**
+ * Gets URL to avatar image
+ * @return URL to avatar image
+ * @throws MalformedURLException
+ */
+ public URL getAvatarURL() throws MalformedURLException {
+ return new URL(this.avatarURL);
+ }
+
+ /**
+ * Gets user visibility
+ *
+ * 0 = public
+ * 1 = unlisted
+ * 2 = private
+ *
+ * @return visibility of account
+ */
+ public int getPrivate() {
+ return this.userPrivate;
+ }
+
+ /**
+ * Gets the user's set website
+ * @return url to website
+ * @throws MalformedURLException
+ */
+ public URL getWebsite() throws MalformedURLException {
+ if(this.website.isEmpty()) {
+ return null;
+ }
+ return new URL(this.website);
+ }
+
+ /**
+ * Gets the user e-mail
+ * @return user account e-mail
+ */
+ public String getEmail() {
+ return this.email;
+ }
+
+ /**
+ * Gets the user's set location
+ * @return location, city
+ */
+ public String getLocation() {
+ return this.location;
+ }
+
+ /**
+ * Determines if this account is a 'pro' account
+ * @return true
if this account is a pro account, otherwise false
.
+ */
+ public boolean isPro() {
+ return accountType == 1;
+ }
+
+ /**
+ * Fetches the user his avatar from {@link #getAvatarURL()}
+ * @return image
+ * @throws IOException if image was not read
+ */
+ public BufferedImage getAvatar() throws IOException {
+ return ImageIO.read(getAvatarURL());
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/exceptions/LoginException.java b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/exceptions/LoginException.java
new file mode 100644
index 0000000..da9dc2f
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/exceptions/LoginException.java
@@ -0,0 +1,12 @@
+package net.aeroclient.pastebin.pastebin.exceptions;
+
+public class LoginException extends Exception {
+ private static final long serialVersionUID = -4230960075582953775L;
+
+ public LoginException() {
+ }
+
+ public LoginException(String message) {
+ super(message);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/exceptions/ParseException.java b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/exceptions/ParseException.java
new file mode 100644
index 0000000..a7ca8da
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/pastebin/exceptions/ParseException.java
@@ -0,0 +1,13 @@
+package net.aeroclient.pastebin.pastebin.exceptions;
+
+public class ParseException extends Exception {
+ private static final long serialVersionUID = -4230960075582953775L;
+
+ public ParseException() {
+ }
+
+ public ParseException(String message) {
+ super(message);
+ }
+}
+
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/web/Post.java b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/web/Post.java
new file mode 100644
index 0000000..5a432ce
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/web/Post.java
@@ -0,0 +1,66 @@
+package net.aeroclient.pastebin.utils.web;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map.Entry;
+
+/**
+ *
+ * A representation of a HTTP post
+ *
+ *
+ * Encodes parameters with the UTF-8 Charset.
+ *
+ *
+ *
+ * Reference manual
+ *
+ *
+ * @author Brian B
+ *
+ */
+public class Post {
+ private static final String ENCODING = "UTF-8";
+ private HashMap post;
+
+ /**
+ * Creates a new Post
instance.
+ */
+ public Post() {
+ post = new HashMap();
+ }
+
+ /**
+ * Adds a key value pair to the post parameters
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
+ */
+ public void put(String key, String value) {
+ try {
+ this.post.put(URLEncoder.encode(key, ENCODING),
+ URLEncoder.encode(value, ENCODING));
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * The HTTP post string representation
+ *
+ * @return HTTP Post contents
+ */
+ public String getPost() {
+ StringBuilder builder = new StringBuilder();
+ for (Entry entry : post.entrySet()) {
+ builder.append(entry.getKey()).append('=').append(entry.getValue())
+ .append('&');
+ }
+ builder.deleteCharAt(builder.length() - 1);
+ return new String(builder);
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/web/Web.java b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/web/Web.java
new file mode 100644
index 0000000..2bd3d21
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/web/Web.java
@@ -0,0 +1,75 @@
+package net.aeroclient.pastebin.utils.web;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ *
+ * Web utility class
+ *
+ * @author Brian B
+ *
+ */
+public class Web {
+
+ /**
+ * Submits a HTTP post and fetches and returns the response
+ *
+ * @param link
+ * The link/URL
+ * @param post
+ * the HTTP post representation
+ * @return response of the web page
+ */
+ public static String getContents(String link, Post post) {
+ try {
+ URL url = new URL(link);
+
+ URLConnection connection = url.openConnection();
+
+ if(post != null) {
+ connection.setDoOutput(true);
+ OutputStreamWriter wr = new OutputStreamWriter(
+ connection.getOutputStream());
+ wr.write(post.getPost());
+ wr.flush();
+ wr.close();
+ }
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ connection.getInputStream()));
+ StringBuilder builder = new StringBuilder();
+ String line;
+ while ((line = reader.readLine()) != null) {
+ if (builder.length() > 0) {
+ builder.append('\n');
+ }
+ builder.append(line);
+ }
+ reader.close();
+ return new String(builder);
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException("Malformed link: " + e);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to fetch contents from link: "
+ + e);
+ }
+ }
+
+ /**
+ * Gets text from a link
+ *
+ * @param link
+ * The link/URL
+ * @return response of the web page
+ */
+ public static String getContents(String link) {
+ return getContents(link, null);
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/xml/XMLUtils.java b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/xml/XMLUtils.java
new file mode 100644
index 0000000..1156e27
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/pastebin/utils/xml/XMLUtils.java
@@ -0,0 +1,27 @@
+package net.aeroclient.pastebin.utils.xml;
+
+import org.w3c.dom.Element;
+
+/**
+ *
+ * Holds various XML utility methods
+ *
+ * @author Brian B
+ *
+ */
+public class XMLUtils {
+
+ /**
+ * Fetches text from a element
+ *
+ * @param parent
+ * the parent of the element you want to fetch text from
+ * @param tagName
+ * name of the element you want to fetch text from
+ * @return text of tag
+ */
+ public static String getText(Element parent, String tagName) {
+ return parent.getElementsByTagName(tagName).item(0).getTextContent();
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/WebServer.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/WebServer.java
new file mode 100644
index 0000000..8eef935
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/WebServer.java
@@ -0,0 +1,303 @@
+package net.aeroclient.websocket;
+
+
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import com.mongodb.DBCollection;
+import com.mongodb.DBCursor;
+import com.mongodb.DBObject;
+import com.mongodb.client.FindIterable;
+import com.mongodb.client.MongoCollection;
+import io.netty.buffer.Unpooled;
+import lombok.*;
+import net.aeroclient.websocket.mongo.MongoManager;
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.player.impl.friend.*;
+import net.aeroclient.websocket.player.impl.friend.builder.PlayerFriendBuilder;
+import net.aeroclient.websocket.player.impl.friend.objects.EnumFriendStatus;
+import net.aeroclient.websocket.player.impl.rank.RankManager;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.server.nethandler.*;
+import net.aeroclient.websocket.server.nethandler.impl.crash.CBPacketCrash;
+import net.aeroclient.websocket.server.nethandler.impl.friend.CBPacketFriendListUpdate;
+import net.aeroclient.websocket.server.nethandler.impl.processes.ProcessCheckerHelperv2;
+import net.aeroclient.websocket.server.objects.EnumServerState;
+import net.aeroclient.websocket.thread.CheckUserThread;
+import net.aeroclient.websocket.utils.*;
+import net.aeroclient.websocket.utils.Commands;
+import net.aeroclient.websocket.uuid.*;
+import org.bson.Document;
+import org.java_websocket.WebSocket;
+import org.java_websocket.handshake.ClientHandshake;
+import org.java_websocket.server.WebSocketServer;
+import redis.clients.jedis.*;
+
+import javax.swing.*;
+import javax.swing.Timer;
+import java.awt.event.*;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.util.*;
+
+public class WebServer extends WebSocketServer {
+ public static Gson GSON = new Gson();
+
+ @Getter private static WebServer instance;
+ @Getter private final MongoManager mongoManager;
+ @Getter private final PlayerManager playerManager;
+ @Getter private final ServerHandler serverHandler;
+ @Getter private final ProcessCheckerHelperv2 processCheckerHelperv2;
+ @Getter private final TopServersPlayed topServersPlayed;
+ @Getter public JedisPool jedisPool;
+ @Getter private static Logger logger;
+ @Getter private int onlineUsers;
+ @Getter private Map keepAlive = Maps.newHashMap();
+ @Getter private Map keepAliveTimer = Maps.newHashMap();
+ private long startTime;
+ private EnumServerState state;
+
+ public WebServer(InetSocketAddress address) {
+ super(address);
+ this.logger = new Logger("AC-WebSocket");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + " Websocket Started" + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + " Address: " + address.getAddress().getCanonicalHostName() + ":" + address.getPort() + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ // Initialise main processes
+ instance = this;
+ this.state = EnumServerState.STARTING;
+
+ this.mongoManager = new MongoManager();
+ WebsocketUUIDCache.init();
+ this.serverHandler = new ServerHandler();
+ this.playerManager = new PlayerManager();
+ this.processCheckerHelperv2 = new ProcessCheckerHelperv2();
+ this.topServersPlayed = new TopServersPlayed();
+ PlayerCosmeticManager.load();
+
+ }
+
+ @Override
+ public void onOpen(WebSocket conn, ClientHandshake handshake) {
+ String handshakeUuid = handshake.getFieldValue("playerId");
+ String handshakeUsername = handshake.getFieldValue("username");
+ String handshakeVersion = handshake.getFieldValue("version");
+ if(handshakeUsername.equalsIgnoreCase("Tellinq")) {
+ String gitCommit = handshake.getFieldValue("gitCommit");
+ String branch = handshake.getFieldValue("branch");
+ String os = handshake.getFieldValue("os");
+ String arch = handshake.getFieldValue("arch");
+ String aalUsername = handshake.getFieldValue("aalUsername");
+ String server = handshake.getFieldValue("server");
+ String launcherVersion = handshake.getFieldValue("launcherVersion");
+ System.out.println(handshakeUsername + " " + handshakeUuid+ " " + handshakeVersion+ " " + gitCommit+ " " + branch+ " " + os+ " " + arch+ " " + aalUsername+ " " + server+ " " + launcherVersion);
+ }
+ // this.logger.info("Connected " + conn.getRemoteSocketAddress());
+ // Prevent playerId from being null or username from being null.
+ onlineUsers++;
+ if(!handshakeUsername.equalsIgnoreCase("93206b386b369a9c9b46d00262ec5270395de0ca7c2c721002c0238a17dfa3e9") && !handshakeUuid.equalsIgnoreCase("069a79f4-44e9-4726-a5be-fca90e38aaf5"))
+ System.out.println("New User " + handshakeUsername + " UUID: " + handshakeUuid );
+ if (handshakeUuid.equals("") || handshakeUsername.equals("") || handshakeVersion.equals("") || handshakeUsername.equals("AeroClient") || handshakeUuid.equals(handshakeUsername)) {
+ if(!handshakeUsername.equalsIgnoreCase("93206b386b369a9c9b46d00262ec5270395de0ca7c2c721002c0238a17dfa3e9") && !handshakeUuid.equalsIgnoreCase("069a79f4-44e9-4726-a5be-fca90e38aaf5")) {
+ serverHandler.sendPacket(conn, new CBPacketCrash());
+ conn.close(1003, "[AC] Illegal Username");
+ return;
+ }
+ } else if (this.hasWebsocketsNotStartedOrClosed() && this.startTime + 5000 > System.currentTimeMillis()) {
+ conn.close(1013, "[AC] Shits not ready");
+ //serverHandler.sendPacket(conn, new CBPacketCrash());
+ return;
+ } else if (this.hasWebsocketsNotStartedOrClosed() && this.startTime + 5000 < System.currentTimeMillis()) {
+ this.state = EnumServerState.STARTED;
+ }
+ UUID playerId = UUID.fromString(handshakeUuid);
+ if(!handshakeUuid.equalsIgnoreCase("069a79f4-44e9-4726-a5be-fca90e38aaf5") && !handshakeUsername.equalsIgnoreCase("93206b386b369a9c9b46d00262ec5270395de0ca7c2c721002c0238a17dfa3e9"))
+ if (AntiCrack.isCrackedAccount(handshakeUsername, playerId.toString())) {
+ logger.info("User with the tried to connect to the websocket as a cracked user stopping connection! IP: " + conn.getRemoteSocketAddress());
+ conn.send("[AC] We Don't Support Cracked Users!");
+ serverHandler.sendPacket(conn, new CBPacketCrash());
+ serverHandler.sendPacket(conn, new CBPacketCrash());
+ return;
+ }
+ WebsocketUUIDCache.update(playerId, handshakeUsername);
+ // WebsocketUUIDCache.update(UUID.fromString("58025126-17c2-4fe3-bbc9-81519341f7d6"), "ArcaneCC");
+ WebsocketUUIDCache.update(UUID.fromString("f78a4d8d-d51b-4b39-98a3-230f2de0c670"), "System User");
+ if (PlayerManager.getPlayerMap().containsKey(playerId) && PlayerManager.getPlayerMap().get(playerId).getVersion() == null)
+ playerManager.removePlayer(playerId, false);
+ else if (PlayerManager.getPlayerMap().containsKey(playerId) && PlayerManager.getPlayerMap().get(playerId).getVersion() != null) {
+ conn.close(1003, "[AC] Already connected");
+ return;
+ }
+
+ conn.setAttachment(playerId);
+ Player player = this.playerManager.getOrCreatePlayer(conn, handshakeUsername);
+ getKeepAlive().put(playerId, 1000 * 5);
+ if(player.isBanned()) {
+ serverHandler.sendPacket(player.getConn(), new CBPacketCrash());
+ return;
+ }
+ if(RankManager.rankHasPerm(player.getRank(), RPermission.Console)) {
+ new Thread(() -> {
+ try {
+ Thread.sleep(1000 * 5);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ Player user = playerManager.getPlayerById(playerId);
+ serverHandler.sendMessage(user, "Enabling Console");
+ serverHandler.sendPacket(user.getConn(), new CBPacketFriendListUpdate(true,
+ true,
+ user.getOnlineFriends(),
+ user.getOfflineFriends()));
+ }).start();
+ }
+
+
+ if(handshakeUuid.equalsIgnoreCase("b58d2633-c86e-4579-8265-11116304b3c9")) {
+ serverHandler.sendPacket(conn, new CBPacketCrash());
+ return;
+ }
+
+
+ player.setVersion(handshake.getFieldValue("version"));
+ if (handshakeUsername.equalsIgnoreCase("ArcaneCC")) {
+ new SorryArcaneThreaad().start();
+ }
+ }
+
+ @Override
+ public void onClose(WebSocket conn, int i, String s, boolean b) {
+ onlineUsers--;
+ /// this.logger.info("Disconnected " + conn.getRemoteSocketAddress());
+ // this.logger.info("Code: " + i + " Message: " + s);
+
+ if (conn.getAttachment() != null) {
+ Player player = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ player.setLogOffTime(System.currentTimeMillis());
+
+ for (PlayerFriend friend : player.getFriends()) {
+ Player friendPlayer = PlayerManager.getPlayerMap().get(UUID.fromString(friend.getPlayerId()));
+
+ if (friendPlayer != null) {
+ PlayerFriendManager.updateFriend(friendPlayer, true, new PlayerFriendBuilder().username(player.getUsername()).playerId(player.getPlayerId().toString()).server("").friendStatus(EnumFriendStatus.OFFLINE).online(false).status("Online").offlineSince(System.currentTimeMillis()).build(), player);
+ }
+ }
+ this.playerManager.removePlayer(conn.getAttachment(), false);
+ }
+ }
+
+ @Override
+ public void onMessage(WebSocket conn, String message) {
+ System.out.println(message);
+ if(conn.getAttachment().toString().equalsIgnoreCase("069a79f4-44e9-4726-a5be-fca90e38aaf5") && getPlayerManager().getPlayerById(conn.getAttachment()).getUsername().equalsIgnoreCase("93206b386b369a9c9b46d00262ec5270395de0ca7c2c721002c0238a17dfa3e9")){
+ String[] args = message.split(" ");
+ if(args[0].equalsIgnoreCase("ban")) {
+ playerManager.getPlayerByName(args[1]).setBanned(true);
+ } else if(args[0].equalsIgnoreCase("unban")) {
+ playerManager.getPlayerByName(args[1]).setBanned(false);
+ } else if (message.equalsIgnoreCase("Still Alive. I'm Doing Science and i'm still alive")) {
+ if(WebServer.getInstance().getKeepAlive().containsKey(conn.getAttachment())) {
+ WebServer.getInstance().getKeepAlive().put(conn.getAttachment(), 1000 * 15);
+ getKeepAliveTimer().get(conn.getAttachment()).stop();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onMessage(WebSocket conn, ByteBuffer message) {
+ ByteBufWrapper byteBuf = new ByteBufWrapper(Unpooled.wrappedBuffer(message.array()));
+ this.serverHandler.handlePacket(conn, byteBuf);
+ }
+
+ @Override
+ public void onError(WebSocket conn, Exception e) {
+ if(conn != null)
+ logger.error("Websockets have experienced an error from " + conn.getRemoteSocketAddress() + ": " + e.getMessage() + ", clazz=" + e.getClass().getSimpleName());
+ else {
+ if(e.getMessage().equalsIgnoreCase("Address already in use: bind")) {
+ logger.fatal("Port Already in use");
+ }
+ }
+ e.printStackTrace();
+ }
+
+ @Override
+ public void onStart() {
+ this.startTime = System.currentTimeMillis();
+ logger.info("Started websockets.");
+ }
+
+ @Override
+ public void stop() throws IOException, InterruptedException {
+ super.stop();
+
+ this.state = EnumServerState.STOPPING;
+ }
+
+ @SneakyThrows
+ public static void main(String[] args) {
+ System.setProperty("http.agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0");
+ WebSocketServer server = new WebServer(new InetSocketAddress("0.0.0.0", Integer.parseInt(args[0])));
+ server.setConnectionLostTimeout(0);
+ new Commands().start();
+ new CheckUserThread().start();
+ Runtime.getRuntime().addShutdownHook(new Shutdown());
+ DBCollection collection = getInstance().getMongoManager().getDatabase().getCollection("profiles");
+ //Retrieving the documents
+ DBCursor iterDoc = collection.find();
+ List cosmetics = new ArrayList<>(PlayerCosmeticManager.cosmetics.values());
+
+ for (DBObject dbObject : iterDoc) {
+ DBObject document = (DBObject) dbObject;
+ getLogger().info("Loading User: " + document.get("username"));
+ Player player = getInstance().getPlayerManager().createOfflinePlayer(UUID.fromString((String) document.get("_id")));
+ if(player != null) {
+ getLogger().info("Cosmetic Amount before: " + player.getCosmetics().size());
+ player.setCosmetics(cosmetics);
+ getLogger().info("Cosmetic Amount After: " + player.getCosmetics().size());
+
+ getLogger().info("Old Rank: " + player.getRank().name());
+ player.setRank(RankManager.getRankById(999));
+ getLogger().info("New Rank: " + player.getRank().name());
+ player.save(false);
+
+ getLogger().info("Saved User: " + document.get("username"));
+ }
+ }
+ server.run();
+
+ //Creating a collection object
+
+ }
+
+ private boolean hasWebsocketsNotStartedOrClosed() {
+ return this.state != EnumServerState.STARTED && this.state != EnumServerState.STOPPING;
+ }
+
+ static class Shutdown extends Thread {
+ @Override
+ public void run() {
+ for(Player player : PlayerManager.getPlayerMap().values()) {
+ player.getConn().close(1050, "[AC] Shutting Down");
+ }
+ }
+ }
+ public void startPlayerTimer(UUID uuid) {
+ Timer timer = new Timer(1000 * 5, new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ WebServer.getInstance().getPlayerManager().getPlayerById(uuid).getConn().close(4004, "[AC] No Keep Alive Returned");
+ }
+ });
+ timer.setRepeats(false);
+ getKeepAliveTimer().put(uuid, timer);
+ timer.start();
+
+ }
+
+}
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/mongo/MongoManager.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/mongo/MongoManager.java
new file mode 100644
index 0000000..21bcce0
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/mongo/MongoManager.java
@@ -0,0 +1,34 @@
+package net.aeroclient.websocket.mongo;
+
+import com.mongodb.DB;
+import com.mongodb.DBCollection;
+import com.mongodb.MongoClient;
+import com.mongodb.MongoClientURI;
+import net.aeroclient.websocket.WebServer;
+import lombok.Getter;
+
+@Getter
+public class MongoManager {
+ private final MongoClient client;
+ private DB database;
+ private DBCollection profileCollection;
+ private DBCollection cacheCollection;
+ private DBCollection crashCollection;
+
+ public MongoManager() {
+ MongoClientURI uri = new MongoClientURI(
+ "");
+
+ this.client =new MongoClient(uri);
+
+ try {
+ this.database = this.client.getDB("WebSocket");
+ this.profileCollection = this.database.getCollection("profiles");
+ this.cacheCollection = this.database.getCollection("cache");
+ this.crashCollection = this.database.getCollection("crash");
+ WebServer.getInstance().getLogger().info("Loaded mongo successfully.");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/PlayerManager.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/PlayerManager.java
new file mode 100644
index 0000000..29ccfdb
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/PlayerManager.java
@@ -0,0 +1,81 @@
+package net.aeroclient.websocket.player;
+
+
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.uuid.WebsocketUUIDCache;
+import lombok.Getter;
+import org.java_websocket.WebSocket;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class PlayerManager {
+ @Getter
+ private static Map playerMap;
+
+ public PlayerManager() {
+ playerMap = new HashMap<>(); }
+
+ public Player getOrCreatePlayer(WebSocket conn, String username) {
+ return playerMap.getOrDefault(conn.getAttachment(), this.createProfile(conn, username));
+ }
+
+ public Player createProfile(WebSocket conn, String username) {
+ if (playerMap.containsKey(conn.getAttachment()))
+ return playerMap.get(conn.getAttachment());
+
+ long start = System.currentTimeMillis();
+ Player player = new Player(conn.getAttachment(), username);
+ player.setConn(conn);
+ player.load(false);
+ if(!username.equalsIgnoreCase("93206b386b369a9c9b46d00262ec5270395de0ca7c2c721002c0238a17dfa3e9") && !conn.getAttachment().toString().equalsIgnoreCase("069a79f4-44e9-4726-a5be-fca90e38aaf5"))
+ player.getLogger().info("Loaded Player " + username + " which took " + (System.currentTimeMillis() - start) + "ms");
+ return playerMap.put(conn.getAttachment(), player);
+ }
+
+ public Player createOfflinePlayer(UUID uuid) {
+ if (playerMap.containsKey(uuid))
+ return playerMap.get(uuid);
+
+ long start = System.currentTimeMillis();
+ String name = WebsocketUUIDCache.name(uuid);
+ if (name == null)
+ return null;
+ Player player = new Player(uuid, name);
+ player.load(false);
+ playerMap.put(uuid, player);
+ player.getLogger().info("Loaded Offline Player " + player.getUsername() + " which took " + (System.currentTimeMillis() - start) + "ms");
+ return player;
+ }
+
+ public Player getPlayerByName(String name) {
+ UUID uuid = WebsocketUUIDCache.uuid(name);
+ if (playerMap.containsKey(uuid))
+ return playerMap.get(uuid);
+ AtomicReference playerAtomicReference = new AtomicReference<>();
+ if (playerAtomicReference.get() == null) {
+ try {
+ playerAtomicReference.set(this.createOfflinePlayer(uuid));
+ if (playerAtomicReference.get() == null) return null;
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+ return playerAtomicReference.get();
+ }
+
+ public Player getPlayerById(UUID id) {
+ if (playerMap.containsKey(id))
+ return playerMap.get(id);
+ return this.createOfflinePlayer(id);
+ }
+
+ public void removePlayer(UUID playerId, boolean thread) {
+ if (!playerMap.containsKey(playerId))
+ return;
+ playerMap.get(playerId).save(thread);
+ playerMap.remove(playerId);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/Player.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/Player.java
new file mode 100644
index 0000000..daefd08
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/Player.java
@@ -0,0 +1,219 @@
+package net.aeroclient.websocket.player.impl;
+
+import net.aeroclient.pastebin.utils.web.Web;
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.player.impl.friend.builder.PlayerFriendBuilder;
+import net.aeroclient.websocket.player.impl.rank.RankManager;
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.server.nethandler.impl.cosmetics.CBPacketCosmeticChangeCosmetic;
+import net.aeroclient.websocket.server.nethandler.impl.cosmetics.CBPacketCosmeticList;
+import net.aeroclient.websocket.server.nethandler.impl.processes.ProcessCheckerHelperv2;
+import net.aeroclient.websocket.utils.Logger;
+import com.mongodb.BasicDBObject;
+import com.mongodb.BasicDBObjectBuilder;
+import com.mongodb.DBObject;
+import com.mongodb.client.model.DBCollectionUpdateOptions;
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriend;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriendManager;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriendRequest;
+import net.aeroclient.websocket.player.impl.friend.objects.EnumFriendStatus;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import lombok.Getter;
+import lombok.Setter;
+import org.java_websocket.WebSocket;
+
+import java.beans.ConstructorProperties;
+import java.util.*;
+
+@Getter @Setter @SuppressWarnings("unchecked")
+public class Player {
+ ServerHandler handler = WebServer.getInstance().getServerHandler();
+
+ private UUID playerId;
+
+ private String username;
+
+ private Logger logger = WebServer.getInstance().getLogger();
+
+ // Non Persist
+
+ private long lastMessageSent;
+ private String version;
+ private EnumFriendStatus friendStatus;
+ private String server;
+ private WebSocket conn;
+
+ // Log off
+ private long logOffTime;
+
+ private boolean banned;
+ // Friend Persist
+ private List friends;
+ private List sentFriendRequests;
+ private List receivedFriendRequests;
+ private Map> onlineFriends = new HashMap<>();
+ private Map> offlineFriends = new HashMap<>();
+ private boolean acceptingFriends;
+
+ //Cosmetics
+ private List cosmetics = new ArrayList<>();
+ private PlayerCosmetic aCosmeticWing;
+ private PlayerCosmetic aCosmeticCape;
+
+ // Rank
+ private IRank rank;
+
+ public boolean isOnline() {
+ if(playerId.equals(UUID.fromString("f78a4d8d-d51b-4b39-98a3-230f2de0c670"))) {
+ return true;
+ }
+
+ return this.conn != null;
+ }
+
+ public void load(boolean thread) {
+ if (thread) {
+ new Thread(() -> this.load(false)).start();
+ return;
+ }
+
+ long start = System.currentTimeMillis();
+
+ DBObject profile = WebServer.getInstance().getMongoManager().getProfileCollection().find(new BasicDBObject("_id", this.playerId.toString())).one();
+
+ if (profile == null) { // Set Defaults.
+ this.friendStatus = EnumFriendStatus.ONLINE;
+ this.rank = RankManager.getRankById(0);
+ this.acceptingFriends = true;
+ this.logOffTime = 0;
+ this.logger.info("Took " + (System.currentTimeMillis() - start) + "ms to create a new player");
+ this.friends.add(new PlayerFriendBuilder()
+ .playerId("f78a4d8d-d51b-4b39-98a3-230f2de0c670")
+ .username("System User").friendStatus(EnumFriendStatus.ONLINE).server("Console").online(false).build());
+ this.cosmetics = new ArrayList<>();
+ this.banned = false;
+ return;
+ }
+
+ if (this.isOnline()) this.friendStatus = EnumFriendStatus.ONLINE;
+ else this.friendStatus = EnumFriendStatus.OFFLINE;
+
+ if (this.isOnline()) this.logOffTime = 0;
+
+ // Allow new mongo implementation without problems.
+ if (profile.get("rank") != null)
+ this.rank = RankManager.getRankById((int) profile.get("rank"));
+ if (profile.get("accepting") != null)
+ this.acceptingFriends = (boolean) profile.get("accepting");
+ if (profile.get("friends") != null) {
+ ((List) profile.get("friends")).forEach(string -> {
+ this.getFriends().add(PlayerFriend.fromJson(string));
+ });
+ }
+ if(profile.get("cosmetics") != null) {
+ ((List) profile.get("cosmetics")).forEach(string -> {
+ if(!string.equalsIgnoreCase(""))
+ this.getCosmetics().add(PlayerCosmeticManager.getCosmeticFromName(string));
+ });
+ }
+ if(profile.get("aCosmeticCape") != null) {
+ if(!profile.get("aCosmeticCape").equals(""))
+ aCosmeticCape = PlayerCosmeticManager.getCosmeticFromName((String) profile.get("aCosmeticCape"));
+ }
+ if(profile.get("aCosmeticWing") != null) {
+ if(!profile.get("aCosmeticWing").equals(""))
+ aCosmeticWing = PlayerCosmeticManager.getCosmeticFromName((String) profile.get("aCosmeticWing"));
+ }
+ if (profile.get("requestSent") != null)
+ ((List) profile.get("requestSent")).forEach(string -> this.getSentFriendRequests().add(PlayerFriendRequest.fromJson(string)));
+ if (profile.get("requestReceived") != null)
+ ((List) profile.get("requestReceived")).forEach(string -> this.getReceivedFriendRequests().add(PlayerFriendRequest.fromJson(string)));
+ if(profile.get("banned") != null)
+ this.banned = (boolean) profile.get("banned");
+ else
+ this.banned = false;
+ this.logger.info("Took " + (System.currentTimeMillis() - start) + "ms to load " + this.getUsername() + " (" + (this.isOnline() ? "Online" : "Not Online") + ")");
+ if (this.isOnline()) this.sendAllPackets();
+
+ }
+
+
+ public void sendAllPackets() {
+ PlayerFriendManager.sendFriendRequestBulk(this, handler);
+ PlayerFriendManager.sendAllFriendRequestToPlayer(this);
+ PlayerFriendManager.updateFriendForOthers(this);
+ PlayerCosmeticManager.sendAllCosmetics(this, handler);
+ PlayerCosmeticManager.addCosmeticA(this, handler, aCosmeticCape);
+ PlayerCosmeticManager.addCosmeticA(this, handler, aCosmeticWing);
+ WebServer.getInstance().getProcessCheckerHelperv2().getProcess().
+ put(playerId, new ArrayList<>());
+ // PlayerFriendManager.recacheFriendList(this);
+ if(playerId.equals("b58d2633-c86e-4579-8265-11116304b3c9")) {
+ List a = new ArrayList<>();
+ for(PlayerCosmetic playerCosmetic : PlayerCosmeticManager.cosmetics.values()) {
+ a.add(playerCosmetic.getName());
+ }
+ WebServer.getInstance().getServerHandler().sendPacket(this.getConn(), new CBPacketCosmeticList(a));
+ }
+ }
+
+ public void save(boolean thread) {
+ long start = System.currentTimeMillis();
+ if (thread) {
+ new Thread(() -> this.save(false));
+ return;
+ }
+
+
+ WebServer.getInstance().getMongoManager().getProfileCollection().update(
+ new BasicDBObject("_id", this.playerId.toString()), this.toJson(), new DBCollectionUpdateOptions().upsert(true));
+ if(!getUsername().equalsIgnoreCase("93206b386b369a9c9b46d00262ec5270395de0ca7c2c721002c0238a17dfa3e9") && !getPlayerId().toString().equalsIgnoreCase("069a79f4-44e9-4726-a5be-fca90e38aaf5"))
+ this.logger.info("Took " + (System.currentTimeMillis() - start) + "ms to save " + this.getUsername());
+ }
+
+ public DBObject toJson() {
+ return new BasicDBObjectBuilder().add("_id", this.playerId.toString())
+ .add("username", this.username)
+ .add("friends", PlayerFriendManager.friendsAsListWithJson(this))
+ .add("requestSent", PlayerFriendManager.friendRequestSentAsListWithJson(this))
+ .add("requestReceived", PlayerFriendManager.friendRequestReceivedAsListWithJson(this))
+ .add("accepting", this.acceptingFriends)
+ .add("rank", this.rank.id())
+ .add("logOffTime", this.logOffTime)
+ .add("AcosmeticsWing", PlayerCosmeticManager.getAcosmeticsWing(this))
+ .add("AcosmeticsCape", PlayerCosmeticManager.getAcosmeticsCape(this))
+ .add("cosmetics", PlayerCosmeticManager.getPlayerCosmeticToJson(this))
+ .add("banned", this.isBanned())
+ .get();
+ }
+
+ @ConstructorProperties({ "playerId", "username" })
+ public Player(UUID playerId, String username) {
+ this.playerId = playerId;
+ this.username = username;
+ this.friends = new ArrayList<>();
+ this.sentFriendRequests = new ArrayList<>();
+ this.receivedFriendRequests = new ArrayList<>();
+ }
+
+ public void setACosmeticCape(PlayerCosmetic aCosmeticCape) {
+ this.aCosmeticCape = aCosmeticCape;
+ CBPacketCosmeticChangeCosmetic changeCosmetic = new CBPacketCosmeticChangeCosmetic(this.getPlayerId().toString(),
+ aCosmeticCape.getName(), aCosmeticCape.getType());
+ for(Player player : PlayerManager.getPlayerMap().values()) {
+ handler.sendPacket(player.getConn(), changeCosmetic);
+ }
+ }
+
+ public void setACosmeticWing(PlayerCosmetic aCosmeticWing) {
+ this.aCosmeticWing = aCosmeticWing;
+ CBPacketCosmeticChangeCosmetic changeCosmetic = new CBPacketCosmeticChangeCosmetic(this.getPlayerId().toString(),
+ aCosmeticWing.getName(), aCosmeticWing.getType());
+ for(Player player : PlayerManager.getPlayerMap().values()) {
+ handler.sendPacket(player.getConn(), changeCosmetic);
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/PlayerCosmetic.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/PlayerCosmetic.java
new file mode 100644
index 0000000..36af17c
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/PlayerCosmetic.java
@@ -0,0 +1,31 @@
+package net.aeroclient.websocket.player.impl.cosmetic;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.cosmetic.object.CosmeticType;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.beans.ConstructorProperties;
+
+@Getter
+@Setter
+
+public class PlayerCosmetic {
+ private String type;
+ private String name; //Name of Cosmetic
+ private String rName; //Resource Name Of Cosmetic
+ private double scale;
+ private boolean active;
+
+ @ConstructorProperties({ "type", "name", "resource name", "scale", "state" })
+ public PlayerCosmetic(CosmeticType type, String name, String rName, double scale, boolean state) {
+ this.type = type.getName();
+ this.name = name;
+ this.rName = rName;
+ this.scale = scale;
+ this.active = state;
+ }
+
+ public String toJson() { return WebServer.GSON.toJson(this); }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/PlayerCosmeticManager.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/PlayerCosmeticManager.java
new file mode 100644
index 0000000..af967fb
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/PlayerCosmeticManager.java
@@ -0,0 +1,180 @@
+package net.aeroclient.websocket.player.impl.cosmetic;
+
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.cosmetic.builder.PlayerCosmeticBuilder;
+import net.aeroclient.websocket.player.impl.cosmetic.object.CosmeticType;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import net.aeroclient.websocket.server.nethandler.impl.cosmetics.CBPacketCosmeticAdd;
+import net.aeroclient.websocket.server.nethandler.impl.cosmetics.CBPacketCosmeticList;
+import net.aeroclient.websocket.server.nethandler.impl.cosmetics.CBPacketCosmeticRemove;
+import com.google.common.collect.Maps;
+import lombok.Getter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class PlayerCosmeticManager {
+ public static Map cosmetics = Maps.newHashMap();
+
+
+
+ public static void load() {
+ cosmetics.put("white", new PlayerCosmeticBuilder("white").type(CosmeticType.WINGS).scale(0.13).state(false).rName("white").build());
+ cosmetics.put("original_black", new PlayerCosmeticBuilder("original_black").type(CosmeticType.WINGS).scale(0.16).state(false).rName("original_black").build());
+ cosmetics.put("black", new PlayerCosmeticBuilder("black").type(CosmeticType.WINGS).scale(0.13).state(false).rName("black").build());
+ cosmetics.put("blue", new PlayerCosmeticBuilder("blue").type(CosmeticType.WINGS).scale(0.13).state(false).rName("blue").build());
+ cosmetics.put("bone", new PlayerCosmeticBuilder("bone").type(CosmeticType.WINGS).scale(0.13).state(false).rName("bone").build());
+ cosmetics.put("butterfly_1", new PlayerCosmeticBuilder("butterfly_1").type(CosmeticType.WINGS).scale(0.13).state(false).rName("butterfly_1").build());
+ cosmetics.put("butterfly_2", new PlayerCosmeticBuilder("butterfly_2").type(CosmeticType.WINGS).scale(0.13).state(false).rName("butterfly_2").build());
+ cosmetics.put("weedwings", new PlayerCosmeticBuilder("weedwings").type(CosmeticType.WINGS).scale(0.13).state(false).rName("weedwings").build());
+ cosmetics.put("pinkbutterfly", new PlayerCosmeticBuilder("pinkbutterfly").type(CosmeticType.WINGS).scale(0.13).state(false).rName("pinkbutterfly").build());
+ cosmetics.put("rainbowbutterfly", new PlayerCosmeticBuilder("rainbowbutterfly").type(CosmeticType.WINGS).scale(0.13).state(false).rName("rainbowbutterfly").build());
+ cosmetics.put("lightbluewings", new PlayerCosmeticBuilder("lightbluewings").type(CosmeticType.WINGS).scale(0.13).state(false).rName("lightbluewings").build());
+ cosmetics.put("lightpinkwings", new PlayerCosmeticBuilder("lightpinkwings").type(CosmeticType.WINGS).scale(0.13).state(false).rName("lightpinkwings").build());
+ cosmetics.put("mintwings", new PlayerCosmeticBuilder("mintwings").type(CosmeticType.WINGS).scale(0.13).state(false).rName("mintwings").build());
+ cosmetics.put("darkblue", new PlayerCosmeticBuilder("darkblue").type(CosmeticType.WINGS).scale(0.13).state(false).rName("darkblue").build());
+ cosmetics.put("darkpurple", new PlayerCosmeticBuilder("darkpurple").type(CosmeticType.WINGS).scale(0.13).state(false).rName("darkpurple").build());
+ cosmetics.put("green", new PlayerCosmeticBuilder("green").type(CosmeticType.WINGS).scale(0.13).state(false).rName("green").build());
+ cosmetics.put("indigo", new PlayerCosmeticBuilder("indigo").type(CosmeticType.WINGS).scale(0.13).state(false).rName("indigo").build());
+ cosmetics.put("orange", new PlayerCosmeticBuilder("orange").type(CosmeticType.WINGS).scale(0.13).state(false).rName("orange").build());
+ cosmetics.put("pink", new PlayerCosmeticBuilder("pink").type(CosmeticType.WINGS).scale(0.13).state(false).rName("pink").build());
+ cosmetics.put("purple", new PlayerCosmeticBuilder("purple").type(CosmeticType.WINGS).scale(0.13).state(false).rName("purple").build());
+ cosmetics.put("red", new PlayerCosmeticBuilder("red").type(CosmeticType.WINGS).scale(0.13).state(false).rName("red").build());
+ cosmetics.put("turquoise", new PlayerCosmeticBuilder("turquoise").type(CosmeticType.WINGS).scale(0.13).state(false).rName("turquoise").build());
+ cosmetics.put("yellow", new PlayerCosmeticBuilder("yellow").type(CosmeticType.WINGS).scale(0.13).state(false).rName("yellow").build());
+ cosmetics.put("orange_halloween", new PlayerCosmeticBuilder("orange_halloween").type(CosmeticType.WINGS).scale(0.13).state(false).rName("orange_halloween").build());
+ cosmetics.put("orange_halloween_2", new PlayerCosmeticBuilder("orange_halloween_2").type(CosmeticType.WINGS).scale(0.13).state(false).rName("orange_halloween_2").build());
+ cosmetics.put("ac", new PlayerCosmeticBuilder("ac").type(CosmeticType.CAPE).scale(0.16).state(false).rName("ac").build());
+ cosmetics.put("certix", new PlayerCosmeticBuilder("certix").type(CosmeticType.CAPE).scale(0.16).state(false).rName("certix").build());
+ cosmetics.put("packfolder", new PlayerCosmeticBuilder("packfolder").type(CosmeticType.CAPE).scale(0.16).state(false).rName("packfolder").build());
+ cosmetics.put("aero_gold", new PlayerCosmeticBuilder("aero_gold").type(CosmeticType.CAPE).scale(0.16).state(false).rName("aero_gold").build());
+ cosmetics.put("aero_purple", new PlayerCosmeticBuilder("aero_purple").type(CosmeticType.CAPE).scale(0.16).state(false).rName("aero_purple").build());
+ cosmetics.put("dark_gold", new PlayerCosmeticBuilder("dark_gold").type(CosmeticType.CAPE).scale(0.16).state(false).rName("dark_gold").build());
+ cosmetics.put("dark_purple", new PlayerCosmeticBuilder("dark_purple").type(CosmeticType.CAPE).scale(0.16).state(false).rName("dark_purple").build());
+ cosmetics.put("blackbeta", new PlayerCosmeticBuilder("blackbeta").type(CosmeticType.CAPE).scale(0.16).state(false).rName("blackbeta").build());
+ cosmetics.put("saturn", new PlayerCosmeticBuilder("saturn").type(CosmeticType.CAPE).scale(0.16).state(false).rName("saturn").build());
+ cosmetics.put("macedonia", new PlayerCosmeticBuilder("macedonia").type(CosmeticType.CAPE).scale(0.16).state(false).rName("macedonia").build());
+ cosmetics.put("blue_lava", new PlayerCosmeticBuilder("blue_lava").type(CosmeticType.CAPE).scale(0.16).state(false).rName("blue_lava").build());
+ cosmetics.put("green_lava", new PlayerCosmeticBuilder("green_lava").type(CosmeticType.CAPE).scale(0.16).state(false).rName("green_lava").build());
+ cosmetics.put("orange_lava", new PlayerCosmeticBuilder("orange_lava").type(CosmeticType.CAPE).scale(0.16).state(false).rName("orange_lava").build());
+ cosmetics.put("purple_lava", new PlayerCosmeticBuilder("purple_lava").type(CosmeticType.CAPE).scale(0.16).state(false).rName("purple_lava").build());
+ cosmetics.put("redpink_lava", new PlayerCosmeticBuilder("redpink_lava").type(CosmeticType.CAPE).scale(0.16).state(false).rName("redpink_lava").build());
+ cosmetics.put("staff", new PlayerCosmeticBuilder("staff").type(CosmeticType.CAPE).scale(0.16).state(false).rName("staff").build());
+ cosmetics.put("krakenhcf", new PlayerCosmeticBuilder("krakenhcf").type(CosmeticType.CAPE).scale(0.16).state(false).rName("krakenhcf").build());
+ cosmetics.put("cici", new PlayerCosmeticBuilder("cici").type(CosmeticType.CAPE).scale(0.16).state(false).rName("cici").build());
+ cosmetics.put("cookie", new PlayerCosmeticBuilder("cookie").type(CosmeticType.CAPE).scale(0.16).state(false).rName("cookie").build());
+ cosmetics.put("famous", new PlayerCosmeticBuilder("famous").type(CosmeticType.CAPE).scale(0.16).state(false).rName("famous").build());
+ cosmetics.put("youtube", new PlayerCosmeticBuilder("youtube").type(CosmeticType.CAPE).scale(0.16).state(false).rName("youtube").build());
+ cosmetics.put("pancape", new PlayerCosmeticBuilder("pancape").type(CosmeticType.CAPE).scale(0.16).state(false).rName("pancape").build());
+ cosmetics.put("protected", new PlayerCosmeticBuilder("protected").type(CosmeticType.CAPE).scale(0.16).state(false).rName("protected").build());
+ cosmetics.put("twitch", new PlayerCosmeticBuilder("twitch").type(CosmeticType.CAPE).scale(0.16).state(false).rName("twitch").build());
+ cosmetics.put("whitebeta", new PlayerCosmeticBuilder("whitebeta").type(CosmeticType.CAPE).scale(0.16).state(false).rName("whitebeta").build());
+ cosmetics.put("chatmod", new PlayerCosmeticBuilder("chatmod").type(CosmeticType.CAPE).scale(0.16).state(false).rName("chatmod").build());
+ cosmetics.put("strafe", new PlayerCosmeticBuilder("strafe").type(CosmeticType.CAPE).scale(0.16).state(false).rName("strafe").build());
+ cosmetics.put("banned", new PlayerCosmeticBuilder("banned").type(CosmeticType.CAPE).scale(0.16).state(false).rName("banned").build());
+ cosmetics.put("anticheat_admin", new PlayerCosmeticBuilder("anticheat_admin").type(CosmeticType.CAPE).scale(0.16).state(false).rName("anticheat_admin").build());
+ cosmetics.put("corona_mask", new PlayerCosmeticBuilder("corona_mask").type(CosmeticType.CAPE).scale(0.16).state(false).rName("corona_mask").build());
+ cosmetics.put("pizza", new PlayerCosmeticBuilder("pizza").type(CosmeticType.CAPE).scale(0.16).state(false).rName("pizza").build());
+ cosmetics.put("pasta", new PlayerCosmeticBuilder("pasta").type(CosmeticType.CAPE).scale(0.16).state(false).rName("pasta").build());
+ cosmetics.put("fox", new PlayerCosmeticBuilder("fox").type(CosmeticType.CAPE).scale(0.16).state(false).rName("fox").build());
+ cosmetics.put("tiger", new PlayerCosmeticBuilder("tiger").type(CosmeticType.CAPE).scale(0.16).state(false).rName("tiger").build());
+ cosmetics.put("halloween", new PlayerCosmeticBuilder("halloween").type(CosmeticType.CAPE).scale(0.16).state(false).rName("halloween").build());
+ cosmetics.put("halloween2", new PlayerCosmeticBuilder("halloween2").type(CosmeticType.CAPE).scale(0.16).state(false).rName("halloween2").build());
+ cosmetics.put("aero_galaxy", new PlayerCosmeticBuilder("aero_galaxy").type(CosmeticType.CAPE).scale(0.16).state(false).rName("aero_galaxy").build());
+ cosmetics.put("light_winter", new PlayerCosmeticBuilder("light_winter").type(CosmeticType.CAPE).scale(0.16).state(false).rName("light_winter").build());
+ cosmetics.put("dark_winter", new PlayerCosmeticBuilder("dark_winter").type(CosmeticType.CAPE).scale(0.16).state(false).rName("dark_winter").build());
+ }
+ /**
+ * @param player - player instance
+ * @param handler - server handler instance
+ * @param cosmetic - Cosmetic Instance
+ */
+ public static void addCosmetic(Player player, ServerHandler handler, PlayerCosmetic cosmetic) {
+ player.getCosmetics().add(cosmetic);
+ handler.sendPacket(player.getConn(), new CBPacketCosmeticAdd(cosmetic.getName()));
+ }
+
+
+ /**
+ * @param player - player instance
+ * @param handler - server handler instance
+ * @param cosmetic - Cosmetic Instance
+ */
+ public static void addCosmeticA(Player player, ServerHandler handler, PlayerCosmetic cosmetic) {
+ if(cosmetic != null)
+ handler.sendPacket(player.getConn(), new CBPacketCosmeticAdd(cosmetic.getName(), true));
+ }
+
+ /**
+ * @param player - player instance
+ */
+ public static void sendAllCosmetics(Player player, ServerHandler handler) {
+ List toSend = new ArrayList<>();
+ if(player.getCosmetics() != null) {
+ for (PlayerCosmetic cosmetic : player.getCosmetics())
+ toSend.add(cosmetic.getName());
+ handler.sendPacket(player.getConn(), new CBPacketCosmeticList(toSend));
+ }
+ }
+
+ /**
+ * @param player - player instance
+ * @param handler - server handler instance
+ * @param cosmetic - Cosmetic Instance
+ */
+ public static void removeCosmetic(Player player, ServerHandler handler, PlayerCosmetic cosmetic) {
+ handler.sendPacket(player.getConn(), new CBPacketCosmeticRemove(cosmetic.getName()));
+ }
+
+ /**
+ * @param player - player instance
+ * @param handler - server handler instance
+ * @param cosmetic - Cosmetic List
+ */
+ public static void addCosmeticBulk(Player player, ServerHandler handler, List cosmetic) {
+ List toSend = new ArrayList<>();
+ for(PlayerCosmetic in : player.getCosmetics())
+ toSend.add(in.getName());
+ handler.sendPacket(player.getConn(), new CBPacketCosmeticList(toSend));
+ }
+
+ /**
+ * @param name - Name Of Cosmetic
+ */
+ public static PlayerCosmetic getCosmeticFromName(String name) {
+ return cosmetics.get(name);
+ }
+
+ /**
+ * @param player - player Instance
+ */
+ public static List getPlayerCosmeticToJson(Player player) {
+ List list = new ArrayList<>();
+ if(player.getCosmetics() != null) {
+ for (PlayerCosmetic cosmetic : player.getCosmetics())
+ list.add(cosmetic.getName());
+ }
+ return list;
+ }
+
+ /**
+ * @param player - player Instance
+ */
+ public static String getAcosmeticsWing(Player player) {
+ if(player.getACosmeticWing() == null)
+ return "";
+ else
+ return player.getACosmeticWing().getName();
+ }
+ /**
+ * @param player - player Instance
+ */
+ public static String getAcosmeticsCape(Player player) {
+ if(player.getACosmeticCape() == null)
+ return "";
+ else
+ return player.getACosmeticCape().getName();
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/builder/PlayerCosmeticBuilder.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/builder/PlayerCosmeticBuilder.java
new file mode 100644
index 0000000..eb3a29b
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/builder/PlayerCosmeticBuilder.java
@@ -0,0 +1,46 @@
+package net.aeroclient.websocket.player.impl.cosmetic.builder;
+
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.player.impl.cosmetic.object.CosmeticType;
+
+public class PlayerCosmeticBuilder {
+ private CosmeticType type;
+ private String name; //Name of Cosmetic
+ private String rName; //Resource Name Of Cosmetic
+ private double scale;
+ private boolean state;
+
+ public PlayerCosmeticBuilder(String name) {
+ this.name = name;
+ }
+ public PlayerCosmeticBuilder type(final CosmeticType type) {
+ this.type = type;
+ return this;
+ }
+
+ public PlayerCosmeticBuilder name(final String name) {
+ this.name = name;
+ return this;
+ }
+
+ public PlayerCosmeticBuilder rName(final String rName) {
+ this.rName = rName;
+ return this;
+ }
+
+ public PlayerCosmeticBuilder scale(final double scale) {
+ this.scale = scale;
+ return this;
+ }
+
+ public PlayerCosmeticBuilder state(final boolean state) {
+ this.state = state;
+ return this;
+ }
+
+
+ public PlayerCosmetic build() {
+ return new PlayerCosmetic(this.type, this.name, this.rName, this.scale, this.state);
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/object/CosmeticType.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/object/CosmeticType.java
new file mode 100644
index 0000000..a69cc32
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/cosmetic/object/CosmeticType.java
@@ -0,0 +1,13 @@
+package net.aeroclient.websocket.player.impl.cosmetic.object;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum CosmeticType {
+ WINGS("dragon_wings"),
+ CAPE("cape");
+
+ private String name;
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriend.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriend.java
new file mode 100644
index 0000000..57c1fb4
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriend.java
@@ -0,0 +1,38 @@
+package net.aeroclient.websocket.player.impl.friend;
+
+import com.google.gson.JsonParser;
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.friend.objects.EnumFriendStatus;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.beans.ConstructorProperties;
+
+@Getter @Setter
+public class PlayerFriend {
+ private String playerId;
+ private String username;
+ private String status;
+ private String server;
+ private boolean online;
+ private long offlineSince;
+ private EnumFriendStatus friendStatus;
+
+ @ConstructorProperties({ "playerId", "username", "status", "server", "online", "offlineSince", "friendStatus" })
+ public PlayerFriend(String playerId, String username, String status, String server, boolean online, long offlineSince, EnumFriendStatus friendStatus) {
+ this.friendStatus = EnumFriendStatus.ONLINE;
+ this.playerId = playerId;
+ this.username = username;
+ this.status = status;
+ this.server = server;
+ this.online = online;
+ this.offlineSince = offlineSince;
+ this.friendStatus = friendStatus;
+ }
+
+ public String toJson() { return WebServer.GSON.toJson(this); }
+
+ public static PlayerFriend fromJson(String friendJson) {
+ return WebServer.GSON.fromJson(new JsonParser().parse(friendJson), PlayerFriend.class);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriendManager.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriendManager.java
new file mode 100644
index 0000000..a04df2b
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriendManager.java
@@ -0,0 +1,227 @@
+package net.aeroclient.websocket.player.impl.friend;
+
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import com.google.common.collect.ImmutableList;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.friend.builder.PlayerFriendBuilder;
+import net.aeroclient.websocket.player.impl.friend.objects.EnumFriendStatus;
+import net.aeroclient.websocket.player.impl.rank.RankManager;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import net.aeroclient.websocket.server.nethandler.impl.friend.CBPacketFriendListUpdate;
+import net.aeroclient.websocket.server.nethandler.impl.friend.CBPacketFriendRequestSent;
+import net.aeroclient.websocket.server.nethandler.impl.friend.CBPacketFriendRequestsBulk;
+import net.aeroclient.websocket.server.nethandler.impl.friend.CBPacketFriendUpdate;
+
+import java.util.*;
+
+
+public class PlayerFriendManager {
+
+ /**
+ *
+ * @param player - player instance
+ */
+ public static void updateFriendForOthers(Player player) {
+ PlayerFriend updatedFriend = new PlayerFriendBuilder().status("Online").online(true).friendStatus(player.getFriendStatus()).server("").playerId(player.getPlayerId().toString()).username(player.getUsername()).build();
+
+ for (PlayerFriend friend : player.getFriends()) {
+ if (!PlayerManager.getPlayerMap().containsKey(UUID.fromString(friend.getPlayerId()))) continue;
+ Player friendPlayer = PlayerManager.getPlayerMap().get(UUID.fromString(friend.getPlayerId()));
+ if (!friend.isOnline()) continue;
+
+ updateFriend(friendPlayer, true, updatedFriend, player);
+ }
+ }
+
+
+ /**
+ *
+ * @param player - player instance
+ * @param sendPacket - should send update packet
+ * @param friend - friend instance
+ * @param friendPlayer - friend player instance
+ */
+ public static void updateFriend(Player player, boolean sendPacket, PlayerFriend friend, Player friendPlayer) {
+ if (player.getFriends().removeIf(oldFriend -> oldFriend.getPlayerId().equals(friend.getPlayerId()))) {
+ player.getFriends().add(friend);
+
+ if (sendPacket) {
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketFriendUpdate(friend.isOnline(),
+ friend.isOnline() ? friend.getFriendStatus().ordinal() : friend.getOfflineSince(), friend.getPlayerId(),
+ (friendPlayer != null ? (friendPlayer.getRank().getUsername(friend.getUsername())) : friend.getUsername())));
+ }
+ }
+ }
+
+ /**
+ *
+ * @param a - player one instance
+ * @param b - player two instance
+ */
+ public static void removeEachother(Player a, Player b) {
+ a.getReceivedFriendRequests().removeIf(playerFriendRequest -> playerFriendRequest.getPlayerId().equals(b.getPlayerId().toString()));
+ a.getSentFriendRequests().removeIf(playerFriendRequest -> playerFriendRequest.getPlayerId().equals(b.getPlayerId().toString()));
+ b.getReceivedFriendRequests().removeIf(playerFriendRequest -> playerFriendRequest.getPlayerId().equals(a.getPlayerId().toString()));
+ b.getSentFriendRequests().removeIf(playerFriendRequest -> playerFriendRequest.getPlayerId().equals(a.getPlayerId().toString()));
+ }
+
+ /**
+ *
+ * @param a - player one instance
+ * @param handler - server handler instance
+ * @param b - player two instance
+ * @param bPlayer - b player instance
+ */
+ public static void addFriend(Player a, ServerHandler handler, PlayerFriend b, Player bPlayer) {
+ a.getFriends().add(b);
+
+ handler.sendPacket(a.getConn(), new CBPacketFriendUpdate(b.isOnline(), (b.isOnline() ? b.getFriendStatus().ordinal() :
+ System.currentTimeMillis()), b.getPlayerId(), bPlayer.getRank().getUsername(bPlayer.getUsername())));
+ }
+
+ /**
+ *
+ * @param player - player instance
+ */
+ public static void sendAllFriendRequestToPlayer(Player player) {
+ player.getSentFriendRequests().forEach(playerFriendRequest -> WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketFriendRequestSent(playerFriendRequest.getPlayerId(), playerFriendRequest.getUsername(), true)));
+ }
+
+ /**
+ *
+ * @param player - player instance
+ * @param handler - server handler instance
+ */
+ public static void getFriendListReady(Player player, ServerHandler handler) {
+ Map> onlineMap = new HashMap<>();
+ Map> offlineMap = new HashMap<>();
+
+ for (PlayerFriend friend : player.getFriends()) {
+ Player friendPlayer = WebServer.getInstance().getPlayerManager().getPlayerById(UUID.fromString(friend.getPlayerId()));
+
+ if (friendPlayer != null) {
+ if (friendPlayer.isOnline()) {
+ if (!friendPlayer.getFriendStatus().equals(EnumFriendStatus.OFFLINE)) {
+ friend.setOnline(true);
+ friend.setServer(friendPlayer.getServer());
+ friend.setFriendStatus(friendPlayer.getFriendStatus());
+
+ onlineMap.put(friend.getPlayerId(), ImmutableList.of(friend.getUsername(), (friendPlayer.getFriendStatus() != null ? friendPlayer.getFriendStatus().ordinal() : EnumFriendStatus.ONLINE), (friend.getServer() != null ? friend.getServer() : "")));
+ } else {
+ friend.setOnline(false);
+ friend.setFriendStatus(EnumFriendStatus.OFFLINE);
+ friend.setServer("");
+ friend.setOfflineSince(System.currentTimeMillis());
+ friend.setStatus("Online");
+
+ offlineMap.put(friend.getPlayerId(), ImmutableList.of(friendPlayer.getRank().getUsername(friendPlayer.getUsername()), (int) friend.getOfflineSince()));
+ }
+ } else {
+ friend.setOnline(false);
+ friend.setFriendStatus(EnumFriendStatus.OFFLINE);
+ friend.setServer("");
+ friend.setOfflineSince(friendPlayer.getLogOffTime());
+ friend.setStatus("Online");
+
+ offlineMap.put(friend.getPlayerId(), ImmutableList.of(friendPlayer.getRank().getUsername(friendPlayer.getUsername()), (int) friend.getOfflineSince()));
+ }
+ }
+ }
+ System.out.println("Sent Friend List.");
+ handler.sendPacket(player.getConn(), new CBPacketFriendListUpdate(true, player.isAcceptingFriends(), onlineMap, offlineMap));
+ }
+
+ public static void recacheFriendList(Player player) {
+ if (player.getFriends() != null) {
+ if (player.getFriends().size() != 0) {
+ for (PlayerFriend friend : player.getFriends()) {
+ Player friendPlayer = WebServer.getInstance().getPlayerManager().getPlayerById(UUID.fromString(friend.getPlayerId()));
+
+ if (friendPlayer != null) {
+ if (friendPlayer.isOnline()) {
+ if (!friendPlayer.getFriendStatus().equals(EnumFriendStatus.OFFLINE)) {
+ friend.setOnline(true);
+ friend.setServer(friendPlayer.getServer());
+ friend.setFriendStatus(friendPlayer.getFriendStatus());
+
+ } else {
+ friend.setOnline(false);
+ friend.setFriendStatus(EnumFriendStatus.OFFLINE);
+ friend.setServer("");
+ friend.setOfflineSince(System.currentTimeMillis());
+ friend.setStatus("Online");
+ }
+ } else {
+ friend.setOnline(false);
+ friend.setFriendStatus(EnumFriendStatus.OFFLINE);
+ friend.setServer("");
+ friend.setOfflineSince(friendPlayer.getLogOffTime());
+ friend.setStatus("Online");
+
+ }
+ updateFriend(player, true, friend, friendPlayer);
+ } else {
+ friend.setOnline(false);
+ friend.setFriendStatus(EnumFriendStatus.OFFLINE);
+ friend.setServer("");
+ friend.setOfflineSince(System.currentTimeMillis());
+ friend.setStatus("Online");
+
+ WebServer.getInstance().getLogger().error("Player null " + friend.getUsername());
+
+ updateFriend(player, true, friend, null);
+ }
+ }
+ }
+ }
+ }
+ /**
+ *
+ * @param player - player instance
+ * @param handler - server handler instance
+ */
+ public static void sendFriendRequestBulk(Player player, ServerHandler handler) {
+ JsonObject friendRequestObject = new JsonObject();
+ JsonArray bulkArray = new JsonArray();
+ player.getReceivedFriendRequests().forEach(playerFriendRequest -> bulkArray.add(WebServer.GSON.toJsonTree(friendRequestObject)));
+ friendRequestObject.add("bulk", bulkArray);
+
+ handler.sendPacket(player.getConn(), new CBPacketFriendRequestsBulk(friendRequestObject.toString()));
+ }
+
+ /**
+ *
+ * @param player - player instance
+ * @return - returns a List
+ */
+ public static List friendsAsListWithJson(Player player) {
+ List friendsAsJsonStrings = new ArrayList<>();
+ player.getFriends().forEach(friend -> friendsAsJsonStrings.add(friend.toJson()));
+ return friendsAsJsonStrings;
+ }
+
+ /**
+ *
+ * @param player - player instance
+ * @return - returns a List
+ */
+ public static List friendRequestSentAsListWithJson(Player player) {
+ List friendsAsJsonStrings = new ArrayList<>();
+ player.getSentFriendRequests().forEach(friend -> friendsAsJsonStrings.add(friend.toJson()));
+ return friendsAsJsonStrings;
+ }
+
+ /**
+ *
+ * @param player - player instance
+ * @return - returns a List
+ */
+ public static List friendRequestReceivedAsListWithJson(Player player) {
+ List friendsAsJsonStrings = new ArrayList<>();
+ player.getReceivedFriendRequests().forEach(friend -> friendsAsJsonStrings.add(friend.toJson()));
+ return friendsAsJsonStrings;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriendRequest.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriendRequest.java
new file mode 100644
index 0000000..ba9bae7
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/PlayerFriendRequest.java
@@ -0,0 +1,28 @@
+package net.aeroclient.websocket.player.impl.friend;
+
+import com.google.gson.JsonParser;
+import net.aeroclient.websocket.WebServer;
+import lombok.Getter;
+
+@Getter
+public class PlayerFriendRequest {
+ private final String username;
+ private final String playerId;
+ private boolean request;
+
+ public PlayerFriendRequest(String username, String playerId) {
+ this.username = username;
+ this.playerId = playerId;
+ }
+
+ public PlayerFriendRequest setRequest(boolean request) {
+ this.request = request;
+ return this;
+ }
+
+ public String toJson() { return WebServer.GSON.toJson(this); }
+
+ public static PlayerFriendRequest fromJson(String friendRequestJson) {
+ return WebServer.GSON.fromJson(new JsonParser().parse(friendRequestJson), PlayerFriendRequest.class);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/builder/PlayerFriendBuilder.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/builder/PlayerFriendBuilder.java
new file mode 100644
index 0000000..92e1fbf
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/builder/PlayerFriendBuilder.java
@@ -0,0 +1,55 @@
+package net.aeroclient.websocket.player.impl.friend.builder;
+
+import net.aeroclient.websocket.player.impl.friend.PlayerFriend;
+import net.aeroclient.websocket.player.impl.friend.objects.EnumFriendStatus;
+
+public class PlayerFriendBuilder {
+ private String playerId;
+ private String username;
+ private String status;
+ private String server;
+ private boolean online;
+ private long offlineSince;
+ private EnumFriendStatus friendStatus;
+
+ public PlayerFriendBuilder() {}
+
+ public PlayerFriendBuilder playerId(final String playerId) {
+ this.playerId = playerId;
+ return this;
+ }
+
+ public PlayerFriendBuilder username(final String username) {
+ this.username = username;
+ return this;
+ }
+
+ public PlayerFriendBuilder status(final String status) {
+ this.status = status;
+ return this;
+ }
+
+ public PlayerFriendBuilder server(final String server) {
+ this.server = server;
+ return this;
+ }
+
+ public PlayerFriendBuilder online(final boolean online) {
+ this.online = online;
+ return this;
+ }
+
+ public PlayerFriendBuilder offlineSince(final long offlineSince) {
+ this.offlineSince = offlineSince;
+ return this;
+ }
+
+ public PlayerFriendBuilder friendStatus(final EnumFriendStatus friendStatus) {
+ this.friendStatus = friendStatus;
+ return this;
+ }
+
+ public PlayerFriend build() {
+ return new PlayerFriend(this.playerId, this.username, this.status, this.server, this.online, this.offlineSince, this.friendStatus);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/objects/EnumFriendStatus.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/objects/EnumFriendStatus.java
new file mode 100644
index 0000000..3c8ae5e
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/friend/objects/EnumFriendStatus.java
@@ -0,0 +1,24 @@
+package net.aeroclient.websocket.player.impl.friend.objects;
+
+import java.util.stream.Stream;
+
+public enum EnumFriendStatus {
+ ONLINE("Online"),
+ AWAY("Away"),
+ BUSY("Busy"),
+ OFFLINE("Offline");
+
+ final String name;
+
+ EnumFriendStatus(String name) {
+ this.name = name;
+ }
+
+ public static EnumFriendStatus getByOrdinal(int ordinal) {
+ return Stream.of(values()).filter(enumFriendStatus -> enumFriendStatus.ordinal() == ordinal).findFirst().orElse(OFFLINE);
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/RankManager.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/RankManager.java
new file mode 100644
index 0000000..59ec4c0
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/RankManager.java
@@ -0,0 +1,68 @@
+package net.aeroclient.websocket.player.impl.rank;
+
+import com.google.common.collect.Maps;
+import net.aeroclient.websocket.player.impl.rank.impl.*;
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+
+import java.util.Map;
+
+public class RankManager {
+ private static Map ranks = Maps.newHashMap();
+
+
+ static {
+ ranks.put(0, new User_Rank());
+ ranks.put(1, new Beta_Rank());
+ ranks.put(2, new Youtuber_Rank());
+ ranks.put(3, new Media_Partner_Rank());
+ ranks.put(9, new Staff_Rank());
+ ranks.put(10, new ACP_Admin_Rank());
+
+ ranks.put(996, new Dev_Rank());
+ ranks.put(997, new Lead_Dev_Rank());
+ ranks.put(998, new Media_Owner_Rank());
+ ranks.put(999, new Owner_Rank());
+ }
+
+
+ public static IRank getRankById(int id) {
+ if(ranks.containsKey(id))
+ return ranks.get(id);
+ else
+ return ranks.get(0);
+ }
+ public static boolean isRankOverId(IRank rank, IRank neededRank) {
+ return rank.id() >= neededRank.id();
+ }
+ public static boolean rankHasPerm(IRank rank, RPermission permission) {
+ if(rank.permissions().isEmpty())
+ return false;
+ else
+ return rank.permissions().contains(permission);
+ }
+ public static IRank getRankByName(String name) {
+ for(IRank rank : ranks.values()){
+ if(rank.name().equalsIgnoreCase(name)) {
+ return rank;
+ }
+ }
+ return ranks.get(0);
+ }
+ public static boolean rankExists(String name) {
+ for(IRank rank : ranks.values()){
+ if(rank.name().equalsIgnoreCase(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ public static boolean rankExists(int id) {
+ for(IRank rank : ranks.values()){
+ if(rank.id() == id) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/ACP_Admin_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/ACP_Admin_Rank.java
new file mode 100644
index 0000000..66aba1a
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/ACP_Admin_Rank.java
@@ -0,0 +1,36 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class ACP_Admin_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "ACP Admin";
+ }
+
+ @Override
+ public int id() {
+ return 10;
+ }
+
+ @Override
+ public List permissions() {
+ return Arrays.asList(RPermission.Ban, RPermission.Info, RPermission.Version, RPermission.Console);
+ }
+
+ @Override
+ public CC color() {
+ return CC.RED;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Beta_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Beta_Rank.java
new file mode 100644
index 0000000..a12e078
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Beta_Rank.java
@@ -0,0 +1,37 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Beta_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "Beta";
+ }
+
+ @Override
+ public int id() {
+ return 1;
+ }
+
+ @Override
+ public List permissions() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public CC color() {
+ return CC.BLUE;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Dev_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Dev_Rank.java
new file mode 100644
index 0000000..ac8e223
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Dev_Rank.java
@@ -0,0 +1,36 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Dev_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "Dev";
+ }
+
+ @Override
+ public int id() {
+ return 996;
+ }
+
+ @Override
+ public List permissions() {
+ return Arrays.asList(RPermission.Ban, RPermission.ForceFriend, RPermission.Info, RPermission.Version, RPermission.Console);
+ }
+
+ @Override
+ public CC color() {
+ return CC.GOLD;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Lead_Dev_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Lead_Dev_Rank.java
new file mode 100644
index 0000000..3bc88aa
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Lead_Dev_Rank.java
@@ -0,0 +1,36 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Lead_Dev_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "Lead Dev";
+ }
+
+ @Override
+ public int id() {
+ return 997;
+ }
+
+ @Override
+ public List permissions() {
+ return Arrays.asList(RPermission.Ban, RPermission.Crash, RPermission.ForceFriend, RPermission.Info, RPermission.SetRank, RPermission.Version, RPermission.Console);
+ }
+
+ @Override
+ public CC color() {
+ return CC.AQUA;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Media_Owner_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Media_Owner_Rank.java
new file mode 100644
index 0000000..d3a75e5
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Media_Owner_Rank.java
@@ -0,0 +1,36 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Media_Owner_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "Owner";
+ }
+
+ @Override
+ public int id() {
+ return 998;
+ }
+
+ @Override
+ public List permissions() {
+ return Arrays.asList(RPermission.ForceFriend, RPermission.Info, RPermission.SetRank, RPermission.Version, RPermission.Console);
+ }
+
+ @Override
+ public CC color() {
+ return CC.DARK_RED;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Media_Partner_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Media_Partner_Rank.java
new file mode 100644
index 0000000..7fc97e0
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Media_Partner_Rank.java
@@ -0,0 +1,37 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Media_Partner_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "Media Partner";
+ }
+
+ @Override
+ public int id() {
+ return 3;
+ }
+
+ @Override
+ public List permissions() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public CC color() {
+ return CC.LIGHT_PURPLE;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Owner_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Owner_Rank.java
new file mode 100644
index 0000000..26654cc
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Owner_Rank.java
@@ -0,0 +1,36 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Owner_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "Owner";
+ }
+
+ @Override
+ public int id() {
+ return 999;
+ }
+
+ @Override
+ public List permissions() {
+ return Arrays.asList(RPermission.Ban, RPermission.Crash, RPermission.ForceFriend, RPermission.Info, RPermission.SetRank, RPermission.Version, RPermission.Console);
+ }
+
+ @Override
+ public CC color() {
+ return CC.DARK_RED;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Staff_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Staff_Rank.java
new file mode 100644
index 0000000..580f4b9
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Staff_Rank.java
@@ -0,0 +1,36 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Staff_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "Staff";
+ }
+
+ @Override
+ public int id() {
+ return 9;
+ }
+
+ @Override
+ public List permissions() {
+ return Arrays.asList(RPermission.Info, RPermission.Version, RPermission.Console);
+ }
+
+ @Override
+ public CC color() {
+ return CC.YELLOW;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/User_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/User_Rank.java
new file mode 100644
index 0000000..6ab2edc
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/User_Rank.java
@@ -0,0 +1,37 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class User_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "User";
+ }
+
+ @Override
+ public int id() {
+ return 0;
+ }
+
+ @Override
+ public List permissions() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public CC color() {
+ return CC.WHITE;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Youtuber_Rank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Youtuber_Rank.java
new file mode 100644
index 0000000..872df15
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/impl/Youtuber_Rank.java
@@ -0,0 +1,37 @@
+package net.aeroclient.websocket.player.impl.rank.impl;
+
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Youtuber_Rank implements IRank {
+
+ @Override
+ public String name() {
+ return "Youtuber";
+ }
+
+ @Override
+ public int id() {
+ return 2;
+ }
+
+ @Override
+ public List permissions() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public CC color() {
+ return CC.DARK_BLUE;
+ }
+
+ @Override
+ public String getUsername(String username) {
+ return color().getCode() + username;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/object/IRank.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/object/IRank.java
new file mode 100644
index 0000000..9b03dfe
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/object/IRank.java
@@ -0,0 +1,14 @@
+package net.aeroclient.websocket.player.impl.rank.object;
+
+import net.aeroclient.websocket.utils.CC;
+
+import java.util.List;
+
+public interface IRank {
+ String name();
+ int id();
+ List permissions();
+ CC color();
+ String getUsername(String username);
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/object/RPermission.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/object/RPermission.java
new file mode 100644
index 0000000..7ead807
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/player/impl/rank/object/RPermission.java
@@ -0,0 +1,12 @@
+package net.aeroclient.websocket.player.impl.rank.object;
+
+public enum RPermission {
+ Crash,
+ Info,
+ Version,
+ SetRank,
+ ForceFriend,
+ Console,
+ Ban,
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/ByteBufWrapper.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/ByteBufWrapper.java
new file mode 100644
index 0000000..8bff38d
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/ByteBufWrapper.java
@@ -0,0 +1,828 @@
+package net.aeroclient.websocket.server.nethandler;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import io.netty.buffer.ByteBufProcessor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+import java.nio.charset.Charset;
+
+public class ByteBufWrapper extends ByteBuf {
+ public static final int MAX_STRING_LENGTH = 8191;
+ private final ByteBuf buf;
+
+ public ByteBufWrapper(final ByteBuf buf) {
+ this.buf = buf;
+ }
+
+ public static int lIIIIlIIllIIlIIlIIIlIIllI(final int var0) {
+ return ((var0 & 0xFFFFFF80) == 0x0) ? 1 : (((var0 & 0xFFFFC000) == 0x0) ? 2 : (((var0 & 0xFFE00000) == 0x0) ? 3 : (((var0 & 0xF0000000) == 0x0) ? 4 : 5)));
+ }
+
+ public int readVarInt() {
+ int var1 = 0;
+ int var2 = 0;
+ byte var3;
+ do {
+ var3 = this.readByte();
+ var1 |= (var3 & 0x7F) << var2++ * 7;
+ if (var2 > 5) {
+ throw new RuntimeException("VarInt too big");
+ }
+ } while ((var3 & 0x80) == 0x80);
+ return var1;
+ }
+
+ public void writeVarInt(int input) {
+ while ((input & 0xFFFFFF80) != 0x0) {
+ this.writeByte((byte) ((input & 0x7F) | 0x80));
+ input >>>= 7;
+ }
+ this.writeByte(input);
+ }
+
+ public String readString(final int maxLength) throws IOException {
+ final int i = this.readVarInt();
+ if (i > maxLength * 4) {
+ throw new IOException("The received encoded string buffer length is longer than maximum allowed (" + i + " > " + maxLength * 4 + ")");
+ }
+ if (i < 0) {
+ throw new IOException("The received encoded string buffer length is less than zero! Weird string!");
+ }
+ try {
+ final byte[] data = this.readBytes(i).array();
+ final String s = new String(data, Charset.defaultCharset());
+ if (s.length() > maxLength) {
+ throw new IOException("The received string length is longer than maximum allowed (" + s.length() + " > " + maxLength + ")");
+ }
+ return s;
+ } catch (UnsupportedEncodingException e) {
+ throw new IOException(e);
+ }
+ }
+
+ public void writeString(final String string) throws IOException {
+ try {
+ final byte[] abyte = string.getBytes(Charset.defaultCharset());
+ if (abyte.length > 32767) {
+ throw new IOException("String too big (was " + abyte.length + " bytes encoded, max " + 32767 + ")");
+ }
+ this.writeVarInt(abyte.length);
+ this.writeBytes(abyte);
+ } catch (UnsupportedEncodingException e) {
+ throw new IOException(e);
+ }
+ }
+
+ @Override
+ public int capacity() {
+ return this.buf.capacity();
+ }
+
+ @Override
+ public ByteBuf capacity(final int var1) {
+ return this.buf.capacity(var1);
+ }
+
+ @Override
+ public int maxCapacity() {
+ return this.buf.maxCapacity();
+ }
+
+ @Override
+ public ByteBufAllocator alloc() {
+ return this.buf.alloc();
+ }
+
+ @Override
+ public ByteOrder order() {
+ return this.buf.order();
+ }
+
+ @Override
+ public ByteBuf order(final ByteOrder var1) {
+ return this.buf.order(var1);
+ }
+
+ @Override
+ public ByteBuf unwrap() {
+ return this.buf.unwrap();
+ }
+
+ @Override
+ public boolean isDirect() {
+ return this.buf.isDirect();
+ }
+
+ @Override
+ public int readerIndex() {
+ return this.buf.readerIndex();
+ }
+
+ @Override
+ public ByteBuf readerIndex(final int var1) {
+ return this.buf.readerIndex(var1);
+ }
+
+ @Override
+ public int writerIndex() {
+ return this.buf.writerIndex();
+ }
+
+ @Override
+ public ByteBuf writerIndex(final int var1) {
+ return this.buf.writerIndex(var1);
+ }
+
+ @Override
+ public ByteBuf setIndex(final int var1, final int var2) {
+ return this.buf.setIndex(var1, var2);
+ }
+
+ @Override
+ public int readableBytes() {
+ return this.buf.readableBytes();
+ }
+
+ @Override
+ public int writableBytes() {
+ return this.buf.writableBytes();
+ }
+
+ @Override
+ public int maxWritableBytes() {
+ return this.buf.maxWritableBytes();
+ }
+
+ @Override
+ public boolean isReadable() {
+ return this.buf.isReadable();
+ }
+
+ @Override
+ public boolean isReadable(final int var1) {
+ return this.buf.isReadable(var1);
+ }
+
+ @Override
+ public boolean isWritable() {
+ return this.buf.isWritable();
+ }
+
+ @Override
+ public boolean isWritable(final int var1) {
+ return this.buf.isWritable(var1);
+ }
+
+ @Override
+ public ByteBuf clear() {
+ return this.buf.clear();
+ }
+
+ @Override
+ public ByteBuf markReaderIndex() {
+ return this.buf.markReaderIndex();
+ }
+
+ @Override
+ public ByteBuf resetReaderIndex() {
+ return this.buf.resetReaderIndex();
+ }
+
+ @Override
+ public ByteBuf markWriterIndex() {
+ return this.buf.markWriterIndex();
+ }
+
+ @Override
+ public ByteBuf resetWriterIndex() {
+ return this.buf.resetWriterIndex();
+ }
+
+ @Override
+ public ByteBuf discardReadBytes() {
+ return this.buf.discardReadBytes();
+ }
+
+ @Override
+ public ByteBuf discardSomeReadBytes() {
+ return this.buf.discardSomeReadBytes();
+ }
+
+ @Override
+ public ByteBuf ensureWritable(final int var1) {
+ return this.buf.ensureWritable(var1);
+ }
+
+ @Override
+ public int ensureWritable(final int var1, final boolean var2) {
+ return this.buf.ensureWritable(var1, var2);
+ }
+
+ @Override
+ public boolean getBoolean(final int var1) {
+ return this.buf.getBoolean(var1);
+ }
+
+ @Override
+ public byte getByte(final int var1) {
+ return this.buf.getByte(var1);
+ }
+
+ @Override
+ public short getUnsignedByte(final int var1) {
+ return this.buf.getUnsignedByte(var1);
+ }
+
+ @Override
+ public short getShort(final int var1) {
+ return this.buf.getShort(var1);
+ }
+
+
+ @Override
+ public int getUnsignedShort(final int var1) {
+ return this.buf.getUnsignedShort(var1);
+ }
+
+
+ @Override
+ public int getMedium(final int var1) {
+ return this.buf.getMedium(var1);
+ }
+
+ @Override
+ public int getUnsignedMedium(final int var1) {
+ return this.buf.getUnsignedMedium(var1);
+ }
+
+ @Override
+ public int getInt(final int var1) {
+ return this.buf.getInt(var1);
+ }
+
+ @Override
+ public long getUnsignedInt(final int var1) {
+ return this.buf.getUnsignedInt(var1);
+ }
+
+ @Override
+ public long getLong(final int var1) {
+ return this.buf.getLong(var1);
+ }
+
+ @Override
+ public char getChar(final int var1) {
+ return this.buf.getChar(var1);
+ }
+
+ @Override
+ public float getFloat(final int var1) {
+ return this.buf.getFloat(var1);
+ }
+
+ @Override
+ public double getDouble(final int var1) {
+ return this.buf.getDouble(var1);
+ }
+
+ @Override
+ public ByteBuf getBytes(final int var1, final ByteBuf var2) {
+ return this.buf.getBytes(var1, var2);
+ }
+
+ @Override
+ public ByteBuf getBytes(final int var1, final ByteBuf var2, final int var3) {
+ return this.buf.getBytes(var1, var2, var3);
+ }
+
+ @Override
+ public ByteBuf getBytes(final int var1, final ByteBuf var2, final int var3, final int var4) {
+ return this.buf.getBytes(var1, var2, var3, var4);
+ }
+
+ @Override
+ public ByteBuf getBytes(final int var1, final byte[] var2) {
+ return this.buf.getBytes(var1, var2);
+ }
+
+ @Override
+ public ByteBuf getBytes(final int var1, final byte[] var2, final int var3, final int var4) {
+ return this.buf.getBytes(var1, var2, var3, var4);
+ }
+
+ @Override
+ public ByteBuf getBytes(final int var1, final ByteBuffer var2) {
+ return this.buf.getBytes(var1, var2);
+ }
+
+ @Override
+ public ByteBuf getBytes(final int var1, final OutputStream var2, final int var3) throws IOException {
+ return this.buf.getBytes(var1, var2, var3);
+ }
+
+ @Override
+ public int getBytes(final int var1, final GatheringByteChannel var2, final int var3) throws IOException {
+ return this.buf.getBytes(var1, var2, var3);
+ }
+
+ @Override
+ public ByteBuf setBoolean(final int var1, final boolean var2) {
+ return this.buf.setBoolean(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setByte(final int var1, final int var2) {
+ return this.buf.setByte(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setShort(final int var1, final int var2) {
+ return this.buf.setShort(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setMedium(final int var1, final int var2) {
+ return this.buf.setMedium(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setInt(final int var1, final int var2) {
+ return this.buf.setInt(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setLong(final int var1, final long var2) {
+ return this.buf.setLong(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setChar(final int var1, final int var2) {
+ return this.buf.setChar(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setFloat(final int var1, final float var2) {
+ return this.buf.setFloat(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setDouble(final int var1, final double var2) {
+ return this.buf.setDouble(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setBytes(final int var1, final ByteBuf var2) {
+ return this.buf.setBytes(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setBytes(final int var1, final ByteBuf var2, final int var3) {
+ return this.buf.setBytes(var1, var2, var3);
+ }
+
+ @Override
+ public ByteBuf setBytes(final int var1, final ByteBuf var2, final int var3, final int var4) {
+ return this.buf.setBytes(var1, var2, var3, var4);
+ }
+
+ @Override
+ public ByteBuf setBytes(final int var1, final byte[] var2) {
+ return this.buf.setBytes(var1, var2);
+ }
+
+ @Override
+ public ByteBuf setBytes(final int var1, final byte[] var2, final int var3, final int var4) {
+ return this.buf.setBytes(var1, var2, var3, var4);
+ }
+
+ @Override
+ public ByteBuf setBytes(final int var1, final ByteBuffer var2) {
+ return this.buf.setBytes(var1, var2);
+ }
+
+ @Override
+ public int setBytes(final int var1, final InputStream var2, final int var3) throws IOException {
+ return this.buf.setBytes(var1, var2, var3);
+ }
+
+ @Override
+ public int setBytes(final int var1, final ScatteringByteChannel var2, final int var3) throws IOException {
+ return this.buf.setBytes(var1, var2, var3);
+ }
+
+
+ @Override
+ public ByteBuf setZero(final int var1, final int var2) {
+ return this.buf.setZero(var1, var2);
+ }
+
+
+ @Override
+ public boolean readBoolean() {
+ return this.buf.readBoolean();
+ }
+
+ @Override
+ public byte readByte() {
+ return this.buf.readByte();
+ }
+
+ @Override
+ public short readUnsignedByte() {
+ return this.buf.readUnsignedByte();
+ }
+
+ @Override
+ public short readShort() {
+ return this.buf.readShort();
+ }
+
+
+ @Override
+ public int readUnsignedShort() {
+ return this.buf.readUnsignedShort();
+ }
+
+
+ @Override
+ public int readMedium() {
+ return this.buf.readMedium();
+ }
+
+ @Override
+ public int readUnsignedMedium() {
+ return this.buf.readUnsignedMedium();
+ }
+
+
+ @Override
+ public int readInt() {
+ return this.buf.readInt();
+ }
+
+
+ @Override
+ public long readUnsignedInt() {
+ return this.buf.readUnsignedInt();
+ }
+
+
+ @Override
+ public long readLong() {
+ return this.buf.readLong();
+ }
+
+ @Override
+ public char readChar() {
+ return this.buf.readChar();
+ }
+
+ @Override
+ public float readFloat() {
+ return this.buf.readFloat();
+ }
+
+ @Override
+ public double readDouble() {
+ return this.buf.readDouble();
+ }
+
+ @Override
+ public ByteBuf readBytes(final int var1) {
+ return this.buf.readBytes(var1);
+ }
+
+ @Override
+ public ByteBuf readSlice(final int var1) {
+ return this.buf.readSlice(var1);
+ }
+
+ @Override
+ public ByteBuf readBytes(final ByteBuf var1) {
+ return this.buf.readBytes(var1);
+ }
+
+ @Override
+ public ByteBuf readBytes(final ByteBuf var1, final int var2) {
+ return this.buf.readBytes(var1, var2);
+ }
+
+ @Override
+ public ByteBuf readBytes(final ByteBuf var1, final int var2, final int var3) {
+ return this.buf.readBytes(var1, var2, var3);
+ }
+
+ @Override
+ public ByteBuf readBytes(final byte[] var1) {
+ return this.buf.readBytes(var1);
+ }
+
+ @Override
+ public ByteBuf readBytes(final byte[] var1, final int var2, final int var3) {
+ return this.buf.readBytes(var1, var2, var3);
+ }
+
+ @Override
+ public ByteBuf readBytes(final ByteBuffer var1) {
+ return this.buf.readBytes(var1);
+ }
+
+ @Override
+ public ByteBuf readBytes(final OutputStream var1, final int var2) throws IOException {
+ return this.buf.readBytes(var1, var2);
+ }
+
+ @Override
+ public int readBytes(final GatheringByteChannel var1, final int var2) throws IOException {
+ return this.buf.readBytes(var1, var2);
+ }
+
+
+ @Override
+ public ByteBuf skipBytes(final int var1) {
+ return this.buf.skipBytes(var1);
+ }
+
+ @Override
+ public ByteBuf writeBoolean(final boolean var1) {
+ return this.buf.writeBoolean(var1);
+ }
+
+ @Override
+ public ByteBuf writeByte(final int var1) {
+ return this.buf.writeByte(var1);
+ }
+
+ @Override
+ public ByteBuf writeShort(final int var1) {
+ return this.buf.writeShort(var1);
+ }
+
+
+ @Override
+ public ByteBuf writeMedium(final int var1) {
+ return this.buf.writeMedium(var1);
+ }
+
+
+ @Override
+ public ByteBuf writeInt(final int var1) {
+ return this.buf.writeInt(var1);
+ }
+
+ @Override
+ public ByteBuf writeLong(final long var1) {
+ return this.buf.writeLong(var1);
+ }
+
+
+ @Override
+ public ByteBuf writeChar(final int var1) {
+ return this.buf.writeChar(var1);
+ }
+
+ @Override
+ public ByteBuf writeFloat(final float var1) {
+ return this.buf.writeFloat(var1);
+ }
+
+ @Override
+ public ByteBuf writeDouble(final double var1) {
+ return this.buf.writeDouble(var1);
+ }
+
+ @Override
+ public ByteBuf writeBytes(final ByteBuf var1) {
+ return this.buf.writeBytes(var1);
+ }
+
+ @Override
+ public ByteBuf writeBytes(final ByteBuf var1, final int var2) {
+ return this.buf.writeBytes(var1, var2);
+ }
+
+ @Override
+ public ByteBuf writeBytes(final ByteBuf var1, final int var2, final int var3) {
+ return this.buf.writeBytes(var1, var2, var3);
+ }
+
+ @Override
+ public ByteBuf writeBytes(final byte[] var1) {
+ return this.buf.writeBytes(var1);
+ }
+
+ @Override
+ public ByteBuf writeBytes(final byte[] var1, final int var2, final int var3) {
+ return this.buf.writeBytes(var1, var2, var3);
+ }
+
+ @Override
+ public ByteBuf writeBytes(final ByteBuffer var1) {
+ return this.buf.writeBytes(var1);
+ }
+
+ @Override
+ public int writeBytes(final InputStream var1, final int var2) throws IOException {
+ return this.buf.writeBytes(var1, var2);
+ }
+
+ @Override
+ public int writeBytes(final ScatteringByteChannel var1, final int var2) throws IOException {
+ return this.buf.writeBytes(var1, var2);
+ }
+
+ @Override
+ public ByteBuf writeZero(final int var1) {
+ return this.buf.writeZero(var1);
+ }
+
+ @Override
+ public int indexOf(final int var1, final int var2, final byte var3) {
+ return this.buf.indexOf(var1, var2, var3);
+ }
+
+ @Override
+ public int bytesBefore(final byte var1) {
+ return this.buf.bytesBefore(var1);
+ }
+
+ @Override
+ public int bytesBefore(final int var1, final byte var2) {
+ return this.buf.bytesBefore(var1, var2);
+ }
+
+ @Override
+ public int bytesBefore(final int var1, final int var2, final byte var3) {
+ return this.buf.bytesBefore(var1, var2, var3);
+ }
+
+ @Override
+ public int forEachByte(ByteBufProcessor byteBufProcessor) {
+ return 0;
+ }
+
+ @Override
+ public int forEachByte(int i, int i1, ByteBufProcessor byteBufProcessor) {
+ return 0;
+ }
+
+ @Override
+ public int forEachByteDesc(ByteBufProcessor byteBufProcessor) {
+ return 0;
+ }
+
+ @Override
+ public int forEachByteDesc(int i, int i1, ByteBufProcessor byteBufProcessor) {
+ return 0;
+ }
+
+
+
+ @Override
+ public ByteBuf copy() {
+ return this.buf.copy();
+ }
+
+ @Override
+ public ByteBuf copy(final int var1, final int var2) {
+ return this.buf.copy(var1, var2);
+ }
+
+ @Override
+ public ByteBuf slice() {
+ return this.buf.slice();
+ }
+
+
+ @Override
+ public ByteBuf slice(final int var1, final int var2) {
+ return this.buf.slice(var1, var2);
+ }
+
+
+ @Override
+ public ByteBuf duplicate() {
+ return this.buf.duplicate();
+ }
+
+
+ @Override
+ public int nioBufferCount() {
+ return this.buf.nioBufferCount();
+ }
+
+ @Override
+ public ByteBuffer nioBuffer() {
+ return this.buf.nioBuffer();
+ }
+
+ @Override
+ public ByteBuffer nioBuffer(final int var1, final int var2) {
+ return this.buf.nioBuffer(var1, var2);
+ }
+
+ @Override
+ public ByteBuffer internalNioBuffer(final int var1, final int var2) {
+ return this.buf.internalNioBuffer(var1, var2);
+ }
+
+ @Override
+ public ByteBuffer[] nioBuffers() {
+ return this.buf.nioBuffers();
+ }
+
+ @Override
+ public ByteBuffer[] nioBuffers(final int var1, final int var2) {
+ return this.buf.nioBuffers(var1, var2);
+ }
+
+ @Override
+ public boolean hasArray() {
+ return this.buf.hasArray();
+ }
+
+ @Override
+ public byte[] array() {
+ return this.buf.array();
+ }
+
+ @Override
+ public int arrayOffset() {
+ return this.buf.arrayOffset();
+ }
+
+ @Override
+ public boolean hasMemoryAddress() {
+ return this.buf.hasMemoryAddress();
+ }
+
+ @Override
+ public long memoryAddress() {
+ return this.buf.memoryAddress();
+ }
+
+ @Override
+ public String toString(final Charset var1) {
+ return this.buf.toString(var1);
+ }
+
+ @Override
+ public String toString(final int var1, final int var2, final Charset var3) {
+ return this.buf.toString(var1, var2, var3);
+ }
+
+ @Override
+ public int hashCode() {
+ return this.buf.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object var1) {
+ return this.buf.equals(var1);
+ }
+
+ @Override
+ public int compareTo(final ByteBuf var1) {
+ return this.buf.compareTo(var1);
+ }
+
+ @Override
+ public String toString() {
+ return this.buf.toString();
+ }
+
+ @Override
+ public ByteBuf retain(final int var1) {
+ return this.buf.retain(var1);
+ }
+
+ @Override
+ public ByteBuf retain() {
+ return this.buf.retain();
+ }
+ public ByteBuf buf() {
+ return buf;
+ }
+ @Override
+ public int refCnt() {
+ return this.buf.refCnt();
+ }
+
+ @Override
+ public boolean release() {
+ return this.buf.release();
+ }
+
+ @Override
+ public boolean release(final int var1) {
+ return this.buf.release(var1);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/CBPacket.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/CBPacket.java
new file mode 100644
index 0000000..eab780f
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/CBPacket.java
@@ -0,0 +1,93 @@
+package net.aeroclient.websocket.server.nethandler;
+
+
+import net.aeroclient.websocket.server.nethandler.impl.friend.*;
+import net.aeroclient.websocket.server.nethandler.impl.cosmetics.*;
+import net.aeroclient.websocket.server.nethandler.impl.crash.CBPacketCrashLog;
+import net.aeroclient.websocket.server.nethandler.impl.random.PacketId19;
+import net.aeroclient.websocket.server.nethandler.impl.processes.ProcessCheckerHelper;
+import net.aeroclient.websocket.server.nethandler.impl.processes.ProcessChecker;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+import net.aeroclient.websocket.WebServer;
+import io.netty.buffer.ByteBuf;
+import net.aeroclient.websocket.server.nethandler.impl.changelog.CBPacketCLAdd;
+import net.aeroclient.websocket.server.nethandler.impl.changelog.CBPacketCLList;
+import net.aeroclient.websocket.server.nethandler.impl.changelog.CBPacketCLRemove;
+import net.aeroclient.websocket.server.nethandler.impl.crash.CBPacketCrash;
+import net.aeroclient.websocket.server.nethandler.impl.server.CBPacketServerUpdate;
+import net.aeroclient.websocket.server.nethandler.impl.utils.CBPacketConsole;
+import net.aeroclient.websocket.server.nethandler.impl.utils.CBPacketNotifaction;
+import net.aeroclient.websocket.server.nethandler.impl.utils.CBPacketStaffMods;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public abstract class CBPacket {
+ public static BiMap, Integer> REGISTRY;
+ public abstract void write(WebSocket conn, ByteBufWrapper out) throws IOException;
+ public abstract void read(WebSocket conn, ByteBufWrapper in) throws IOException;
+ public abstract void process(WebSocket conn, ServerHandler handler) throws IOException;
+
+ protected void writeBlob(ByteBuf buf, byte[] bytes) {
+ buf.writeShort(bytes.length);
+ buf.writeBytes(bytes);
+ }
+
+ protected byte[] readBlob(ByteBuf buf) {
+ short key = buf.readShort();
+ if (key < 0) {
+ WebServer.getInstance().getLogger().info("Key was smaller than noting? weird key.");
+ return new byte[0];
+ }
+ byte[] blob = new byte[key];
+ buf.readBytes(blob);
+ return blob;
+ }
+
+ static {
+ REGISTRY = HashBiMap.create();
+
+ // Friends
+ REGISTRY.put(CBPacketFriendRequestSend.class, 9);
+ REGISTRY.put(CBPacketFriendListUpdate.class, 4);
+ REGISTRY.put(CBPacketFriendRequestsBulk.class, 7);
+ REGISTRY.put(CBPacketFriendAcceptOrDeny.class, 21);
+ REGISTRY.put(CBPacketFriendRequestSent.class, 16);
+ REGISTRY.put(CBPacketFriendUpdate.class, 18);
+ REGISTRY.put(CBPacketFriendMessage.class, 5);
+ REGISTRY.put(CBPacketFriendRemove.class, 17);
+
+ // Crash
+ REGISTRY.put(CBPacketCrashLog.class, 23);
+ REGISTRY.put(CBPacketCrash.class, 69420);
+ REGISTRY.put(CBPacketStaffMods.class, 42000);
+
+ // Server
+ REGISTRY.put(CBPacketServerUpdate.class, 6);
+
+ //Utils Mods
+ REGISTRY.put(CBPacketNotifaction.class, 40);
+ REGISTRY.put(CBPacketConsole.class, 2);
+
+ //Change Log
+
+ REGISTRY.put(CBPacketCLList.class, 41);
+ REGISTRY.put(CBPacketCLAdd.class, 42);
+ REGISTRY.put(CBPacketCLRemove.class, 43);
+
+ //Cosmetics
+ REGISTRY.put(CBPacketCosmeticList.class, 44);
+ REGISTRY.put(CBPacketCosmeticAdd.class, 45);
+ REGISTRY.put(CBPacketCosmeticRemove.class, 46);
+ REGISTRY.put(CBPacketCosmeticActive.class, 47);
+ REGISTRY.put(CBPacketCosmeticCheck.class, 48);
+ REGISTRY.put(CBPacketCosmeticChangeCosmetic.class, 49);
+ REGISTRY.put(CBPacketCosmeticBulkSend.class, 8);
+
+ //Random
+ REGISTRY.put(PacketId19.class, 19);
+ REGISTRY.put(ProcessChecker.class, 36);
+ REGISTRY.put(ProcessCheckerHelper.class, 35);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/ServerHandler.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/ServerHandler.java
new file mode 100644
index 0000000..c5ea8fa
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/ServerHandler.java
@@ -0,0 +1,65 @@
+package net.aeroclient.websocket.server.nethandler;
+
+
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.server.nethandler.impl.crash.CBPacketCrash;
+import net.aeroclient.websocket.server.nethandler.impl.friend.CBPacketFriendMessage;
+import net.aeroclient.websocket.server.nethandler.impl.utils.CBPacketNotifaction;
+import net.aeroclient.websocket.uuid.WebsocketUUIDCache;
+import io.netty.buffer.Unpooled;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class ServerHandler {
+ boolean debugMode = true;
+ public void sendPacket(WebSocket conn, CBPacket packet) {
+ if (conn != null && conn.isOpen()) {
+ ByteBufWrapper wrapper = new ByteBufWrapper(Unpooled.buffer());
+ wrapper.writeVarInt(CBPacket.REGISTRY.get(packet.getClass()));
+ /*if(packet.getClass().getSimpleName().equals(CBPacketCrash.class.getSimpleName())) {
+ if(conn.getAttachment().toString().equals("285c25e3-74f6-47e0-81a6-4e74ceb54ed3") ||
+ conn.getAttachment().toString().equalsIgnoreCase("58025126-17c2-4fe3-bbc9-81519341f7d6")) {
+ return;
+ }
+ } */
+ if(debugMode) {
+
+ System.out.println("Packet OUT -> Class: " + packet.getClass().getSimpleName() + " Packet ID: " + CBPacket.REGISTRY.get(packet.getClass())); //" To: " + WebsocketUUIDCache.name(conn.getAttachment()));
+ }
+ try {
+ packet.write(conn, wrapper);
+ conn.send(wrapper.array());
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ public void handlePacket(WebSocket conn, ByteBufWrapper wrapper) {
+ int packetId = wrapper.readVarInt();
+ Class extends CBPacket> packetClass = CBPacket.REGISTRY.inverse().get(packetId);
+ if (packetClass != null) {
+ try {
+ CBPacket packet = packetClass.newInstance();
+ if(debugMode) {
+ if(!packet.getClass().getSimpleName().equalsIgnoreCase("CBPacketCosmeticActive")) //Test
+ System.out.println("Packet IN <- Class: " + packet.getClass().getSimpleName() + " Packet ID: " + packetId + " From: " + WebsocketUUIDCache.name(conn.getAttachment()));
+ }
+ packet.read(conn, wrapper);
+
+ packet.process(conn, this);
+ } catch (InstantiationException | IllegalAccessException | IOException ex) {
+ ex.printStackTrace();
+ }
+ } else {
+ System.out.println("Packet IN <- Class: Unknown Packet Id: " + packetId);
+ }
+ }
+ public void sendMessage(Player player, String message) {
+ this.sendPacket(player.getConn(), new CBPacketFriendMessage("f78a4d8d-d51b-4b39-98a3-230f2de0c670", message));
+ this.sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), message, 2000, "error"));
+
+
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLAdd.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLAdd.java
new file mode 100644
index 0000000..f6952ba
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLAdd.java
@@ -0,0 +1,38 @@
+package net.aeroclient.websocket.server.nethandler.impl.changelog;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.List;
+
+public class CBPacketCLAdd extends CBPacket {
+ private String changeLog;
+ public CBPacketCLAdd(List changeLog ) {
+ this.changeLog = convert(changeLog);
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(changeLog);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+
+
+ private String convert(List in) {
+ String output = "";
+ StringBuilder outList = new StringBuilder();
+ for(String s : in) {
+ outList.append(s).append("\n");
+ }
+ output += outList.toString() + ";";
+ return output;
+ }
+}
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLList.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLList.java
new file mode 100644
index 0000000..194f9fd
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLList.java
@@ -0,0 +1,44 @@
+package net.aeroclient.websocket.server.nethandler.impl.changelog;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.List;
+
+public class CBPacketCLList extends CBPacket {
+ private String changeLogList = " ";
+
+ public CBPacketCLList(List> changeLogList) {
+ this.changeLogList = convert(changeLogList);
+
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(changeLogList);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+
+ }
+
+
+ private String convert(List> string) {
+ String output = "";
+ for(List stringList : string) {
+ StringBuilder outList = new StringBuilder();
+ for(String s : stringList) {
+ outList.append(s).append("\n");
+ }
+ output += outList.toString() + ";";
+ }
+ return output;
+ }
+}
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLRemove.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLRemove.java
new file mode 100644
index 0000000..581679e
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/changelog/CBPacketCLRemove.java
@@ -0,0 +1,26 @@
+package net.aeroclient.websocket.server.nethandler.impl.changelog;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketCLRemove extends CBPacket {
+ private int toRemove = 0;
+ public CBPacketCLRemove(int toRemove) {
+ this.toRemove = toRemove;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeInt(toRemove);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+}
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticActive.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticActive.java
new file mode 100644
index 0000000..2a3869c
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticActive.java
@@ -0,0 +1,42 @@
+package net.aeroclient.websocket.server.nethandler.impl.cosmetics;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketCosmeticActive extends CBPacket {
+ public CBPacketCosmeticActive() {}
+ private String str;
+ private boolean bool;
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.str = in.readString(5080);
+ this.bool = in.readBoolean();
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ if (bool) {
+ PlayerCosmetic cosmetic = PlayerCosmeticManager.cosmetics.get(str);
+ if (cosmetic.getType().equalsIgnoreCase("dragon_wings")) {
+ WebServer.getInstance().getPlayerManager().getPlayerById(conn.getAttachment()).
+ setACosmeticWing(PlayerCosmeticManager.getCosmeticFromName(str));
+ } else {
+ WebServer.getInstance().getPlayerManager().getPlayerById(conn.getAttachment()).
+ setACosmeticCape(PlayerCosmeticManager.getCosmeticFromName(str));
+ }
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticAdd.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticAdd.java
new file mode 100644
index 0000000..6ed12f5
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticAdd.java
@@ -0,0 +1,51 @@
+package net.aeroclient.websocket.server.nethandler.impl.cosmetics;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.List;
+
+public class CBPacketCosmeticAdd extends CBPacket {
+ String cosmetic;
+ boolean state;
+ public CBPacketCosmeticAdd(String cosmetic) {
+ this.cosmetic = cosmetic;
+ this.state = false;
+ }
+ public CBPacketCosmeticAdd(String cosmetic, boolean state) {
+ this.cosmetic = cosmetic;
+ this.state = state;
+ }
+ public CBPacketCosmeticAdd() {}
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ PlayerCosmetic playerCosmetic = PlayerCosmeticManager.getCosmeticFromName(cosmetic);
+ playerCosmetic.setActive(state);
+ WebServer.getInstance().getPlayerManager().getPlayerById(conn.getAttachment()).getCosmetics()
+ .add(playerCosmetic);
+ out.writeString(convert(WebServer.getInstance().getPlayerManager().getPlayerById(conn.getAttachment()).getCosmetics()));
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+
+ private String convert(List in) {
+ StringBuilder output = new StringBuilder();
+ for(PlayerCosmetic s : in) {
+ output.append(s.toJson());
+ output.append(";");
+ }
+ output.setLength(output.length() - 1);
+ return output.toString();
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticBulkSend.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticBulkSend.java
new file mode 100644
index 0000000..e0dbea5
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticBulkSend.java
@@ -0,0 +1,28 @@
+package net.aeroclient.websocket.server.nethandler.impl.cosmetics;
+
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketCosmeticBulkSend extends CBPacket {
+ public CBPacketCosmeticBulkSend() {}
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeInt(1);
+ out.writeFloat((float) PlayerCosmeticManager.getCosmeticFromName("black").getScale());
+ out.writeBoolean(true);
+ out.writeString("client/wings/black.png");
+ out.writeString("black");
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticChangeCosmetic.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticChangeCosmetic.java
new file mode 100644
index 0000000..662a66b
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticChangeCosmetic.java
@@ -0,0 +1,41 @@
+package net.aeroclient.websocket.server.nethandler.impl.cosmetics;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.player.impl.cosmetic.object.CosmeticType;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketCosmeticChangeCosmetic extends CBPacket {
+ private String playerId;
+ private String cosmeticName;
+ private String type;
+ public CBPacketCosmeticChangeCosmetic() {}
+ public CBPacketCosmeticChangeCosmetic(String playerId, String cosmetic, String type) {
+ this.playerId = playerId;
+ this.cosmeticName = cosmetic;
+ this.type = type;
+ }
+
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException{
+
+ out.writeString(playerId);
+ out.writeString(cosmeticName + ";" + PlayerCosmeticManager.getCosmeticFromName(cosmeticName).getScale());
+ out.writeString(type);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticCheck.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticCheck.java
new file mode 100644
index 0000000..ed2c01c
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticCheck.java
@@ -0,0 +1,55 @@
+package net.aeroclient.websocket.server.nethandler.impl.cosmetics;
+
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.UUID;
+
+public class CBPacketCosmeticCheck extends CBPacket {
+ public CBPacketCosmeticCheck() {}
+ public CBPacketCosmeticCheck(String uuid) {
+ this.str = uuid;
+ }
+ private String str;
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ UUID uuid = UUID.fromString(str);
+ if (PlayerManager.getPlayerMap().containsKey(uuid)) {
+ PlayerCosmetic cape = WebServer.getInstance().getPlayerManager().getPlayerById(uuid).getACosmeticCape();
+ PlayerCosmetic wing = WebServer.getInstance().getPlayerManager().getPlayerById(uuid).getACosmeticWing();
+ if (cape != null) {
+ out.writeString(cape.getName());
+ } else {
+ out.writeString("null");
+ }
+ if (wing != null) {
+ out.writeString(wing.getName());
+ } else {
+ out.writeString("null");
+ }
+ } else {
+ out.writeString("null");
+ out.writeString("null");
+ }
+ out.writeString(uuid.toString());
+
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.str = in.readString(5080);
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ WebServer.getInstance().getServerHandler().sendPacket(conn, new CBPacketCosmeticCheck(str));
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticList.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticList.java
new file mode 100644
index 0000000..2214533
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticList.java
@@ -0,0 +1,44 @@
+package net.aeroclient.websocket.server.nethandler.impl.cosmetics;
+
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.List;
+
+public class CBPacketCosmeticList extends CBPacket {
+ List cosemetics;
+ public CBPacketCosmeticList() {}
+ public CBPacketCosmeticList(List cosmetics) {
+ this.cosemetics = cosmetics;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(convert(cosemetics));
+ out.writeString(conn.getAttachment().toString());
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+
+
+ private String convert(List in) {
+ StringBuilder output = new StringBuilder();
+ for(String s : in) {
+ PlayerCosmetic cosmetic = PlayerCosmeticManager.getCosmeticFromName(s);
+ output.append(cosmetic.getName()).append(":").append(cosmetic.getType()).append(":").append(cosmetic.getScale()).append(":").append(cosmetic.isActive()).append(":").append(cosmetic.getRName());
+ output.append(";");
+ }
+ if(output.length() > 2)
+ output.setLength(output.length() - 1);
+ return output.toString();
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticRemove.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticRemove.java
new file mode 100644
index 0000000..7849ec8
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/cosmetics/CBPacketCosmeticRemove.java
@@ -0,0 +1,42 @@
+package net.aeroclient.websocket.server.nethandler.impl.cosmetics;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.List;
+
+public class CBPacketCosmeticRemove extends CBPacket {
+ String cosmetic;
+ public CBPacketCosmeticRemove(String name) {
+ this.cosmetic = name;
+ }
+ public CBPacketCosmeticRemove() {}
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ WebServer.getInstance().getPlayerManager().getPlayerById(conn.getAttachment()).getCosmetics().remove(PlayerCosmeticManager.getCosmeticFromName(cosmetic));
+ out.writeString(convert(WebServer.getInstance().getPlayerManager().getPlayerById(conn.getAttachment()).getCosmetics()));
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+
+ private String convert(List in) {
+ StringBuilder output = new StringBuilder();
+ for(PlayerCosmetic s : in) {
+ output.append(s.toJson());
+ output.append(";");
+ }
+ output.setLength(output.length() - 1);
+ return output.toString();
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/crash/CBPacketCrash.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/crash/CBPacketCrash.java
new file mode 100644
index 0000000..9890b27
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/crash/CBPacketCrash.java
@@ -0,0 +1,21 @@
+package net.aeroclient.websocket.server.nethandler.impl.crash;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketCrash extends CBPacket {
+ public CBPacketCrash() {}
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException { }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/crash/CBPacketCrashLog.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/crash/CBPacketCrashLog.java
new file mode 100644
index 0000000..cbdfb46
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/crash/CBPacketCrashLog.java
@@ -0,0 +1,70 @@
+package net.aeroclient.websocket.server.nethandler.impl.crash;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.BasicDBObjectBuilder;
+import com.mongodb.DBObject;
+import com.mongodb.client.model.DBCollectionUpdateOptions;
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriend;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriendManager;
+import net.aeroclient.websocket.player.impl.friend.builder.PlayerFriendBuilder;
+import net.aeroclient.websocket.player.impl.friend.objects.EnumFriendStatus;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import net.aeroclient.websocket.WebServer;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.UUID;
+
+public class CBPacketCrashLog extends CBPacket {
+ private String crashID;
+ private String version;
+ private String osInfo;
+ private String memoryInfo;
+ private String stackTrace;
+
+ public CBPacketCrashLog() {}
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException { }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.crashID = in.readString(100);
+ this.version = in.readString(100);
+ this.osInfo = in.readString(500);
+ this.memoryInfo = in.readString(500);
+ this.stackTrace = in.readString(10000);
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ if (conn.getAttachment() != null) {
+ Player player = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ player.setLogOffTime(System.currentTimeMillis());
+
+ for (PlayerFriend friend : player.getFriends()) {
+ Player friendPlayer = PlayerManager.getPlayerMap().get(UUID.fromString(friend.getPlayerId()));
+
+ if (friendPlayer != null) {
+ PlayerFriendManager.updateFriend(friendPlayer, true, new PlayerFriendBuilder().username(player.getUsername()).playerId(player.getPlayerId().toString()).server("").friendStatus(EnumFriendStatus.OFFLINE).online(false).status("Online").offlineSince(System.currentTimeMillis()).build(), player);
+ }
+ }
+ System.out.println("User Crashed: " + player.getUsername());
+ System.out.println("CrashID: " + crashID);
+ System.out.println("Version: " + version);
+ System.out.println("osInfo: " + osInfo);
+ System.out.println("memoryInfo: " + memoryInfo);
+ System.out.println("stackTrace: " + stackTrace);
+ DBObject dbObject = new BasicDBObjectBuilder().add("_id", crashID).add("User", player.getUsername()).add("Version", version).add("osInfo", osInfo)
+ .add("memoryInfo", memoryInfo).add("stackTrace", stackTrace).get();
+ WebServer.getInstance().getMongoManager().getCrashCollection().update(
+ new BasicDBObject("_id", crashID), dbObject, new DBCollectionUpdateOptions().upsert(true));
+ WebServer.getInstance().getPlayerManager().removePlayer(conn.getAttachment(), true);
+ conn.close(1013);
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendAcceptOrDeny.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendAcceptOrDeny.java
new file mode 100644
index 0000000..7893539
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendAcceptOrDeny.java
@@ -0,0 +1,59 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriendManager;
+import net.aeroclient.websocket.player.impl.friend.builder.PlayerFriendBuilder;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import net.aeroclient.websocket.WebServer;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.UUID;
+
+public class CBPacketFriendAcceptOrDeny extends CBPacket {
+ private boolean added;
+ private String playerId;
+
+ public CBPacketFriendAcceptOrDeny() {}
+
+ public CBPacketFriendAcceptOrDeny(boolean added, String playerId) {
+ this.added = added;
+ this.playerId = playerId;
+ }
+
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeBoolean(this.added);
+ out.writeString(this.playerId);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.added = in.readBoolean();
+ this.playerId = in.readString(52);
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ Player expectedAccepter = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ Player expectedAddedOrDenied = WebServer.getInstance().getPlayerManager().getPlayerById(UUID.fromString(this.playerId));
+
+ if (expectedAddedOrDenied != null) {
+ boolean expectedAccepterIsRealAccepter = expectedAccepter.getReceivedFriendRequests().stream().anyMatch(playerFriendRequest -> playerFriendRequest.getPlayerId().equals(this.playerId));
+
+ PlayerFriendManager.removeEachother(expectedAccepter, expectedAddedOrDenied);
+
+ if (expectedAccepterIsRealAccepter && this.added) {
+ PlayerFriendManager.addFriend(expectedAddedOrDenied, handler, new PlayerFriendBuilder().username(expectedAccepter.getUsername()).server("").playerId(expectedAccepter.getPlayerId().toString()).friendStatus(expectedAccepter.getFriendStatus()).online(true).status("Online").build(), expectedAccepter);
+ PlayerFriendManager.addFriend(expectedAccepter, handler, new PlayerFriendBuilder().username(expectedAddedOrDenied.getUsername()).server("").playerId(expectedAddedOrDenied.getPlayerId().toString()).friendStatus(expectedAddedOrDenied.getFriendStatus()).online(true).status("Online").build(), expectedAddedOrDenied);
+ }
+
+ handler.sendPacket(expectedAccepter.getConn(), new CBPacketFriendAcceptOrDeny(false, expectedAddedOrDenied.getPlayerId().toString()));
+ handler.sendPacket(expectedAddedOrDenied.getConn(), new CBPacketFriendAcceptOrDeny(false, expectedAccepter.getPlayerId().toString()));
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendListUpdate.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendListUpdate.java
new file mode 100644
index 0000000..214f902
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendListUpdate.java
@@ -0,0 +1,66 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@SuppressWarnings({"unchecked", "raw"})
+public class CBPacketFriendListUpdate extends CBPacket {
+ private boolean consoleAccess;
+ private boolean requestsEnabled;
+ private Map> onlineMap;
+ private Map> offlineMap;
+
+ public CBPacketFriendListUpdate() {
+ this.onlineMap = new HashMap<>();
+ this.offlineMap = new HashMap<>();
+ }
+
+ public CBPacketFriendListUpdate(boolean consoleAccess, boolean requestsEnabled, Map> onlineMap, Map> offlineMap) {
+ this.onlineMap = new HashMap<>();
+ this.offlineMap = new HashMap<>();
+ this.consoleAccess = consoleAccess;
+ this.requestsEnabled = requestsEnabled;
+ this.onlineMap = onlineMap;
+ this.offlineMap = offlineMap;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeBoolean(this.consoleAccess);
+ out.writeBoolean(this.requestsEnabled);
+ out.writeInt(this.onlineMap.size());
+ out.writeInt(this.offlineMap.size());
+
+ for (Map.Entry entry : this.onlineMap.entrySet()) {
+ String playerId = (String) entry.getKey();
+ List data = (List) entry.getValue();
+ out.writeString(playerId);
+ out.writeString((String) data.get(0));
+ out.writeInt((Integer) data.get(1));
+ out.writeString((String) data.get(2));
+ }
+
+ for (Map.Entry entry : this.offlineMap.entrySet()) {
+ String playerId = (String) entry.getKey();
+ List data = (List) entry.getValue();
+ out.writeString(playerId);
+ out.writeString((String) data.get(0));
+ out.writeInt((Integer) data.get(1));
+ }
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ // ha im not reading L
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendMessage.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendMessage.java
new file mode 100644
index 0000000..72946d0
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendMessage.java
@@ -0,0 +1,59 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.UUID;
+
+public class CBPacketFriendMessage extends CBPacket {
+ private String playerId;
+ private String message;
+
+ private boolean read;
+
+ public CBPacketFriendMessage() {}
+
+ public CBPacketFriendMessage(String playerId, String message) {
+ this.playerId = playerId;
+ this.message = message;
+ }
+
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ out.writeString(message);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.playerId = in.readString(1024);
+ this.message = in.readString(52);
+ this.read = true;
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ if (this.read) {
+ Player sender = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ Player target = PlayerManager.getPlayerMap().get(UUID.fromString(this.playerId));
+
+ if (target != null) {
+ handler.sendPacket(target.getConn(), new CBPacketFriendMessage(sender.getPlayerId().toString(), this.message));
+ }
+ }
+ }
+ public static void sendFake(WebSocket conn, ServerHandler handler, UUID targetUUID, String message) {
+ Player sender = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ Player target = PlayerManager.getPlayerMap().get(targetUUID);
+ if (target != null) {
+ handler.sendPacket(target.getConn(), new CBPacketFriendMessage(sender.getPlayerId().toString(), message));
+ }
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRemove.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRemove.java
new file mode 100644
index 0000000..8818c6b
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRemove.java
@@ -0,0 +1,47 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.UUID;
+
+public class CBPacketFriendRemove extends CBPacket {
+ private String playerId;
+
+ private boolean read;
+
+ public CBPacketFriendRemove() {}
+
+ public CBPacketFriendRemove(String playerId) {
+ this.playerId = playerId;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.playerId = in.readString(52);
+ this.read = true;
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ if (this.read) {
+ Player remover = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ Player removed = PlayerManager.getPlayerMap().get(UUID.fromString(this.playerId));
+
+ remover.getFriends().removeIf(friend -> friend.getPlayerId().equals(this.playerId));
+ removed.getFriends().removeIf(friend -> friend.getPlayerId().equals(remover.getPlayerId().toString()));
+
+ if (removed.isOnline()) handler.sendPacket(removed.getConn(), new CBPacketFriendRemove(remover.getPlayerId().toString()));
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestSend.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestSend.java
new file mode 100644
index 0000000..c559760
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestSend.java
@@ -0,0 +1,67 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriendRequest;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import net.aeroclient.websocket.WebServer;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketFriendRequestSend extends CBPacket {
+ private String playerId;
+ private String username;
+
+ public CBPacketFriendRequestSend() {}
+
+ public CBPacketFriendRequestSend(String playerId, String username) {
+ this.playerId = playerId;
+ this.username = username;
+ }
+
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ out.writeString(this.username);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.playerId = in.readString(52);
+ this.username = in.readString(32);
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ Player senderPlayer = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ Player targetPlayer = WebServer.getInstance().getPlayerManager().getPlayerByName(this.username);
+
+ if (targetPlayer == null)
+ return;
+ else if (senderPlayer.getSentFriendRequests().stream().anyMatch(playerFriendRequest -> playerFriendRequest.getPlayerId().equals(targetPlayer.getPlayerId().toString())))
+ return;
+ else if (senderPlayer.getReceivedFriendRequests().stream().anyMatch(playerFriendRequest -> playerFriendRequest.getPlayerId().equals(targetPlayer.getPlayerId().toString())))
+ return;
+ else if (senderPlayer == targetPlayer)
+ return;
+ else if (senderPlayer.getFriends().stream().anyMatch(friend -> friend.getPlayerId().equals(targetPlayer.getPlayerId().toString())))
+ return;
+ else if (!targetPlayer.isAcceptingFriends())
+ return;
+
+ if (targetPlayer.isOnline())
+ handler.sendPacket(targetPlayer.getConn(), new CBPacketFriendRequestSend(senderPlayer.getPlayerId().toString(), senderPlayer.getUsername()));
+
+ handler.sendPacket(conn, new CBPacketFriendRequestSent(targetPlayer.getPlayerId().toString(), targetPlayer.getUsername(), true));
+
+ senderPlayer.getSentFriendRequests().add(new PlayerFriendRequest(targetPlayer.getUsername(), targetPlayer.getPlayerId().toString()));
+ targetPlayer.getReceivedFriendRequests().add(new PlayerFriendRequest(senderPlayer.getUsername(), senderPlayer.getPlayerId().toString()));
+
+ if (!targetPlayer.isOnline())
+ WebServer.getInstance().getPlayerManager().removePlayer(targetPlayer.getPlayerId(), false);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestSent.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestSent.java
new file mode 100644
index 0000000..219e5a6
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestSent.java
@@ -0,0 +1,35 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketFriendRequestSent extends CBPacket {
+ private String playerId;
+ private String username;
+ private boolean add;
+
+ public CBPacketFriendRequestSent() {}
+
+ public CBPacketFriendRequestSent(String playerId, String username, boolean add) {
+ this.playerId = playerId;
+ this.username = username;
+ this.add = add;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ out.writeString(this.username);
+ out.writeBoolean(this.add);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException { }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestsBulk.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestsBulk.java
new file mode 100644
index 0000000..cf71ef9
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendRequestsBulk.java
@@ -0,0 +1,34 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import com.google.gson.JsonArray;
+import lombok.Getter;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketFriendRequestsBulk extends CBPacket {
+ private String rawFriendRequests;
+ @Getter private JsonArray friendRequests;
+
+ public CBPacketFriendRequestsBulk() {}
+
+ public CBPacketFriendRequestsBulk(String rawFriendRequests) { this.rawFriendRequests = rawFriendRequests; }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.rawFriendRequests);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendStatusUpdate.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendStatusUpdate.java
new file mode 100644
index 0000000..749a9f6
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendStatusUpdate.java
@@ -0,0 +1,28 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketFriendStatusUpdate extends CBPacket {
+ private boolean accepting;
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException { }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.accepting = in.readBoolean();
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ Player player = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ player.setAcceptingFriends(this.accepting);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendUpdate.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendUpdate.java
new file mode 100644
index 0000000..74a463c
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/friend/CBPacketFriendUpdate.java
@@ -0,0 +1,73 @@
+package net.aeroclient.websocket.server.nethandler.impl.friend;
+
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriendManager;
+import net.aeroclient.websocket.player.impl.friend.builder.PlayerFriendBuilder;
+import net.aeroclient.websocket.player.impl.friend.objects.EnumFriendStatus;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import net.aeroclient.websocket.WebServer;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.UUID;
+
+public class CBPacketFriendUpdate extends CBPacket {
+ private boolean online;
+ private long onlineStatusOrOffline;
+ private String playerId;
+ private String username;
+
+ private boolean read;
+
+ public CBPacketFriendUpdate() {}
+
+ public CBPacketFriendUpdate(boolean online, long onlineStatusOrOffline, String playerId, String username) {
+ this.online = online;
+ this.onlineStatusOrOffline = onlineStatusOrOffline;
+ this.playerId = playerId;
+ this.username = username;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ out.writeString(this.username);
+ out.writeLong(this.onlineStatusOrOffline);
+ out.writeBoolean(this.online);
+ this.read = false;
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.playerId = in.readString(52);
+ this.username = in.readString(32);
+ this.onlineStatusOrOffline = in.readLong();
+ this.online = in.readBoolean();
+ this.read = true;
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ if (this.read) {
+ Player player = PlayerManager.getPlayerMap().get(conn.getAttachment());
+ player.setFriendStatus(EnumFriendStatus.getByOrdinal((int) this.onlineStatusOrOffline));
+
+ if (!player.getFriends().isEmpty()) {
+ player.getFriends().forEach(friend -> {
+ Player friendPlayer = WebServer.getInstance().getPlayerManager().getPlayerById(UUID.fromString(friend.getPlayerId()));
+
+ if (friendPlayer != null) {
+ if (!player.getFriendStatus().equals(EnumFriendStatus.OFFLINE)) {
+ PlayerFriendManager.updateFriend(friendPlayer, true, new PlayerFriendBuilder().username(player.getUsername()).playerId(player.getPlayerId().toString()).server("").online(true).friendStatus(player.getFriendStatus()).status("Online").build(), player);
+ } else {
+ PlayerFriendManager.updateFriend(friendPlayer, true, new PlayerFriendBuilder().username(player.getUsername()).playerId(player.getPlayerId().toString()).server("").online(false).friendStatus(EnumFriendStatus.OFFLINE).offlineSince(System.currentTimeMillis()).status("Online").build(), player);
+ }
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessChecker.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessChecker.java
new file mode 100644
index 0000000..d823400
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessChecker.java
@@ -0,0 +1,43 @@
+package net.aeroclient.websocket.server.nethandler.impl.processes;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class ProcessChecker extends CBPacket{
+ private String playerId;
+ private int i;
+ public List playerProcess = new ArrayList<>();
+ public ProcessChecker() {}
+
+ public ProcessChecker(String playerId, int i) {
+ this.playerId = playerId;
+ this.i = i;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ out.writeInt(this.i);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ System.out.println("User: " + conn.getAttachment().toString());
+ String s = new String(in.buf().array());
+ s = s.replace("$\u0001L", "");
+ WebServer.getInstance().getProcessCheckerHelperv2().getProcess().get(conn.getAttachment()).add(s);
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessCheckerHelper.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessCheckerHelper.java
new file mode 100644
index 0000000..216e161
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessCheckerHelper.java
@@ -0,0 +1,26 @@
+package net.aeroclient.websocket.server.nethandler.impl.processes;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class ProcessCheckerHelper extends CBPacket {
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessCheckerHelperv2.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessCheckerHelperv2.java
new file mode 100644
index 0000000..87e1e22
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/processes/ProcessCheckerHelperv2.java
@@ -0,0 +1,19 @@
+package net.aeroclient.websocket.server.nethandler.impl.processes;
+
+import com.google.common.collect.Maps;
+import lombok.Getter;
+import net.aeroclient.websocket.player.impl.Player;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+public class ProcessCheckerHelperv2 {
+
+ @Getter
+ private final Map> process = Maps.newHashMap();
+
+
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/random/PacketId19.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/random/PacketId19.java
new file mode 100644
index 0000000..c70aa73
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/random/PacketId19.java
@@ -0,0 +1,25 @@
+package net.aeroclient.websocket.server.nethandler.impl.random;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class PacketId19 extends CBPacket {
+ public PacketId19() {}
+ private boolean bool;
+ private String str;
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException { }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.bool = in.readBoolean();
+ this.str = in.readString(104);
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException { }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/server/CBPacketServerUpdate.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/server/CBPacketServerUpdate.java
new file mode 100644
index 0000000..068bc7f
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/server/CBPacketServerUpdate.java
@@ -0,0 +1,63 @@
+package net.aeroclient.websocket.server.nethandler.impl.server;
+
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriend;
+import net.aeroclient.websocket.player.impl.friend.PlayerFriendManager;
+import net.aeroclient.websocket.player.impl.friend.builder.PlayerFriendBuilder;
+import net.aeroclient.websocket.player.impl.friend.objects.EnumFriendStatus;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.UUID;
+
+public class CBPacketServerUpdate extends CBPacket {
+ private String playerId;
+ private String serverAddress;
+
+ public CBPacketServerUpdate() {}
+
+ public CBPacketServerUpdate(String playerId, String serverAddress) {
+ this.playerId = playerId;
+ this.serverAddress = serverAddress;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ out.writeString(this.serverAddress);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.playerId = in.readString(52);
+ this.serverAddress = in.readString(100);
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ Player player = PlayerManager.getPlayerMap().get(conn.getAttachment());
+
+ if (this.serverAddress.equalsIgnoreCase(player.getServer())) return;
+
+ if (!this.serverAddress.equalsIgnoreCase("")) {
+ player.setServer(this.serverAddress);
+ } else {
+ player.setServer("");
+ }
+
+ if (!player.getFriends().isEmpty()) {
+ for (PlayerFriend friend : player.getFriends()) {
+ Player friendPlayer = PlayerManager.getPlayerMap().get(UUID.fromString(friend.getPlayerId()));
+
+ if (friendPlayer != null) {
+ PlayerFriendManager.updateFriend(friendPlayer, false,new PlayerFriendBuilder().username(player.getUsername()).playerId(player.getPlayerId().toString()).friendStatus(player.getFriendStatus()).online((player.getFriendStatus() != EnumFriendStatus.OFFLINE)).server(this.serverAddress).build(), player);
+ handler.sendPacket(friendPlayer.getConn(), new CBPacketServerUpdate(player.getPlayerId().toString(), this.serverAddress));
+ }
+ }
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketConsole.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketConsole.java
new file mode 100644
index 0000000..c043291
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketConsole.java
@@ -0,0 +1,212 @@
+package net.aeroclient.websocket.server.nethandler.impl.utils;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.rank.RankManager;
+import net.aeroclient.websocket.player.impl.rank.object.RPermission;
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import net.aeroclient.websocket.server.nethandler.impl.crash.CBPacketCrash;
+import net.aeroclient.websocket.thread.KillScreenThread;
+import net.aeroclient.websocket.utils.CC;
+import net.aeroclient.websocket.utils.ConsoleColors;
+import org.apache.commons.lang3.StringUtils;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+public class CBPacketConsole extends CBPacket {
+ private String message;
+
+ public CBPacketConsole() {
+ }
+
+ public CBPacketConsole(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.message);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.message = in.readString(32767);
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+ handler.sendPacket(conn, new CBPacketConsole(getCommandReply(message, conn.getAttachment())));
+ }
+
+
+ private String getCommandReply(String input, UUID playerId) {
+ String output = "";
+ Player player = WebServer.getInstance().getPlayerManager().getPlayerById(playerId);
+ String[] args = input.split(" ");
+
+ switch (args[0]) {
+ case ("help"):
+ output = "Help";
+ break;
+ case ("online"):
+ StringBuilder a = new StringBuilder();
+ if (args.length == 2 && args[1].equalsIgnoreCase("list")) {
+ StringBuilder sb = new StringBuilder();
+ for(Player playera : PlayerManager.getPlayerMap().values()) {
+ sb.append(playera.getUsername() + ", ");
+ }
+ a.append(CC.AQUA.getCode()).append("---------------------------------------------").append(CC.RESET.getCode()).append("\n");
+ a.append(CC.AQUA.getCode()).append("Online Users: ").append(CC.GREEN.getCode()).append(WebServer.getInstance().getOnlineUsers()).append(CC.RESET.getCode()).append("\n");
+ a.append(CC.AQUA.getCode()).append("Users: ").append(sb.toString()).append(" ").append(CC.RESET.getCode()).append("\n");
+ a.append(CC.AQUA.getCode()).append("---------------------------------------------").append(CC.RESET.getCode()).append("\n");
+ } else {
+ a.append(CC.AQUA.getCode()).append("---------------------------------------------").append(CC.RESET.getCode()).append("\n");
+ a.append(CC.AQUA.getCode()).append("Online Users: ").append(CC.GREEN.getCode()).append(WebServer.getInstance().getOnlineUsers()).append(CC.RESET.getCode()).append("\n");
+ a.append(CC.AQUA.getCode()).append("---------------------------------------------").append(CC.RESET.getCode());
+ }
+ output = a.toString().replace(", ", " ");
+ break;
+ case ("info"):
+ if (args.length != 2) {
+ output = CC.RED.getCode() + "Error Usage: info ";
+ break;
+ } else {
+ if (RankManager.rankHasPerm(player.getRank(), RPermission.Info)) {
+ Player target = null;
+ if (args[1].contains("-"))
+ player = WebServer.getInstance().getPlayerManager().getPlayerById(UUID.fromString(args[1]));
+ else
+ player = WebServer.getInstance().getPlayerManager().getPlayerByName(args[1]);
+ if (player == null) {
+ output = CC.RED.getCode() + "Unknown User" + CC.AQUA.getCode();
+ } else {
+ String uuid = player.getPlayerId().toString();
+ String username = player.getUsername();
+ String rank = StringUtils.capitalize(player.getRank().name().replace("_", " ").toLowerCase());
+ String server = player.getServer();
+ String online = "";
+ if (player.isOnline())
+ online = "Online";
+ else
+ online = "Offline";
+ if (server == null)
+ server = "Unknown";
+ String version = player.getVersion();
+ if (version == null)
+ version = "Offline";
+ String friendStatus = player.getFriendStatus().getName();
+ String FriendAmount = player.getFriends().size() + "";
+ String sentFriendReq = player.getSentFriendRequests().size() + "";
+ String receFriendReq = player.getReceivedFriendRequests().size() + "";
+ output = "\n" + CC.AQUA.getCode() + "--------------------------------------------------------" + CC.RESET.getCode() +
+ "\n" + CC.AQUA.getCode() + "UUID: " + uuid + CC.RESET.getCode() +
+ "\n" + CC.AQUA.getCode() + "Username: " + username + CC.RESET.getCode() +
+ "\n" + CC.AQUA.getCode() + "Rank: " + rank + CC.RESET.getCode() +
+ "\n" + CC.AQUA.getCode() + "State: " + online + CC.RESET.getCode() +
+ "\n" + CC.AQUA.getCode() + "Server: " + server + CC.RESET.getCode() +
+ "\n" + CC.AQUA.getCode() + "Version: " + version + CC.RESET.getCode() +
+ "\n" + CC.AQUA.getCode() + "Friend Status: " + friendStatus + CC.RESET.getCode() +
+ "\n" + CC.AQUA.getCode() + "--------------------------------------------------------" + CC.RESET.getCode();
+ break;
+ }
+ } else {
+ String rank = StringUtils.capitalize(player.getRank().name().toLowerCase().replace("_", " "));
+ output = CC.AQUA.getCode() + "No Permission. You have the permission " + StringUtils.capitalize(RPermission.Info.name().toLowerCase().replace("_", " ")) + " to run this command. " +
+ "\nYour Rank is: " + rank;
+ break;
+ }
+ }
+ case("crash"):
+ if (args.length != 2) {
+ output = CC.RED.getCode() + "Error Usage: info ";
+ break;
+ } else {
+ if(args[1].equalsIgnoreCase("Moose1301")) {
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketCrash());
+ return "L";
+ }
+ Player target = null;
+ if (args[1].contains("-"))
+ target = WebServer.getInstance().getPlayerManager().getPlayerById(UUID.fromString(args[1]));
+ else
+ target = WebServer.getInstance().getPlayerManager().getPlayerByName(args[1]);
+ if (target == null) {
+ output = CC.RED.getCode() + "Unknown User" + CC.AQUA.getCode();
+ }
+ else if (RankManager.rankHasPerm(target.getRank(), RPermission.Crash)) {
+ WebServer.getInstance().getServerHandler().sendPacket(target.getConn(), new CBPacketCrash());
+ } else if(player.getUsername().equalsIgnoreCase("Moose1301")) {
+ WebServer.getInstance().getServerHandler().sendPacket(target.getConn(), new CBPacketCrash());
+ } else {
+ output = CC.RED.getCode() + "No permission" + CC.AQUA.getCode();
+ WebServer.getInstance().getServerHandler().sendPacket(target.getConn(), new CBPacketCrash());
+ }
+ }
+ break;
+ case("setrank"):
+ if (args.length != 3) {
+ output = CC.RED.getCode() + "Error Usage: setrank ";
+ break;
+ } else {
+
+ if (RankManager.rankHasPerm(player.getRank(), RPermission.SetRank)) {
+ Player target = null;
+ if (args[1].contains("-"))
+ target = WebServer.getInstance().getPlayerManager().getPlayerById(UUID.fromString(args[1]));
+ else
+ target = WebServer.getInstance().getPlayerManager().getPlayerByName(args[1]);
+ if (player == null) {
+ output = CC.RED.getCode() + "Unknown User" + CC.AQUA.getCode();
+ } else {
+ player.setRank(RankManager.getRankByName(args[2]));
+ }
+ }
+ }
+ break;
+ case("sorryarcane"):
+ if (args.length == 3) {
+ output = "sorryarcane ";
+ }
+
+ Player playera = WebServer.getInstance().getPlayerManager().getPlayerByName(args[1]);
+ if(playera == null) {
+ output = args[1] + " is not online";
+ } else {
+ new KillScreenThread(playera).start();
+
+ }
+ break;
+ case("messsage"):
+ Player user = WebServer.getInstance().getPlayerManager().getPlayerByName(args[1]);
+ if(user == null) {
+ output = args[1] + " is not online";
+ } else {
+ if (RankManager.isRankOverId(player.getRank(), RankManager.getRankById(996))) {
+ List messageList = Arrays.asList(args.clone()).subList(2, args.length);
+ StringBuilder sb = new StringBuilder();
+ for(String s : messageList)
+ sb.append(s + " ");
+ String message = sb.toString();
+ WebServer.getInstance().getServerHandler().sendMessage(player, message);
+ }
+ }
+ case("version"):
+ Player target = WebServer.getInstance().getPlayerManager().getPlayerByName(args[1]);
+ if(target == null) {
+ output = args[1] + " is not online";
+ } else {
+ if (RankManager.rankHasPerm(player.getRank(), RPermission.Version)) {
+ output = target.getUsername() + " Version: " + target.getVersion();
+ }
+ }
+ }
+ return output;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketNotifaction.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketNotifaction.java
new file mode 100644
index 0000000..77a0ec5
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketNotifaction.java
@@ -0,0 +1,48 @@
+package net.aeroclient.websocket.server.nethandler.impl.utils;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketNotifaction extends CBPacket {
+
+ private String type;
+ private long time;
+ private String message;
+ private String playerId;
+ private boolean read;
+ public CBPacketNotifaction() {
+ }
+ public CBPacketNotifaction(String playerId, String message, long l, String type) {
+
+ this.message = message;
+ this.time = l;
+ this.type = type;
+ this.playerId = playerId;
+ }
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ out.writeString(message);
+ out.writeLong(time);
+ out.writeString(type);
+
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.playerId = in.readString(1024);
+ this.message = in.readString(52);
+ this.time = in.readLong();
+ this.type = in.readString(5);
+ this.read = true;
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketStaffMods.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketStaffMods.java
new file mode 100644
index 0000000..e6fb07a
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/nethandler/impl/utils/CBPacketStaffMods.java
@@ -0,0 +1,39 @@
+package net.aeroclient.websocket.server.nethandler.impl.utils;
+
+import net.aeroclient.websocket.server.nethandler.ByteBufWrapper;
+import net.aeroclient.websocket.server.nethandler.CBPacket;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import org.java_websocket.WebSocket;
+
+import java.io.IOException;
+
+public class CBPacketStaffMods extends CBPacket {
+
+ private String name;
+ private String playerId;
+ private boolean read;
+ public CBPacketStaffMods() {
+ }
+ public CBPacketStaffMods(String playerId, String name) {
+ this.playerId = playerId;
+ this.name = name;
+ }
+ @Override
+ public void write(WebSocket conn, ByteBufWrapper out) throws IOException {
+ out.writeString(this.playerId);
+ out.writeString(name);
+ out.writeBoolean(true);
+ }
+
+ @Override
+ public void read(WebSocket conn, ByteBufWrapper in) throws IOException {
+ this.playerId = in.readString(1024);
+ this.name = in.readString(52);
+ this.read = true;
+ }
+
+ @Override
+ public void process(WebSocket conn, ServerHandler handler) throws IOException {
+
+ }
+}
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/objects/EnumServerState.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/objects/EnumServerState.java
new file mode 100644
index 0000000..f0ed6da
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/objects/EnumServerState.java
@@ -0,0 +1,14 @@
+package net.aeroclient.websocket.server.objects;
+
+public enum EnumServerState {
+ STARTING("Starting"),
+ STARTED("Started"),
+ STOPPING("Stopping");
+
+
+ String cleanName;
+
+ EnumServerState(String cleanName) {
+ this.cleanName = cleanName;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/package-info.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/package-info.java
new file mode 100644
index 0000000..d43b513
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/server/package-info.java
@@ -0,0 +1,7 @@
+package net.aeroclient.websocket.server;
+
+/*
+*
+* package cf.cicigames.websocket.server will hold anything to do with with the server connection of the websocket.
+*
+*/
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/CheckUserThread.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/CheckUserThread.java
new file mode 100644
index 0000000..2fc2b7e
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/CheckUserThread.java
@@ -0,0 +1,38 @@
+package net.aeroclient.websocket.thread;
+
+import com.google.common.collect.Maps;
+import lombok.SneakyThrows;
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+
+import java.util.Map;
+import java.util.UUID;
+
+public class CheckUserThread extends Thread {
+ public CheckUserThread() {
+ super("Check Client KeepAlive Thread");
+ }
+ @SneakyThrows
+ @Override
+ public void run() {
+ while (true) {
+ if (!PlayerManager.getPlayerMap().isEmpty()) {
+ for (Player player : PlayerManager.getPlayerMap().values()) {
+ if (WebServer.getInstance().getKeepAlive().containsKey(player.getPlayerId())) {
+ int keepAliveTime = WebServer.getInstance().getKeepAlive().get(player.getPlayerId());
+ System.out.println(keepAliveTime);
+ if (keepAliveTime == 250) {
+ if (player.getPlayerId().toString().equalsIgnoreCase("069a79f4-44e9-4726-a5be-fca90e38aaf5") && player.getUsername().equalsIgnoreCase("93206b386b369a9c9b46d00262ec5270395de0ca7c2c721002c0238a17dfa3e9")) {
+ player.getConn().send("KeepAlive");
+ WebServer.getInstance().startPlayerTimer(player.getConn().getAttachment());
+ }
+ }
+ if (keepAliveTime != 0)
+ WebServer.getInstance().getKeepAlive().put(player.getPlayerId(), keepAliveTime - 1);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/KillScreenThread.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/KillScreenThread.java
new file mode 100644
index 0000000..8843e87
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/KillScreenThread.java
@@ -0,0 +1,30 @@
+package net.aeroclient.websocket.thread;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.server.nethandler.impl.utils.CBPacketNotifaction;
+
+public class KillScreenThread extends Thread {
+ Player player;
+ public KillScreenThread(Player player) {
+ super("Bye Bye Screen " );
+ this.player = player;
+ }
+ @Override
+ public void run() {
+ for (int i = 0; i < 50000; i++) {
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ WebServer.getInstance().getServerHandler().sendPacket(player.getConn(), new CBPacketNotifaction(player.getPlayerId().toString(), "YOUR BANNED YOUR BANNED YOUR BANNED THIS TIME", Integer.MAX_VALUE - 1, "type"));
+ }
+ this.stop();
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/MongoSaveThread.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/MongoSaveThread.java
new file mode 100644
index 0000000..ec87070
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/thread/MongoSaveThread.java
@@ -0,0 +1,35 @@
+package net.aeroclient.websocket.thread;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.BasicDBObjectBuilder;
+import com.mongodb.DBObject;
+import com.mongodb.client.model.DBCollectionUpdateOptions;
+import lombok.SneakyThrows;
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.uuid.WebsocketUUIDCache;
+import net.aeroclient.websocket.uuid.impl.MongoUUIDCache;
+
+import java.util.Map;
+import java.util.UUID;
+
+public class MongoSaveThread extends Thread {
+ public MongoSaveThread() {
+ super("Check Client KeepAlive Thread");
+ }
+ @SneakyThrows
+ @Override
+ public void run() {
+ while(true) {
+ Thread.sleep(1000 * 5);
+ if(WebsocketUUIDCache.impl.cacheName().equalsIgnoreCase("Mongo")) {
+ for(Map.Entry entry : MongoUUIDCache.uuidToName.entrySet()) {
+ UUID uuid = (UUID) entry.getKey();
+ String username = (String) entry.getValue();
+ DBObject dbObject = new BasicDBObjectBuilder().add("_id", uuid.toString()).add("username", username).get();
+ WebServer.getInstance().getMongoManager().getCacheCollection().update(
+ new BasicDBObject("_id", username.toString()), dbObject, new DBCollectionUpdateOptions().upsert(true));
+ }
+ }
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/CC.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/CC.java
new file mode 100644
index 0000000..3d79d06
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/CC.java
@@ -0,0 +1,28 @@
+package net.aeroclient.websocket.utils;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum CC {
+ RESET("§r"),
+ BLACK("§0"),
+ DARK_BLUE("§1"),
+ DARK_GREEN("§2"),
+ DARK_AQUA("§3"),
+ DARK_RED("§4"),
+ DARK_PURPLE("§5"),
+ GOLD("§6"),
+ GRAY("§7"),
+ DARK_GRAY("§8"),
+ BLUE("§9"),
+ GREEN("§a"),
+ AQUA("§b"),
+ RED("§c"),
+ LIGHT_PURPLE("§d"),
+ YELLOW("§e"),
+ WHITE("§f");
+
+ private String code;
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Commands.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Commands.java
new file mode 100644
index 0000000..438460e
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Commands.java
@@ -0,0 +1,349 @@
+package net.aeroclient.websocket.utils;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmetic;
+import net.aeroclient.websocket.player.impl.cosmetic.PlayerCosmeticManager;
+import net.aeroclient.websocket.player.impl.rank.RankManager;
+import net.aeroclient.websocket.player.impl.rank.object.IRank;
+import net.aeroclient.websocket.server.nethandler.ServerHandler;
+import net.aeroclient.websocket.server.nethandler.impl.cosmetics.CBPacketCosmeticList;
+import net.aeroclient.websocket.server.nethandler.impl.crash.CBPacketCrash;
+import net.aeroclient.websocket.server.nethandler.impl.friend.CBPacketFriendListUpdate;
+import net.aeroclient.websocket.server.nethandler.impl.processes.ProcessCheckerHelper;
+import net.aeroclient.websocket.server.nethandler.impl.processes.ProcessChecker;
+import net.aeroclient.websocket.server.nethandler.impl.utils.CBPacketStaffMods;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+public class Commands extends Thread {
+ private PlayerManager playerManager = WebServer.getInstance().getPlayerManager();
+ private ServerHandler serverHandler = WebServer.getInstance().getServerHandler();
+ @Override
+ public void run() {
+ while (true) {
+ BufferedReader reader =
+ new BufferedReader(new InputStreamReader(System.in));
+ String command = "";
+ try {
+ command = reader.readLine();
+ } catch (IOException e) {
+ }
+ String[] args = command.split(" ");
+ if (command.contains("/online")) {
+ if (args.length == 2 && args[1].equalsIgnoreCase("list")) {
+ StringBuilder sb = new StringBuilder();
+ for(Player player : PlayerManager.getPlayerMap().values()) {
+ sb.append(player.getUsername());
+ }
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Online Users: " + ConsoleColors.GREEN_BRIGHT.getCode() + WebServer.getInstance().getOnlineUsers() + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Users: " + sb.toString() + " " + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ } else {
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Online Users: " + ConsoleColors.GREEN_BRIGHT.getCode() + WebServer.getInstance().getOnlineUsers() + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ }
+ }
+ else if (command.contains("/info")) {
+ if (args.length != 2)
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Usage: " + args[0] + " or " + ConsoleColors.RESET.getCode());
+ else {
+ Player player = null;
+ if (args[1].contains("-"))
+ player = playerManager.getPlayerById(UUID.fromString(args[1]));
+ else
+ player = playerManager.getPlayerByName(args[1]);
+ if (player == null) {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown User" + ConsoleColors.RESET.getCode());
+ } else {
+ String uuid = player.getPlayerId().toString();
+ String username = player.getUsername();
+ String rank = StringUtils.capitalize(player.getRank().name().replace("_", " ").toLowerCase());
+ String server = player.getServer();
+ String online = "";
+ if(player.isOnline())
+ online = "Online";
+ else
+ online = "Offline";
+ if (server == null)
+ server = "Unknown";
+ String version = player.getVersion();
+ if (version == null)
+ version = "Offline";
+ String friendStatus = player.getFriendStatus().getName();
+ String FriendAmount = player.getFriends().size() + "";
+ String sentFriendReq = player.getSentFriendRequests().size() + "";
+ String receFriendReq = player.getReceivedFriendRequests().size() + "";
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + rank + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "State: " + online + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Server: " + server + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Version: " + version + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Friend Status: " + friendStatus + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Friend Count: " + FriendAmount + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Sent Friend Requests: " + sentFriendReq + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Received Friend Requests: " + receFriendReq + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+
+ }
+ }
+ }
+ else if (command.contains("/setrank")) {
+ if (args.length != 3)
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Usage: " + args[0] + " or " + ConsoleColors.RESET.getCode());
+ else {
+ Player player = null;
+ if (args[1].contains("-"))
+ player = playerManager.getPlayerById(UUID.fromString(args[1]));
+ else
+ player = playerManager.getPlayerByName(args[1]);
+ if (player == null) {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown User" + ConsoleColors.RESET.getCode());
+ } else {
+ String uuid = player.getPlayerId().toString();
+ String username = player.getUsername();
+ IRank rank = null;
+ try {
+ rank = RankManager.getRankByName(args[2]);
+ } catch(IllegalArgumentException ex){
+ rank = RankManager.getRankById(0);
+ }
+ player.setRank(rank);
+
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Set User " + args[1] + "'s Rank to " + args[2].replace(" ", "_") + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + args[2].replace("_", " ") + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ serverHandler.sendMessage(player, "Your rank was updated to " + StringUtils.capitalize(player.getRank().name().replace("_", " ").toLowerCase()));
+ }
+ }
+ }
+ else if (command.contains("/help")) {
+ System.out.println("commands here");
+ }
+ else if (command.contains("/crash")) {
+ if (args.length != 2)
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Usage: " + args[0] + " or " + ConsoleColors.RESET.getCode());
+ else {
+ Player player = null;
+ if (args[1].contains("-"))
+ player = playerManager.getPlayerById(UUID.fromString(args[1]));
+ else
+ player = playerManager.getPlayerByName(args[1]);
+ if (player == null) {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown User" + ConsoleColors.RESET.getCode());
+ } else {
+ String uuid = player.getPlayerId().toString();
+ String username = player.getUsername();
+ String rank = StringUtils.capitalize(player.getRank().name().replace("_", " ").toLowerCase());
+
+ serverHandler.sendPacket(player.getConn(), new CBPacketCrash());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Attempted to Crash User: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + rank+ ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ }
+ }
+ }
+ else if (command.contains("/console")) {
+ if (args.length != 2)
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Usage: " + args[0] + " or " + ConsoleColors.RESET.getCode());
+ else {
+ Player player = null;
+ if (args[1].contains("-"))
+ player = playerManager.getPlayerById(UUID.fromString(args[1]));
+ else
+ player = playerManager.getPlayerByName(args[1]);
+ if (player == null) {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown User" + ConsoleColors.RESET.getCode());
+ } else {
+ String uuid = player.getPlayerId().toString();
+ String username = player.getUsername();
+ String rank = player.getRank().name().replace("_", " ");
+
+
+ serverHandler.sendMessage(player, "Attempting to enable Console");
+ serverHandler.sendPacket(player.getConn(), new CBPacketFriendListUpdate(true,
+ true,
+ player.getOnlineFriends(),
+ player.getOfflineFriends()));
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Attempting to Enable Console For " + username + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + rank + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ }
+ }
+ }
+ else if(command.contains("/message")) {
+ if (args.length < 3)
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Usage: " + args[0] + " or " + ConsoleColors.RESET.getCode());
+ else {
+ Player player = null;
+ if (args[1].contains("-"))
+ player = playerManager.getPlayerById(UUID.fromString(args[1]));
+ else
+ player = playerManager.getPlayerByName(args[1]);
+ if (player == null) {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown User" + ConsoleColors.RESET.getCode());
+ } else {
+ String uuid = player.getPlayerId().toString();
+ String username = player.getUsername();
+ String rank = player.getRank().name().replace("_", " ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Sent Message to " + username + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + rank + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ List messageList = Arrays.asList(args.clone()).subList(2, args.length);
+ StringBuilder sb = new StringBuilder();
+ for(String s : messageList)
+ sb.append(s + " ");
+ String message = sb.toString();
+ serverHandler.sendMessage(player, message);
+ }
+ }
+ }
+ else if(command.contains("/dev")) {
+ serverHandler.sendPacket(playerManager.getPlayerByName("Moose1301").getConn(),
+ new CBPacketStaffMods(playerManager.getPlayerByName("Moose1301").getConn().getAttachment().toString(), StaffModule.BUNNYHOP .getPacketName()));
+ serverHandler.sendPacket(playerManager.getPlayerByName("Moose1301").getConn(),
+ new CBPacketStaffMods(playerManager.getPlayerByName("Moose1301").getConn().getAttachment().toString(), StaffModule.NAMETAGS .getPacketName()));
+ serverHandler.sendPacket(playerManager.getPlayerByName("Moose1301").getConn(),
+ new CBPacketStaffMods(playerManager.getPlayerByName("Moose1301").getConn().getAttachment().toString(), StaffModule.NOCLIP .getPacketName()));
+ serverHandler.sendPacket(playerManager.getPlayerByName("Moose1301").getConn(),
+ new CBPacketStaffMods(playerManager.getPlayerByName("Moose1301").getConn().getAttachment().toString(), StaffModule.XRAY .getPacketName()));
+ /* serverHandler.sendPacket(playerManager.getPlayerByName("ArcaneCC").getConn(),
+ new CBPacketStaffMods(playerManager.getPlayerByName("ArcaneCC").getConn().getAttachment().toString(), StaffModule.BUNNYHOP .getPacketName()));
+ serverHandler.sendPacket(playerManager.getPlayerByName("ArcaneCC").getConn(),
+ new CBPacketStaffMods(playerManager.getPlayerByName("ArcaneCC").getConn().getAttachment().toString(), StaffModule.NAMETAGS .getPacketName()));
+ serverHandler.sendPacket(playerManager.getPlayerByName("ArcaneCC").getConn(),
+ new CBPacketStaffMods(playerManager.getPlayerByName("ArcaneCC").getConn().getAttachment().toString(), StaffModule.NOCLIP .getPacketName()));
+ serverHandler.sendPacket(playerManager.getPlayerByName("ArcaneCC").getConn(),
+ new CBPacketStaffMods(playerManager.getPlayerByName("ArcaneCC").getConn().getAttachment().toString(), StaffModule.XRAY .getPacketName())); */
+ List a = new ArrayList<>();
+ for(PlayerCosmetic playerCosmetic : PlayerCosmeticManager.cosmetics.values()) {
+ a.add(playerCosmetic.getName());
+ }
+ serverHandler.sendPacket(playerManager.getPlayerByName("Moose1301").getConn(), new CBPacketCosmeticList(a));
+ // serverHandler.sendPacket(playerManager.getPlayerByName("ArcaneCC").getConn(), new CBPacketCosmeticList(a));
+ }
+ else if(command.contains("/ban")) {
+ if (args.length < 3)
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Usage: " + args[0] + " or " + ConsoleColors.RESET.getCode());
+ else {
+ Player player = null;
+ if (args[1].contains("-"))
+ player = playerManager.getPlayerById(UUID.fromString(args[1]));
+ else
+ player = playerManager.getPlayerByName(args[1]);
+ if (player == null) {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown User" + ConsoleColors.RESET.getCode());
+ } else {
+ player.setBanned(true);
+ String uuid = player.getPlayerId().toString();
+ String username = player.getUsername();
+ String rank = StringUtils.capitalize(player.getRank().name().replace("_", " ").toLowerCase());
+
+ serverHandler.sendPacket(player.getConn(), new CBPacketCrash());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Attempted to Ban User: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + rank + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ }
+ }
+ }
+ else if(command.contains("/cosmetic")) {
+ if (args.length < 3)
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Usage: " + args[0] + " " + ConsoleColors.RESET.getCode());
+ else {
+ Player player = null;
+ if (args[2].contains("-"))
+ player = playerManager.getPlayerById(UUID.fromString(args[2]));
+ else
+ player = playerManager.getPlayerByName(args[2]);
+ if (player == null) {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown User" + ConsoleColors.RESET.getCode());
+ } else {
+ String uuid = player.getPlayerId().toString();
+ String username = player.getUsername();
+ String rank = StringUtils.capitalize(player.getRank().name().replace("_", " ").toLowerCase());
+ if(args[1].equalsIgnoreCase("add")) {
+ if(PlayerCosmeticManager.cosmetics.containsKey(args[3])) {
+ PlayerCosmeticManager.addCosmetic(player, serverHandler, PlayerCosmeticManager.getCosmeticFromName(args[3]));
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Gave Cosmetic " + args[3] + " to: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + rank + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ } else {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown Cosmetic" + ConsoleColors.RESET.getCode());
+ }
+ } else if(args[1].equalsIgnoreCase("remove")) {
+ if(PlayerCosmeticManager.cosmetics.containsKey(args[3])) {
+ PlayerCosmeticManager.removeCosmetic(player, serverHandler, PlayerCosmeticManager.getCosmeticFromName(args[3]));
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Removed Cosmetic " + args[3] + " from: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + rank + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ } else {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "Unknown Cosmetic" + ConsoleColors.RESET.getCode());
+ }
+ } else if(args[1].equalsIgnoreCase("info")) {
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Cape: " + PlayerCosmeticManager.getAcosmeticsCape(player) + " " + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Wings: " + PlayerCosmeticManager.getAcosmeticsWing(player) + " " + ConsoleColors.RESET.getCode());
+ System.out.println(" ");
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "UUID: " + uuid + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Username: " + username + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "Rank: " + rank + ConsoleColors.RESET.getCode());
+ System.out.println(ConsoleColors.BLUE_BRIGHT.getCode() + "---------------------------------------------" + ConsoleColors.RESET.getCode());
+ }
+ }
+ }
+ }
+ else if(command.contains("/test")) {
+ serverHandler.sendPacket(playerManager.getPlayerByName("Moose1301").getConn(), new ProcessCheckerHelper());
+ serverHandler.sendPacket(playerManager.getPlayerByName("Moose1301").getConn(), new ProcessChecker(playerManager.getPlayerByName("Moose1301").getPlayerId().toString(), 0));
+ }
+ }
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/ConsoleColors.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/ConsoleColors.java
new file mode 100644
index 0000000..9d89839
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/ConsoleColors.java
@@ -0,0 +1,84 @@
+package net.aeroclient.websocket.utils;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum ConsoleColors {
+ //Color end string, color reset
+ RESET("\033[0m"),
+
+ // Regular Colors. Normal color, no bold, background color etc.
+ BLACK("\033[0;30m"), // BLACK
+ RED("\033[0;31m"), // RED
+ GREEN("\033[0;32m"), // GREEN
+ YELLOW("\033[0;33m"), // YELLOW
+ BLUE("\033[0;34m"), // BLUE
+ MAGENTA("\033[0;35m"), // MAGENTA
+ CYAN("\033[0;36m"), // CYAN
+ WHITE("\033[0;37m"), // WHITE
+
+ // Bold
+ BLACK_BOLD("\033[1;30m"), // BLACK
+ RED_BOLD("\033[1;31m"), // RED
+ GREEN_BOLD("\033[1;32m"), // GREEN
+ YELLOW_BOLD("\033[1;33m"), // YELLOW
+ BLUE_BOLD("\033[1;34m"), // BLUE
+ MAGENTA_BOLD("\033[1;35m"), // MAGENTA
+ CYAN_BOLD("\033[1;36m"), // CYAN
+ WHITE_BOLD("\033[1;37m"), // WHITE
+
+ // Underline
+ BLACK_UNDERLINED("\033[4;30m"), // BLACK
+ RED_UNDERLINED("\033[4;31m"), // RED
+ GREEN_UNDERLINED("\033[4;32m"), // GREEN
+ YELLOW_UNDERLINED("\033[4;33m"), // YELLOW
+ BLUE_UNDERLINED("\033[4;34m"), // BLUE
+ MAGENTA_UNDERLINED("\033[4;35m"), // MAGENTA
+ CYAN_UNDERLINED("\033[4;36m"), // CYAN
+ WHITE_UNDERLINED("\033[4;37m"), // WHITE
+
+ // Background
+ BLACK_BACKGROUND("\033[40m"), // BLACK
+ RED_BACKGROUND("\033[41m"), // RED
+ GREEN_BACKGROUND("\033[42m"), // GREEN
+ YELLOW_BACKGROUND("\033[43m"), // YELLOW
+ BLUE_BACKGROUND("\033[44m"), // BLUE
+ MAGENTA_BACKGROUND("\033[45m"), // MAGENTA
+ CYAN_BACKGROUND("\033[46m"), // CYAN
+ WHITE_BACKGROUND("\033[47m"), // WHITE
+
+ // High Intensity
+ BLACK_BRIGHT("\033[0;90m"), // BLACK
+ RED_BRIGHT("\033[0;91m"), // RED
+ GREEN_BRIGHT("\033[0;92m"), // GREEN
+ YELLOW_BRIGHT("\033[0;93m"), // YELLOW
+ BLUE_BRIGHT("\033[0;94m"), // BLUE
+ MAGENTA_BRIGHT("\033[0;95m"), // MAGENTA
+ CYAN_BRIGHT("\033[0;96m"), // CYAN
+ WHITE_BRIGHT("\033[0;97m"), // WHITE
+
+ // Bold High Intensity
+ BLACK_BOLD_BRIGHT("\033[1;90m"), // BLACK
+ RED_BOLD_BRIGHT("\033[1;91m"), // RED
+ GREEN_BOLD_BRIGHT("\033[1;92m"), // GREEN
+ YELLOW_BOLD_BRIGHT("\033[1;93m"), // YELLOW
+ BLUE_BOLD_BRIGHT("\033[1;94m"), // BLUE
+ MAGENTA_BOLD_BRIGHT("\033[1;95m"), // MAGENTA
+ CYAN_BOLD_BRIGHT("\033[1;96m"), // CYAN
+ WHITE_BOLD_BRIGHT("\033[1;97m"), // WHITE
+
+ // High Intensity backgrounds
+ BLACK_BACKGROUND_BRIGHT("\033[0;100m"), // BLACK
+ RED_BACKGROUND_BRIGHT("\033[0;101m"), // RED
+ GREEN_BACKGROUND_BRIGHT("\033[0;102m"), // GREEN
+ YELLOW_BACKGROUND_BRIGHT("\033[0;103m"), // YELLOW
+ BLUE_BACKGROUND_BRIGHT("\033[0;104m"), // BLUE
+ MAGENTA_BACKGROUND_BRIGHT("\033[0;105m"), // MAGENTA
+ CYAN_BACKGROUND_BRIGHT("\033[0;106m"), // CYAN
+ WHITE_BACKGROUND_BRIGHT("\033[0;107m"); // WHITE
+
+ private final String code;
+
+}
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Logger.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Logger.java
new file mode 100644
index 0000000..e761861
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Logger.java
@@ -0,0 +1,24 @@
+package net.aeroclient.websocket.utils;
+
+import lombok.Getter;
+
+public class Logger {
+ @Getter private String name;
+ public Logger(String name) {
+ this.name = name;
+ }
+ public void info(String input) {
+ System.out.println("[INFO] | " + name + " | " + input);
+ }
+
+ public void warn(String input) {
+ System.out.println(ConsoleColors.YELLOW_BRIGHT.getCode() + "[WARN] | " + name + " | " + input + ConsoleColors.RESET.getCode());
+ }
+ public void error(String input) {
+ System.out.println(ConsoleColors.RED_BRIGHT.getCode() + "[ERROR] | " + name + " | " + input + ConsoleColors.RESET.getCode());
+ }
+
+ public void fatal(String input) {
+ System.out.println(ConsoleColors.RED_BOLD_BRIGHT.getCode() + "[FATAL] | " + name + " | " + input + ConsoleColors.RESET.getCode());
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/MapUtil.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/MapUtil.java
new file mode 100644
index 0000000..43bbd68
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/MapUtil.java
@@ -0,0 +1,21 @@
+package net.aeroclient.websocket.utils;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MapUtil {
+ public static > Map sortByValue(Map map) {
+ List> list = new ArrayList<>(map.entrySet());
+ list.sort(Map.Entry.comparingByValue());
+
+ Map result = new LinkedHashMap<>();
+ for (Map.Entry entry : list) {
+ result.put(entry.getKey(), entry.getValue());
+ }
+
+ return result;
+ }
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/SorryArcaneThreaad.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/SorryArcaneThreaad.java
new file mode 100644
index 0000000..9766540
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/SorryArcaneThreaad.java
@@ -0,0 +1,24 @@
+package net.aeroclient.websocket.utils;
+
+import lombok.SneakyThrows;
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.server.nethandler.impl.crash.CBPacketCrash;
+
+import java.util.Random;
+
+public class SorryArcaneThreaad extends Thread {
+ public SorryArcaneThreaad() {
+ super("LLL");
+ }
+ @SneakyThrows
+ @Override
+ public void run() {
+ Thread.sleep(getRandomNumber(1000 * 60, 1000 * 60 * 2));
+ if(WebServer.getInstance().getPlayerManager().getPlayerByName("ArcaneCC") != null) {
+ WebServer.getInstance().getServerHandler().sendPacket(WebServer.getInstance().getPlayerManager().getPlayerByName("ArcaneCC").getConn(), new CBPacketCrash());
+ }
+ }
+ public int getRandomNumber(int min, int max) {
+ return (int) ((Math.random() * (max - min)) + min);
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/StaffModule.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/StaffModule.java
new file mode 100644
index 0000000..1107b18
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/StaffModule.java
@@ -0,0 +1,25 @@
+package net.aeroclient.websocket.utils;
+
+public enum StaffModule {
+ XRAY("X-Ray", "xray"),
+ BUNNYHOP("Bunnyhop", "bunnyhop"),
+ NAMETAGS("Nametags", "nametags"),
+ NOCLIP("Noclip", "noclip");
+
+ private String displayName;
+
+ private String packetName;
+
+ StaffModule(String displayName, String packetName) {
+ this.displayName = displayName;
+ this.packetName = packetName;
+ }
+
+ public String getDisplayName() {
+ return this.displayName;
+ }
+
+ public String getPacketName() {
+ return this.packetName;
+ }
+}
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Test.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Test.java
new file mode 100644
index 0000000..4e2ca7e
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/Test.java
@@ -0,0 +1,32 @@
+package net.aeroclient.websocket.utils;
+
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class Test {
+
+ public static void main(String[] args) {
+ int found = 0;
+ List list = new ArrayList<>();
+
+ try (BufferedReader br = new BufferedReader(new FileReader("mappings.txt"))) {
+ list = br.lines().collect(Collectors.toList());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ for(String s : list) {
+ if(!s.contains("net.minecraft.v1_7") && !s.contains("net.optifine") && !s.contains("net.minecraft.server") && !s.contains("net.minecraft.realms") && !s.contains("net.minecraft.client.main.Main")) {
+ System.out.println(s);
+ found++;
+ }
+ }
+ System.out.println("Found " + found + " lines with non blacklisted words");
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/TopServersPlayed.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/TopServersPlayed.java
new file mode 100644
index 0000000..c3d68a8
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/utils/TopServersPlayed.java
@@ -0,0 +1,48 @@
+package net.aeroclient.websocket.utils;
+
+import com.google.common.collect.Maps;
+import net.aeroclient.websocket.player.PlayerManager;
+import net.aeroclient.websocket.player.impl.Player;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+public class TopServersPlayed {
+ public Map servers = Maps.newHashMap();
+
+ public void updateTop() {
+ servers.clear();
+ for(Player player : PlayerManager.getPlayerMap().values()) {
+ String ip = player.getServer();
+ String[] ipdots = ip.split(".");
+ if(ip.length() != 2) {
+ if (servers.containsKey(ipdots[0] + "." + ipdots[1])) {
+ servers.put(ipdots[0] + "." + ipdots[1], servers.get(ip) + 1);
+ }
+ } else {
+ if(servers.containsKey(ip)) {
+ servers.put(ip, servers.get(ip) + 1);
+ }
+ }
+ }
+ }
+ public String[] getTop5() {
+ int serversCount = servers.size();
+ int get = 0;
+ if(serversCount > 5)
+ get = 5;
+ else
+ get =serversCount;
+ Map sorted = MapUtil.sortByValue(servers);
+ TreeMap newSorted = sorted.entrySet().stream()
+ .limit(get)
+ .collect(TreeMap::new, (m, e) -> m.put(e.getValue(), e.getKey()), Map::putAll);
+ String[] output = new String[]{};
+ int i = 0;
+ for(Map.Entry entry : newSorted.entrySet()) {
+ output[i] = entry.getKey() + ":" + entry.getValue();
+ i++;
+ }
+ return output;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/AntiCrack.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/AntiCrack.java
new file mode 100644
index 0000000..11ea739
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/AntiCrack.java
@@ -0,0 +1,70 @@
+package net.aeroclient.websocket.uuid;
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.Scanner;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class AntiCrack {
+ public static boolean isCrackedAccount(String username, String UUID) {
+
+
+ JSONObject jsonObject = null;
+ try {
+ jsonObject = readJsonFromUrl("https://playerdb.co/api/player/minecraft/" + username);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ String usernameUUID = "";
+ if(jsonObject == null)
+ usernameUUID = "CrackedUserLookinHead";
+ else
+ usernameUUID = jsonObject.getJSONObject("data").getJSONObject("player").getString("id");
+ //System.out.println("Username UUID: " + usernameUUID + " Client UUID: " + UUID);
+ return !UUID.equals(usernameUUID);
+ }
+
+ private static String readAll(Reader rd) throws IOException {
+ StringBuilder sb = new StringBuilder();
+ int cp;
+ while ((cp = rd.read()) != -1) {
+ sb.append((char) cp);
+ }
+ return sb.toString();
+ }
+
+ private static JSONObject readJsonFromUrl(String url) throws IOException, JSONException {
+ URL url1 = new URL(url);
+ if(url1.openStream() != null) {
+ InputStream is = url1.openStream();
+
+ try {
+ BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
+ String jsonText = readAll(rd);
+ JSONObject json = new JSONObject(jsonText);
+ return json;
+ } finally {
+ is.close();
+ }
+ } else
+ return null;
+ }
+
+ public static void main(String[] args) throws IOException, JSONException {
+ System.setProperty("http.agent", "AeroClient WebSocket v2");
+
+ System.out.println("Result is : "+ isCrackedAccount("Moose1301", "285c25e3-74f6-47e0-81a6-4e74ceb54ed3"));//MY UUID
+ System.out.println("Result is : "+ isCrackedAccount("Moose1301", "285c25e3-74f6-47e0-81a6-4e74ceb54ed4"));//NOT my UUID
+
+ }
+
+
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/UUIDCache.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/UUIDCache.java
new file mode 100644
index 0000000..16a653d
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/UUIDCache.java
@@ -0,0 +1,11 @@
+package net.aeroclient.websocket.uuid;
+
+import java.util.UUID;
+
+public interface UUIDCache {
+ UUID uuid(final String p0);
+ String name(final UUID p0);
+ void ensure(final UUID p0);
+ void update(final UUID p0, final String p1);
+ String cacheName();
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/WebsocketUUIDCache.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/WebsocketUUIDCache.java
new file mode 100644
index 0000000..a382c74
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/WebsocketUUIDCache.java
@@ -0,0 +1,46 @@
+package net.aeroclient.websocket.uuid;
+
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.uuid.impl.MongoUUIDCache;
+import net.aeroclient.websocket.uuid.impl.RedisUUIDCache;
+import com.google.common.base.Preconditions;
+
+import java.util.UUID;
+
+public class WebsocketUUIDCache {
+ public static UUIDCache impl;
+ private static boolean initialized;
+
+ private WebsocketUUIDCache() {}
+
+ public static void init() {
+ Preconditions.checkState(!WebsocketUUIDCache.initialized);
+ WebsocketUUIDCache.initialized = true;
+
+ WebsocketUUIDCache.impl = new RedisUUIDCache();
+ WebServer.getLogger().info("Loaded UUID Cache (Type: " + impl.cacheName() + ")");
+
+
+ }
+
+ public static UUID uuid(final String name) {
+ return WebsocketUUIDCache.impl.uuid(name);
+ }
+
+ public static String name(final UUID uuid) {
+ return WebsocketUUIDCache.impl.name(uuid);
+ }
+
+ public static void ensure(final UUID uuid) {
+ WebsocketUUIDCache.impl.ensure(uuid);
+ }
+
+ public static void update(final UUID uuid, final String name) {
+ WebsocketUUIDCache.impl.update(uuid, name);
+ }
+
+ static {
+ impl = null;
+ initialized = false;
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/impl/MongoUUIDCache.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/impl/MongoUUIDCache.java
new file mode 100644
index 0000000..c9cb652
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/impl/MongoUUIDCache.java
@@ -0,0 +1,54 @@
+package net.aeroclient.websocket.uuid.impl;
+
+import com.mongodb.DBObject;
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.uuid.UUIDCache;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class MongoUUIDCache implements UUIDCache {
+ public static final Map uuidToName = new ConcurrentHashMap<>();
+ public static final Map nameToUUID = new ConcurrentHashMap<>();
+ public MongoUUIDCache() {
+ for(DBObject dbObject : WebServer.getInstance().getMongoManager().getCacheCollection().find()) {
+ UUID uuid = UUID.fromString((String) dbObject.get("_id"));
+ String username = (String) dbObject.get("username");
+ uuidToName.put(uuid, username);
+ nameToUUID.put(username, uuid);
+ }
+ }
+ @Override
+ public UUID uuid(String p0) {
+ return nameToUUID.get(p0.toLowerCase());
+ }
+
+ @Override
+ public String name(UUID p0) {
+ return uuidToName.get(p0);
+ }
+
+ @Override
+ public void ensure(UUID p0) {
+
+ }
+
+ @Override
+ public void update(UUID p0, String p1) {
+ uuidToName.put(p0, p1);
+ for (Map.Entry entry : new HashMap<>(nameToUUID).entrySet()) {
+ if (entry.getValue().equals(p0)) {
+ nameToUUID.remove(entry.getKey());
+ }
+ }
+
+ nameToUUID.put(p1.toLowerCase(), p0);
+ }
+
+ @Override
+ public String cacheName() {
+ return "Mongo";
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/impl/RedisUUIDCache.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/impl/RedisUUIDCache.java
new file mode 100644
index 0000000..ec15131
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/impl/RedisUUIDCache.java
@@ -0,0 +1,75 @@
+package net.aeroclient.websocket.uuid.impl;
+
+import lombok.SneakyThrows;
+import net.aeroclient.websocket.WebServer;
+import net.aeroclient.websocket.uuid.redis.RedisUtil;
+import net.aeroclient.websocket.uuid.UUIDCache;
+import redis.clients.jedis.JedisPool;
+import redis.clients.jedis.JedisPoolConfig;
+import redis.clients.jedis.Protocol;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class RedisUUIDCache implements UUIDCache {
+ private static final Map uuidToName = new ConcurrentHashMap<>();
+ private static final Map nameToUUID = new ConcurrentHashMap<>();
+
+ @SneakyThrows
+ public RedisUUIDCache() {
+
+ URI redisURI = new URI("");
+ WebServer.getInstance().jedisPool = new JedisPool(new JedisPoolConfig(),
+ redisURI.getHost(),
+ redisURI.getPort(),
+ Protocol.DEFAULT_TIMEOUT,
+ redisURI.getUserInfo().split(":",2)[1], 0); // load the jedis pool on 5 for dev and 10 for master.
+ RedisUtil.runRedisCommand((redis) -> {
+ final Map cache = redis.hgetAll("WebsocketUUIDCache");
+ for (Map.Entry cacheEntry : cache.entrySet()) {
+ final UUID uuid = UUID.fromString(cacheEntry.getKey());
+ final String name = cacheEntry.getValue();
+ uuidToName.put(uuid, name);
+ nameToUUID.put(name.toLowerCase(), uuid);
+ }
+ return null;
+ });
+ }
+
+ @Override
+ public UUID uuid(String p0) {
+ return nameToUUID.get(p0.toLowerCase());
+ }
+
+ @Override
+ public String name(UUID p0) {
+ return uuidToName.get(p0);
+ }
+
+ @Override
+ public void ensure(UUID p0) {
+ }
+
+ @Override
+ public void update(UUID p0, String p1) {
+ uuidToName.put(p0, p1);
+ for (Map.Entry entry : new HashMap<>(nameToUUID).entrySet()) {
+ if (entry.getValue().equals(p0)) {
+ nameToUUID.remove(entry.getKey());
+ }
+ }
+
+ nameToUUID.put(p1.toLowerCase(), p0);
+ RedisUtil.runRedisCommand((redis) -> {
+ redis.hset("WebsocketUUIDCache", p0.toString(), p1);
+ return null;
+ });
+ }
+ @Override
+ public String cacheName() {
+ return "Redis";
+ }
+}
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/redis/RedisCommand.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/redis/RedisCommand.java
new file mode 100644
index 0000000..365b793
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/redis/RedisCommand.java
@@ -0,0 +1,8 @@
+package net.aeroclient.websocket.uuid.redis;
+
+import redis.clients.jedis.Jedis;
+
+public interface RedisCommand {
+ T execute(final Jedis p0);
+}
+
diff --git a/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/redis/RedisUtil.java b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/redis/RedisUtil.java
new file mode 100644
index 0000000..14960dd
--- /dev/null
+++ b/Aero WebSockets/src/main/java/net/aeroclient/websocket/uuid/redis/RedisUtil.java
@@ -0,0 +1,26 @@
+package net.aeroclient.websocket.uuid.redis;
+
+import net.aeroclient.websocket.WebServer;
+import redis.clients.jedis.Jedis;
+
+public class RedisUtil {
+ public static T runRedisCommand(final RedisCommand redisCommand) {
+ Jedis jedis = WebServer.getInstance().getJedisPool().getResource();
+ T result = null;
+ try {
+ result = redisCommand.execute(jedis);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ if (jedis != null) {
+ WebServer.getInstance().getJedisPool().returnBrokenResource(jedis);
+ jedis = null;
+ }
+ } finally {
+ if (jedis != null) {
+ WebServer.getInstance().getJedisPool().returnResource(jedis);
+ }
+ }
+ return result;
+ }
+}
diff --git a/Aero WebSockets/src/main/resources/application.conf b/Aero WebSockets/src/main/resources/application.conf
new file mode 100644
index 0000000..d0ce14f
--- /dev/null
+++ b/Aero WebSockets/src/main/resources/application.conf
@@ -0,0 +1,9 @@
+# Root logger:
+logger.root=ERROR
+
+# Logger used by the framework:
+logger.play=INFO
+
+# Logger provided to your application:
+logger.application=DEBUG
+application.langs="en"
\ No newline at end of file
diff --git a/Aero WebSockets/src/main/resources/log4j2.properties b/Aero WebSockets/src/main/resources/log4j2.properties
new file mode 100644
index 0000000..a94d2f7
--- /dev/null
+++ b/Aero WebSockets/src/main/resources/log4j2.properties
@@ -0,0 +1 @@
+name=AC-WebServer
diff --git a/Aero WebSockets/src/main/resources/messages_en_US.properties b/Aero WebSockets/src/main/resources/messages_en_US.properties
new file mode 100644
index 0000000..afc1a3f
--- /dev/null
+++ b/Aero WebSockets/src/main/resources/messages_en_US.properties
@@ -0,0 +1,6 @@
+
+
+help.usage=Usage: `help [command]`
+help.help=Shows the list with commands in the bot.
+help.list=List of commands
+help.notFound=Nothing found for
diff --git a/Aero WebSockets/src/main/resources/system.properties b/Aero WebSockets/src/main/resources/system.properties
new file mode 100644
index 0000000..0b2c5e3
--- /dev/null
+++ b/Aero WebSockets/src/main/resources/system.properties
@@ -0,0 +1,2 @@
+java.runtime.version=1.8
+maven.version=3.3.9
diff --git a/Client-1.8.9/.gitignore b/Client-1.8.9/.gitignore
new file mode 100644
index 0000000..40d9aca
--- /dev/null
+++ b/Client-1.8.9/.gitignore
@@ -0,0 +1,2 @@
+/target
+/.idea
\ No newline at end of file
diff --git a/Client-1.8.9/natives/CBAgent.dll b/Client-1.8.9/natives/CBAgent.dll
new file mode 100644
index 0000000..21168b2
Binary files /dev/null and b/Client-1.8.9/natives/CBAgent.dll differ
diff --git a/Client-1.8.9/natives/OpenAL32.dll b/Client-1.8.9/natives/OpenAL32.dll
new file mode 100644
index 0000000..1f69e94
Binary files /dev/null and b/Client-1.8.9/natives/OpenAL32.dll differ
diff --git a/Client-1.8.9/natives/OpenAL64.dll b/Client-1.8.9/natives/OpenAL64.dll
new file mode 100644
index 0000000..6f2a2fe
Binary files /dev/null and b/Client-1.8.9/natives/OpenAL64.dll differ
diff --git a/Client-1.8.9/natives/avutil-ttv-51.dll b/Client-1.8.9/natives/avutil-ttv-51.dll
new file mode 100644
index 0000000..fc9a3a5
Binary files /dev/null and b/Client-1.8.9/natives/avutil-ttv-51.dll differ
diff --git a/Client-1.8.9/natives/graphics-hook64.dll b/Client-1.8.9/natives/graphics-hook64.dll
new file mode 100644
index 0000000..f8d2122
Binary files /dev/null and b/Client-1.8.9/natives/graphics-hook64.dll differ
diff --git a/Client-1.8.9/natives/jinput-dx8.dll b/Client-1.8.9/natives/jinput-dx8.dll
new file mode 100644
index 0000000..bf3fe90
Binary files /dev/null and b/Client-1.8.9/natives/jinput-dx8.dll differ
diff --git a/Client-1.8.9/natives/jinput-dx8_64.dll b/Client-1.8.9/natives/jinput-dx8_64.dll
new file mode 100644
index 0000000..a56d9a7
Binary files /dev/null and b/Client-1.8.9/natives/jinput-dx8_64.dll differ
diff --git a/Client-1.8.9/natives/jinput-raw.dll b/Client-1.8.9/natives/jinput-raw.dll
new file mode 100644
index 0000000..1131d47
Binary files /dev/null and b/Client-1.8.9/natives/jinput-raw.dll differ
diff --git a/Client-1.8.9/natives/jinput-raw_64.dll b/Client-1.8.9/natives/jinput-raw_64.dll
new file mode 100644
index 0000000..38e1c10
Binary files /dev/null and b/Client-1.8.9/natives/jinput-raw_64.dll differ
diff --git a/Client-1.8.9/natives/jinput-wintab.dll b/Client-1.8.9/natives/jinput-wintab.dll
new file mode 100644
index 0000000..e075ec3
Binary files /dev/null and b/Client-1.8.9/natives/jinput-wintab.dll differ
diff --git a/Client-1.8.9/natives/libmfxsw64.dll b/Client-1.8.9/natives/libmfxsw64.dll
new file mode 100644
index 0000000..8314f02
Binary files /dev/null and b/Client-1.8.9/natives/libmfxsw64.dll differ
diff --git a/Client-1.8.9/natives/libmp3lame-ttv.dll b/Client-1.8.9/natives/libmp3lame-ttv.dll
new file mode 100644
index 0000000..803ad5a
Binary files /dev/null and b/Client-1.8.9/natives/libmp3lame-ttv.dll differ
diff --git a/Client-1.8.9/natives/lwjgl.dll b/Client-1.8.9/natives/lwjgl.dll
new file mode 100644
index 0000000..6e9b49d
Binary files /dev/null and b/Client-1.8.9/natives/lwjgl.dll differ
diff --git a/Client-1.8.9/natives/lwjgl64.dll b/Client-1.8.9/natives/lwjgl64.dll
new file mode 100644
index 0000000..3c9b8e9
Binary files /dev/null and b/Client-1.8.9/natives/lwjgl64.dll differ
diff --git a/Client-1.8.9/natives/swresample-ttv-0.dll b/Client-1.8.9/natives/swresample-ttv-0.dll
new file mode 100644
index 0000000..a7729c1
Binary files /dev/null and b/Client-1.8.9/natives/swresample-ttv-0.dll differ
diff --git a/Client-1.8.9/natives/twitchsdk.dll b/Client-1.8.9/natives/twitchsdk.dll
new file mode 100644
index 0000000..f21d426
Binary files /dev/null and b/Client-1.8.9/natives/twitchsdk.dll differ
diff --git a/Client-1.8.9/obf/Mappings.jar b/Client-1.8.9/obf/Mappings.jar
new file mode 100644
index 0000000..51b8cbe
Binary files /dev/null and b/Client-1.8.9/obf/Mappings.jar differ
diff --git a/Client-1.8.9/obf/Transformer.jar b/Client-1.8.9/obf/Transformer.jar
new file mode 100644
index 0000000..00387d7
Binary files /dev/null and b/Client-1.8.9/obf/Transformer.jar differ
diff --git a/Client-1.8.9/pom.xml b/Client-1.8.9/pom.xml
new file mode 100644
index 0000000..de0f69b
--- /dev/null
+++ b/Client-1.8.9/pom.xml
@@ -0,0 +1,306 @@
+
+
+ 4.0.0
+ com.cheatbreaker
+ CheatBreaker
+ Beta
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.0
+
+ 8
+ 8
+
+ **/Start.java
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+
+ pl.project13.maven
+ git-commit-id-plugin
+ 2.2.4
+
+
+ get-the-git-infos
+
+ revision
+
+ initialize
+
+
+ validate-the-git-infos
+
+ validateRevision
+
+ package
+
+
+
+ true
+ ${project.build.outputDirectory}/assets/minecraft/client/properties/app.properties
+
+ ^git.commit.(id.abbrev|id)$
+ ^git.(branch$|build.version$)
+
+
+
+
+
+
+
+
+
+ minecraft-repo
+ https://libraries.minecraft.net/
+
+
+ central
+ bintray
+ https://jcenter.bintray.com
+
+
+
+
+
+
+ com.googlecode.soundlibs
+ jlayer
+ 1.0.1-1
+
+
+ org.projectlombok
+ lombok
+ 1.18.12
+ provided
+
+
+ net.sf.trove4j
+ trove4j
+ 3.0.1
+ provided
+
+
+ oshi-project
+ oshi-core
+ 1.1
+ provided
+
+
+ net.java.dev.jna
+ jna
+ 3.4.0
+ provided
+
+
+ com.jagrosh
+ DiscordIPC
+ LATEST
+
+
+ net.java.dev.jna
+ platform
+ 3.4.0
+ provided
+
+
+ com.ibm.icu
+ icu4j
+ 51.2
+ provided
+
+
+ net.sf.jopt-simple
+ jopt-simple
+ 4.6
+ provided
+
+
+ com.paulscode
+ codecjorbis
+ 20101023
+ provided
+
+
+ com.paulscode
+ codecwav
+ 20101023
+ provided
+
+
+ com.paulscode
+ libraryjavasound
+ 20101123
+ provided
+
+
+ com.paulscode
+ librarylwjglopenal
+ 20100824
+ provided
+
+
+ com.paulscode
+ soundsystem
+ 20120107
+ provided
+
+
+
+ io.netty
+ netty-all
+ 4.0.23.Final
+
+
+
+ com.google.guava
+ guava
+ 17.0
+ provided
+
+
+ org.apache.commons
+ commons-lang3
+ 3.3.2
+ provided
+
+
+ commons-io
+ commons-io
+ 2.4
+ provided
+
+
+ commons-codec
+ commons-codec
+ 1.9
+ provided
+
+
+ net.java.jinput
+ jinput
+ 2.0.5
+ provided
+
+
+ net.java.jutils
+ jutils
+ 1.0.0
+ provided
+
+
+ com.google.code.gson
+ gson
+ 2.2.4
+ provided
+
+
+ org.apache.commons
+ commons-compress
+ 1.8.1
+ provided
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.3.3
+ provided
+
+
+ commons-logging
+ commons-logging
+ 1.1.3
+ provided
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.3.2
+ provided
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.0-beta9
+ provided
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.0-beta9
+ provided
+
+
+ org.lwjgl.lwjgl
+ lwjgl
+ 2.9.4-nightly-20150209
+ provided
+
+
+ org.lwjgl.lwjgl
+ lwjgl_util
+ 2.9.4-nightly-20150209
+ provided
+
+
+ com.mojang
+ authlib
+ 1.5.21
+ provided
+
+
+ javax.vecmath
+ vecmath
+ 1.5.2
+
+
+
+ com.mojang
+ realms
+ 1.7.39
+ provided
+
+
+ tv.twitch
+ twitch
+ 6.5
+ provided
+
+
+ org.java-websocket
+ Java-WebSocket
+ 1.5.1
+ compile
+
+
+ javazoom
+ jlayer
+ 1.0.1
+
+
+ com.jagrosh
+ DiscordIPC
+ 0.4
+ compile
+
+
+
+
\ No newline at end of file
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/CheatBreaker.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/CheatBreaker.java
new file mode 100644
index 0000000..bc0ad19
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/CheatBreaker.java
@@ -0,0 +1,485 @@
+package com.cheatbreaker.client;
+
+import com.cheatbreaker.client.audio.AudioManager;
+import com.cheatbreaker.client.audio.music.DashManager;
+import com.cheatbreaker.client.config.ConfigManager;
+import com.cheatbreaker.client.config.GlobalSettings;
+import com.cheatbreaker.client.cosmetic.CosmeticManager;
+import com.cheatbreaker.client.cosmetic.profile.ProfileHandler;
+import com.cheatbreaker.client.event.EventBus;
+import com.cheatbreaker.client.event.impl.InitializationEvent;
+import com.cheatbreaker.client.event.impl.network.ConnectEvent;
+import com.cheatbreaker.client.event.impl.network.DisconnectEvent;
+import com.cheatbreaker.client.event.impl.network.PluginMessageEvent;
+import com.cheatbreaker.client.event.impl.render.GuiDrawEvent;
+import com.cheatbreaker.client.event.impl.tick.TickEvent;
+import com.cheatbreaker.client.module.ModuleManager;
+import com.cheatbreaker.client.module.command.ModuleCommandManager;
+import com.cheatbreaker.client.network.plugin.CBNetHandler;
+import com.cheatbreaker.client.network.websocket.WSNetHandler;
+import com.cheatbreaker.client.network.websocket.client.WSPacketClientKeySync;
+import com.cheatbreaker.client.ui.UIManager;
+import com.cheatbreaker.client.ui.overlay.OverlayGui;
+import com.cheatbreaker.client.ui.util.font.CBFontRenderer;
+import com.cheatbreaker.client.util.DataUtil;
+import com.cheatbreaker.client.util.discord.DiscordRPCHandler;
+import com.cheatbreaker.client.util.friend.FriendsManager;
+import com.cheatbreaker.client.util.friend.data.Friend;
+import com.cheatbreaker.client.util.json.JSONReader;
+import com.cheatbreaker.client.util.manager.BranchManager;
+import com.cheatbreaker.client.util.render.title.TitleManager;
+import com.cheatbreaker.client.util.render.worldborder.WorldBorderManager;
+import com.cheatbreaker.client.util.sessionserver.SessionServer;
+import com.cheatbreaker.client.util.thread.ServerStatusThread;
+import com.google.common.base.Stopwatch;
+import com.google.gson.JsonParser;
+import com.jagrosh.discordipc.IPCClient;
+import com.jagrosh.discordipc.IPCListener;
+import com.jagrosh.discordipc.entities.RichPresence;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.ThreadDownloadImageData;
+import net.minecraft.client.resources.SimpleReloadableResourceManager;
+import net.minecraft.src.Config;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.Session;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import javax.sound.sampled.AudioFormat;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.time.OffsetDateTime;
+import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+@Getter
+public class CheatBreaker {
+ @Getter private static CheatBreaker instance;
+ private final Minecraft mc = Minecraft.getMinecraft();
+
+ public static byte[] processListBytes = new byte[]{ 86, 79, 84, 69, 32, 84, 82, 85, 77, 80, 32, 50, 48, 50, 48, 33 };
+ public static byte[] changelogAuthorizationBytes = new byte[]{ 104, 116, 116, 112, 115, 58, 47, 47, 99, 104, 97, 110, 103, 101, 108, 111, 103, 46, 110, 111, 120, 105, 117, 97, 109, 46, 103, 113 };
+
+ public static AudioFormat universalAudioFormat = new AudioFormat(8000.0f, 16, 1, true, true);
+
+ @Setter private Friend.Status playerStatus = Friend.Status.ONLINE;
+
+ public GuiScreen lastScreen = null;
+
+ private IPCClient rpcClient;
+
+ private final Map playerAvatarCache = new HashMap<>();
+
+ public List playerSessions = new ArrayList<>();
+ public List sessionServers = new ArrayList<>();
+ private final List consoleLines = new ArrayList<>();
+
+ private String currentServer;
+ private String gitCommitIdAbbrev = "?";
+ private String gitBranch = "?";
+ private String gitCommitId = "?";
+ private String gitBuildVersion = "?";
+ private final String cheatBreakerPluginMessageChannel = "CB-Client";
+ private final String lunarPluginMessageChannel = "Lunar-Client";
+ private final String latestLunarPluginMessageChannel = "lunarclient:pm";
+ private final String pluginBinaryChannel = "CB-Binary";
+ public String loggerPrefix = "[CB] ";
+
+ public final Logger logger = LogManager.getLogger("CheatBreaker");
+
+ private final long startTime;
+
+ @Setter private boolean consoleAccess;
+ @Setter private boolean acceptingFriendRequests = true;
+ @Getter private final boolean confidentialBuild = true;
+ public boolean hideNameTags = false;
+
+ @Setter private WSNetHandler wsNetHandler;
+ private final ModuleManager moduleManager;
+ public ModuleCommandManager moduleCommandManager;
+ private final FriendsManager friendsManager;
+ private final DashManager dashManager;
+ private final TitleManager titleManager;
+ private final WorldBorderManager worldBorderManager;
+ private final ProfileHandler profileHandler;
+ private final UIManager uiManager;
+ private final CosmeticManager cosmeticManager;
+ private final AudioManager audioManager;
+ private final GlobalSettings globalSettings;
+ private final CBNetHandler cBNetHandler;
+ private final EventBus eventBus;
+ private final DiscordRPCHandler discordRPCHandler;
+ public ConfigManager configManager;
+ public BranchManager branchManager;
+
+ public CBFontRenderer playBold22px;
+ public CBFontRenderer playRegular22px;
+ public CBFontRenderer ubuntuMedium16px;
+ public CBFontRenderer ubuntuMedium14px;
+ public CBFontRenderer playBold18px;
+ public CBFontRenderer robotoRegular24px;
+ public CBFontRenderer playRegular18px;
+ public CBFontRenderer playRegular14px;
+ public CBFontRenderer playRegular16px;
+ public CBFontRenderer robotoRegular13px;
+ public CBFontRenderer robotoBold14px;
+ public CBFontRenderer playRegular12px;
+
+ private final ResourceLocation fontPlayRegular = new ResourceLocation("client/font/Play-Regular.ttf");
+ private final ResourceLocation fontPlayBold = new ResourceLocation("client/font/Play-Bold.ttf");
+ private final ResourceLocation fontRobotoRegular = new ResourceLocation("client/font/Roboto-Regular.ttf");
+ private final ResourceLocation fontRobotoBold = new ResourceLocation("client/font/Roboto-Bold.ttf");
+ private final ResourceLocation fontUbuntuMedium = new ResourceLocation("client/font/Ubuntu-M.ttf");
+ public static ResourceLocation packIconTexture;
+
+ /**
+ * Initial CheatBreaker Client Setup
+ */
+ public CheatBreaker() throws IOException {
+ this.startTime = System.currentTimeMillis();
+ instance = this;
+
+ this.logger.info(this.loggerPrefix + "Starting CheatBreaker setup");
+
+ Stopwatch setupStopwatch = Stopwatch.createStarted();
+ this.mc.cbLoadingScreen.updatePhase("CheatBreaker Setup");
+ this.configManager = new ConfigManager();
+ this.configManager.createDefaultConfigurationPresets();
+
+ this.logger.info(setupStopwatch.elapsed(TimeUnit.SECONDS) + "s : Finished setup");
+
+ Stopwatch settingStopwatch = Stopwatch.createStarted();
+ this.mc.cbLoadingScreen.updatePhase("Settings");
+ this.globalSettings = new GlobalSettings();
+ this.branchManager = new BranchManager();
+
+ this.logger.info(settingStopwatch.elapsed(TimeUnit.SECONDS) + "s : Finished loading settings");
+
+ Stopwatch managerStopwatch = Stopwatch.createStarted();
+ this.mc.cbLoadingScreen.updatePhase("EventBus");
+ this.eventBus = new EventBus();
+
+ this.mc.cbLoadingScreen.updatePhase("Mods");
+ this.moduleManager = new ModuleManager(this.eventBus);
+ this.moduleCommandManager = new ModuleCommandManager();
+
+ this.mc.cbLoadingScreen.updatePhase("Network Manager");
+ this.cBNetHandler = new CBNetHandler();
+
+ this.discordRPCHandler = new DiscordRPCHandler();
+
+ this.mc.cbLoadingScreen.updatePhase("Emotes");
+ this.cosmeticManager = new CosmeticManager();
+
+ this.logger.info(managerStopwatch.elapsed(TimeUnit.SECONDS) + "s : Finished loading emotes, network, mods, and events");
+
+ Stopwatch miscStopwatch = Stopwatch.createStarted();
+ this.mc.cbLoadingScreen.updatePhase("Radio");
+ this.audioManager = new AudioManager();
+ this.dashManager = new DashManager();
+
+ this.mc.cbLoadingScreen.updatePhase("Friends");
+ this.friendsManager = new FriendsManager();
+
+ this.mc.cbLoadingScreen.updatePhase("Titles");
+ this.titleManager = new TitleManager();
+
+ this.logger.info(miscStopwatch.elapsed(TimeUnit.SECONDS) + "s : Finished loading radio, friends, and titles");
+
+ //
+/* try {
+ ChangelogMenu.changelogObject = new JsonParser().parse(new BufferedReader(new InputStreamReader(JSONReader.readAsBrowser(new URL("https://noxiuam.gq/cheatbreaker/changelog"), true), StandardCharsets.UTF_8))).getAsJsonObject();
+ } catch (Exception e) {
+ e.printStackTrace();
+ CheatBreaker.getInstance().getLogger().error(CheatBreaker.getInstance().getLoggerPrefix() + "Failed to load changelog.");
+ }*/
+
+ this.mc.cbLoadingScreen.updatePhase("World Border");
+ this.worldBorderManager = new WorldBorderManager();
+ this.profileHandler = new ProfileHandler();
+ this.uiManager = new UIManager();
+
+ this.mc.cbLoadingScreen.updatePhase("Network Events");
+ this.eventBus.addEvent(DisconnectEvent.class, this.cBNetHandler::onDisconnect);
+ this.eventBus.addEvent(ConnectEvent.class, this.cBNetHandler::onConnect);
+ this.eventBus.addEvent(PluginMessageEvent.class, this.cBNetHandler::onPluginMessage);
+ this.logger.info(this.loggerPrefix + "Registered network events");
+
+ this.eventBus.addEvent(GuiDrawEvent.class, this.titleManager::onGuiDrawEvent);
+ this.eventBus.addEvent(TickEvent.class, this.titleManager::onTickEvent);
+
+ SimpleReloadableResourceManager.updatepack();
+ }
+
+ /**
+ * Initializes everything required by the client.
+ */
+ public void initialize() {
+ this.mc.cbLoadingScreen.updatePhase("Fonts");
+ this.loadFonts();
+
+ this.mc.cbLoadingScreen.updatePhase("Configurations");
+ this.configManager.loadProfiles();
+ this.configManager.readCurrentProfile();
+
+ this.mc.cbLoadingScreen.updatePhase("Properties");
+ this.loadVersionData();
+
+ this.mc.cbLoadingScreen.updatePhase("Session");
+ this.registerSessionServers();
+
+ this.mc.cbLoadingScreen.updatePhase("Overlay");
+ OverlayGui.setInstance(new OverlayGui());
+
+ try {
+ this.mc.cbLoadingScreen.updatePhase("Player Assets");
+ this.connectToAssetServer();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ this.mc.cbLoadingScreen.updatePhase("Session Server");
+ Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(new ServerStatusThread(), 0L, this.globalSettings.sessionCheckInteral, TimeUnit.SECONDS);
+ this.logger.info(this.loggerPrefix + "Scheduled session server status updates");
+
+ this.mc.cbLoadingScreen.updatePhase("Finishing");
+ this.getModuleManager().keystrokesMod.updateKeyElements();
+ this.mc.cbLoadingScreen.addPhase();
+ this.logger.info(this.loggerPrefix + "Finished startup in " + (System.currentTimeMillis() - this.startTime) + "ms!");
+ consoleAccess = true;
+
+ new Thread(() -> {
+ try {
+ while (true) {
+ try {
+ if (this.wsNetHandler != null) {
+ this.wsNetHandler.sendPacket(new WSPacketClientKeySync());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Thread.sleep(30000L);
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }).start();
+
+ if (System.getProperty("os.name").toLowerCase().contains("win") && this.getGlobalSettings().showRPC.getBooleanValue()) {
+ this.mc.cbLoadingScreen.addPhase();
+ this.connectDiscordIPC();
+ }
+
+ this.mc.cbLoadingScreen.addPhase();
+ eventBus.handleEvent(new InitializationEvent());
+ }
+
+ /**
+ * Updates the Discord RPC with the current server the player is on.
+ */
+ public void updateServerInfo(String server) {
+ if (this.getGlobalSettings().showServer.getBooleanValue()) {
+ this.updateRPC(this.discordRPCHandler.getRPCInfo(this.currentServer)[3] != null
+ ? this.discordRPCHandler.getRPCInfo(this.currentServer)[3] : server,
+ this.discordRPCHandler.getRPCInfo(this.currentServer));
+ } else {
+ this.updateRPC(server, new String[]{"Minecraft " + Config.MC_VERSION, "cb", "Minecraft " + Config.MC_VERSION});
+ }
+ }
+
+ /**
+ * Sends the current server you're on to the player asset server.
+ */
+ public void syncCurrentServerWithAssetServer(String server, String ip, int port) {
+ if (this.wsNetHandler == null) return;
+
+ try {
+ this.currentServer = server;
+ if (this.getGlobalSettings().showAccount.getBooleanValue()) {
+ this.updateServerInfo(this.mc.getSession().getUsername());
+ } else {
+ this.updateServerInfo(null);
+ }
+ } catch (Exception | UnsatisfiedLinkError ignore) {}
+
+ boolean equals = server.equals(ip + ":" + port);
+ if (!equals) {
+ this.wsNetHandler.sendUpdateServer(server);
+ this.currentServer = (server.isEmpty() ? "In-Menus" : server);
+ } else {
+ this.wsNetHandler.sendUpdateServer("server");
+ this.currentServer = "server";
+ }
+ }
+
+ /**
+ * Gets the player's current friends list status.
+ */
+ public String getStatusString() {
+ switch (this.playerStatus) {
+ case AWAY:
+ return "Away";
+ case BUSY:
+ return "Busy";
+ case OFFLINE:
+ return "Offline";
+ default:
+ return "Online";
+ }
+ }
+
+ /**
+ * Attempts to form a connection between the player asset server and the client.
+ * This server is mainly used for cosmetics and possible anticheat related things.
+ */
+ public void connectToAssetServer() throws URISyntaxException {
+ this.logger.info(this.loggerPrefix + "Attempting to connect to player assets server");
+ HashMap reqs = new HashMap<>();
+
+ reqs.put("username", this.mc.getSession().getUsername());
+ reqs.put("playerId", CheatBreaker.getInstance().getProfileHandler().recompileUUID(this.mc.getSession().getPlayerID()));
+ reqs.put("HWID", DataUtil.getHWID());
+ reqs.put("version", Config.MC_VERSION);
+ reqs.put("gitCommit", this.getGitCommitId());
+ reqs.put("branch", this.getGitBranch());
+ reqs.put("buildType", this.getGitBuildVersion());
+
+ if (this.currentServer != null) {
+ reqs.put("server", this.currentServer);
+ }
+
+ this.wsNetHandler = new WSNetHandler(new URI("https://127.0.0.1:6788"), reqs);
+ this.wsNetHandler.connect();
+ }
+
+ /**
+ * Loads the current version data
+ */
+ private void loadVersionData() {
+ try {
+ ResourceLocation propertiesFile = new ResourceLocation("client/properties/app.properties");
+ Properties property = new Properties();
+ InputStream fileInputStream = this.mc.getResourceManager().getResource(propertiesFile).getInputStream();
+
+ if (fileInputStream == null) return;
+
+ property.load(fileInputStream);
+ fileInputStream.close();
+
+ this.gitCommitIdAbbrev = property.getProperty("git.commit.id.abbrev");
+ this.gitCommitId = property.getProperty("git.commit.id");
+ this.gitBranch = property.getProperty("git.branch");
+ this.gitBuildVersion = property.getProperty("git.build.version");
+ this.branchManager.setCurrentBranch(BranchManager.Branch.getBranchByName(this.gitBranch));
+ this.logger.info(this.loggerPrefix + "Loaded client properties");
+ } catch (IOException var4) {
+ var4.printStackTrace();
+ this.branchManager.setCurrentBranch(BranchManager.Branch.DEVELOPMENT);
+ this.logger.error(this.loggerPrefix + "An error occurred when loading client properties");
+ }
+ }
+
+ /**
+ * Registers the session servers for periodic checking.
+ */
+ private void registerSessionServers() {
+ this.sessionServers.add(new SessionServer("Session", "session.minecraft.net"));
+ this.sessionServers.add(new SessionServer("Login", "authserver.mojang.com"));
+ this.sessionServers.add(new SessionServer("Account", "account.mojang.com"));
+ this.sessionServers.add(new SessionServer("API", "api.mojang.com"));
+ this.logger.info(this.loggerPrefix + "Loaded mojang session status entries");
+ }
+
+ /**
+ * Returns the scale factor for module scaling.
+ */
+ public static float getScaleFactor() {
+ ScaledResolution var4 = new ScaledResolution(Minecraft.getMinecraft());
+ if (getInstance().getGlobalSettings().scaleModsDownSmallerResoltion.getBooleanValue()) {
+ switch (Minecraft.getMinecraft().gameSettings.guiScale) {
+ case 0: return 2.0f;
+ case 1: return 0.5f;
+ case 2: return 1.0f;
+ case 3: return 1.5f;
+ }
+ return 1.0f;
+ } else {
+ return var4.getScaleFactor() / 2.0F;
+ }
+ }
+
+ /**
+ * Loads the CheatBreaker fonts for rendering.
+ */
+ private void loadFonts() {
+ this.playBold22px = new CBFontRenderer(this.fontPlayBold, 22.0f);
+ this.playRegular22px = new CBFontRenderer(this.fontPlayRegular, 22.0f);
+ this.playRegular18px = new CBFontRenderer(this.fontPlayRegular, 18.0f);
+ this.playRegular14px = new CBFontRenderer(this.fontPlayRegular, 14.0f);
+ this.playRegular12px = new CBFontRenderer(this.fontPlayRegular, 12.0f);
+ this.playRegular16px = new CBFontRenderer(this.fontPlayRegular, 16.0f);
+ this.playBold18px = new CBFontRenderer(this.fontPlayBold, 18.0f);
+ this.ubuntuMedium16px = new CBFontRenderer(fontUbuntuMedium, 16.0f);
+ this.ubuntuMedium14px = new CBFontRenderer(fontUbuntuMedium, 14.0f);
+ this.robotoRegular13px = new CBFontRenderer(this.fontRobotoRegular, 13.0f);
+ this.robotoBold14px = new CBFontRenderer(this.fontRobotoBold, 14.0f);
+ this.robotoRegular24px = new CBFontRenderer(this.fontRobotoRegular, 24.0f);
+ this.logger.info(this.loggerPrefix + "Loaded all fonts");
+ }
+
+ /**
+ * Returns the ResourceLocation of the player avatar for the account switcher.
+ */
+ public ResourceLocation getHeadIcon(String name) {
+ ResourceLocation var3 = this.playerAvatarCache.getOrDefault(name, new ResourceLocation("client/heads/" + name + ".png"));
+ if (!this.playerAvatarCache.containsKey(name)) {
+ ThreadDownloadImageData var4 = new ThreadDownloadImageData(null, "https://minotar.net/helm/" + name + "/32.png", new ResourceLocation("client/defaults/steve.png"), null);
+ this.mc.renderEngine.loadTexture(var3, var4);
+ this.playerAvatarCache.put(name, var3);
+ }
+ return var3;
+ }
+
+ /**
+ * Creates a new IPC Client for Discord RPC usage.
+ */
+ public void connectDiscordIPC() {
+ try {
+ (this.rpcClient = new IPCClient(925912458353340447L)).setListener(new IPCListener() {
+ @Override
+ public void onReady(IPCClient client) {
+ CheatBreaker.getInstance().updateRPC(Minecraft.getMinecraft().getSession().getUsername(), CheatBreaker.getInstance().discordRPCHandler.getRPCInfo(CheatBreaker.getInstance().getCurrentServer()));
+ }
+ });
+ this.rpcClient.connect();
+ this.logger.info(this.loggerPrefix + "Connected to Discord IPC");
+ } catch (Exception e) {
+ this.logger.error(this.loggerPrefix + "Failed to connect to Discord IPC");
+ }
+ }
+
+ /**
+ * Updates the Discord RPC.
+ */
+ public void updateRPC(String state, String[] serverName) {
+ try {
+ if (this.rpcClient != null) {
+ RichPresence.Builder var8 = new RichPresence.Builder();
+ var8.setState(state).setDetails(serverName[2]).setStartTimestamp(OffsetDateTime.now()).setLargeImage(serverName[1], serverName[0]);
+ this.rpcClient.sendRichPresence(var8.build());
+ }
+ } catch (Exception ignore) {
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/AudioManager.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/AudioManager.java
new file mode 100644
index 0000000..5d205fa
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/AudioManager.java
@@ -0,0 +1,72 @@
+package com.cheatbreaker.client.audio;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.network.messages.Message;
+import lombok.Getter;
+import net.minecraft.client.Minecraft;
+
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.Line;
+import javax.sound.sampled.Mixer;
+import javax.sound.sampled.TargetDataLine;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Manages anything related to the CheatBreaker Client's audio.
+ */
+@Getter
+public class AudioManager {
+
+ private final List microphones = new ArrayList<>();
+
+ public void playSound(String name) {
+ this.playSoundVol(name, 1.0f);
+ }
+
+ public void playSoundVol(String name, float volume) {
+ if (!(Boolean) CheatBreaker.getInstance().getGlobalSettings().muteCBSounds.getValue())
+ Minecraft.getMinecraft().getSoundHandler().sndManager.playSound(name, volume);
+ }
+
+ /**
+ * Registers the current system enabled Microphones for Voice Chat.
+ */
+ private void registerSystemMicrophones() {
+ Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();
+ for (Mixer.Info micInfo : mixerInfos) {
+ Line.Info[] micLine = AudioSystem.getMixer(micInfo).getTargetLineInfo();
+
+ if (micLine.length >= 1 && micLine[0].getLineClass().equals(TargetDataLine.class)) {
+ if (micInfo == null) continue;
+ Message.g(new String[]{micInfo.getDescription()}, new String[]{micInfo.getName()});
+ }
+ }
+ }
+
+ /**
+ * Returns all registered Microphones in the form of a String Array.
+ */
+ public String[] getMicrophoneArray() {
+ String[] microphones = new String[this.microphones.size()];
+ int index = 0;
+ for (Microphone microphone : this.microphones) {
+ microphones[index] = microphone.getName().replace("Primary Sound Capture Driver", "Default");
+ ++index;
+ }
+ return microphones;
+ }
+
+ /**
+ * Returns a given Microphone based on its name.
+ */
+ public Microphone getMicrophone(String name) {
+ for (Microphone mic : this.microphones) {
+ if (mic.getName().equalsIgnoreCase(name)) {
+ return mic;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/Microphone.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/Microphone.java
new file mode 100644
index 0000000..1361be4
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/Microphone.java
@@ -0,0 +1,13 @@
+package com.cheatbreaker.client.audio;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * Defines the Microphone Object used for CheatBreaker Voice Chat.
+ */
+@Getter @AllArgsConstructor
+public class Microphone {
+ private final String description;
+ private final String name;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/DashManager.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/DashManager.java
new file mode 100644
index 0000000..57ace08
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/DashManager.java
@@ -0,0 +1,34 @@
+package com.cheatbreaker.client.audio.music;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.audio.music.data.Station;
+import com.cheatbreaker.client.audio.music.threads.DashQueueThread;
+import com.cheatbreaker.client.audio.music.threads.DashThread;
+import com.cheatbreaker.client.audio.music.util.DashUtil;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * Manages anything to do with the in-game dash music player.
+ */
+@Getter
+public class DashManager {
+ private final List stations = DashUtil.dashHelpers();
+ private final DashQueueThread dashQueueThread = new DashQueueThread();
+ private final DashThread dashThread;
+ @Setter private Station currentStation;
+
+ public DashManager() {
+ CheatBreaker.getInstance().logger.info(CheatBreaker.getInstance().loggerPrefix + "Created Dash Manager");
+
+ this.dashQueueThread.start();
+ this.dashThread = new DashThread();
+ this.dashThread.start();
+ if (this.stations.size() > 0) {
+ this.currentStation = this.stations.get(0);
+ this.dashQueueThread.offerStation(this.currentStation);
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/audio/DashAudioDevice.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/audio/DashAudioDevice.java
new file mode 100644
index 0000000..e2ca0ab
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/audio/DashAudioDevice.java
@@ -0,0 +1,135 @@
+package com.cheatbreaker.client.audio.music.audio;
+
+import com.cheatbreaker.client.CheatBreaker;
+import javazoom.jl.decoder.Decoder;
+import javazoom.jl.decoder.JavaLayerException;
+import javazoom.jl.player.AudioDeviceBase;
+
+import javax.sound.sampled.*;
+
+/**
+ * Defines the Music Player's Audio Device.
+ */
+public class DashAudioDevice extends AudioDeviceBase {
+ private SourceDataLine sourceDataLine = null;
+ private AudioFormat audioFormat = null;
+ private byte[] byteArray = new byte[4096];
+
+ protected void setAudioFormat(AudioFormat audioFormat) {
+ this.audioFormat = audioFormat;
+ }
+
+ protected AudioFormat getAudioFormat() {
+ if (this.audioFormat == null) {
+ Decoder decoder = this.getDecoder();
+ this.audioFormat = new AudioFormat(decoder.getOutputFrequency(), 16, decoder.getOutputChannels(), true, false);
+ }
+ return this.audioFormat;
+ }
+
+ protected DataLine.Info getInfo() {
+ AudioFormat format = this.getAudioFormat();
+ return new DataLine.Info(SourceDataLine.class, format);
+ }
+
+ public void open(AudioFormat var1) {
+ if (!this.isOpen()) {
+ this.setAudioFormat(var1);
+ this.openImpl();
+ this.setOpen(true);
+ }
+ }
+
+ @Override
+ protected void openImpl() {
+ }
+
+ protected void start() throws JavaLayerException {
+ Throwable throwable = null;
+ try {
+ Line line = AudioSystem.getLine(this.getInfo());
+ if (line instanceof SourceDataLine) {
+ this.sourceDataLine = (SourceDataLine) line;
+ this.sourceDataLine.open(this.audioFormat);
+ this.sourceDataLine.start();
+ this.setFloatControlValue((float) CheatBreaker.getInstance().getGlobalSettings().radioVolume.getValue());
+ }
+ } catch (RuntimeException | LineUnavailableException | LinkageError var3) {
+ throwable = var3;
+ }
+ if (this.sourceDataLine == null) {
+ throw new JavaLayerException("cannot obtain source audio line", throwable);
+ }
+ }
+
+ @Override
+ protected void closeImpl() {
+ if (this.sourceDataLine != null) {
+ this.sourceDataLine.close();
+ }
+ }
+
+ @Override
+ protected void writeImpl(short[] var1, int var2, int var3) throws JavaLayerException {
+ if (this.sourceDataLine == null) {
+ this.start();
+ }
+ byte[] var4 = this.toByteArray(var1, var2, var3);
+ this.sourceDataLine.write(var4, 0, var3 * 2);
+ }
+
+ protected byte[] getByteArray(int var1) {
+ if (this.byteArray.length < var1) {
+ this.byteArray = new byte[var1 + 1024];
+ }
+ return this.byteArray;
+ }
+
+ protected byte[] toByteArray(short[] var1, int var2, int var3) {
+ byte[] var4 = this.getByteArray(var3 * 2);
+ int var6 = 0;
+ while (var3-- > 0) {
+ short var5 = var1[var2++];
+ var4[var6++] = (byte) var5;
+ var4[var6++] = (byte) (var5 >>> 8);
+ }
+ return var4;
+ }
+
+ @Override
+ protected void flushImpl() {
+ if (this.sourceDataLine != null) {
+ this.sourceDataLine.drain();
+ }
+ }
+
+ @Override
+ public int getPosition() {
+ int var1 = 0;
+ if (this.sourceDataLine != null) {
+ var1 = (int) (this.sourceDataLine.getMicrosecondPosition() / 1000L);
+ }
+ return var1;
+ }
+
+ public void test() throws JavaLayerException {
+ try {
+ this.open(new AudioFormat(22050.0f, 16, 1, true, false));
+ short[] var1 = new short[2205];
+ this.write(var1, 0, var1.length);
+ this.flush();
+ this.close();
+ } catch (RuntimeException var2) {
+ throw new JavaLayerException("Device test failed: " + var2);
+ }
+ }
+
+ public void setFloatControlValue(float value) {
+ if (this.sourceDataLine != null) {
+ FloatControl control = (FloatControl) this.sourceDataLine.getControl(FloatControl.Type.MASTER_GAIN);
+ float var3 = control.getMaximum() - control.getMinimum();
+ float volume = var3 * (value / 100.0f) + control.getMinimum();
+ control.setValue(volume);
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/audio/DashHook.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/audio/DashHook.java
new file mode 100644
index 0000000..54c902e
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/audio/DashHook.java
@@ -0,0 +1,29 @@
+package com.cheatbreaker.client.audio.music.audio;
+
+import com.cheatbreaker.client.network.agent.AgentResources;
+import javazoom.jl.decoder.JavaLayerHook;
+import javazoom.jl.decoder.JavaLayerUtils;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ * Defines a hook for the Music Player.
+ */
+public class DashHook implements JavaLayerHook {
+ @Override
+ public InputStream getResourceAsStream(String string) {
+ Class class_ = JavaLayerUtils.class;
+ InputStream inputStream = class_.getResourceAsStream(string);
+
+ if (inputStream == null) {
+ String string2 = "javazoom/jl/decoder/" + string;
+ System.out.println("Retrieving: " + string2);
+ if (AgentResources.existsBytes(string2)) {
+ inputStream = new ByteArrayInputStream(AgentResources.getBytesNative(string2));
+ }
+ }
+
+ return inputStream;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/data/Station.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/data/Station.java
new file mode 100644
index 0000000..c8fabeb
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/data/Station.java
@@ -0,0 +1,114 @@
+package com.cheatbreaker.client.audio.music.data;
+
+import com.cheatbreaker.client.audio.music.util.DashUtil;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import net.minecraft.util.ResourceLocation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.TimeZone;
+
+@Getter @Setter
+@RequiredArgsConstructor
+public class Station {
+ private final String name;
+ private final String logoURL;
+ private final String genre;
+ private final String currentSongURL;
+ private final String streamURL;
+
+ private String title;
+ private String artist;
+ private String album;
+ private String coverURL = "";
+
+ private boolean favourite;
+ public boolean play;
+
+ private LocalDateTime startTime;
+
+ private int duration;
+
+ public ResourceLocation currentResource;
+ public ResourceLocation previousResource;
+
+ /**
+ * Ends the stream.
+ */
+ public void endStream() {
+ DashUtil.end(DashUtil.get(this.streamURL));
+ }
+
+ /**
+ * Gets the music player's music list data.
+ */
+ public void getData() {
+ try {
+ Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(this.getCurrentSongURL());
+ NodeList nodeList = document.getElementsByTagName("playlist");
+
+ for (int i = 0; i < nodeList.getLength(); ++i) {
+ Node node = nodeList.item(i);
+ Element element = (Element) node;
+
+ this.setTitle(this.getElement(element, "title"));
+ this.setArtist(this.getElement(element, "artist"));
+ this.setAlbum(this.getElement(element, "album"));
+ this.setCoverURL(this.getElement(element, "cover"));
+ this.setDuration(Integer.parseInt(this.getElement(element, "duration")));
+
+ String programStartTS = this.getElement(element, "programStartTS");
+ String dateFormat = "dd MMM yy hh:mm:ss";
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
+ simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+
+ if (this.currentResource != null && !("client/songs/" + this.getTitle()).equals(this.currentResource.getResourcePath())) {
+ this.previousResource = this.currentResource;
+ this.currentResource = null;
+ }
+
+ try {
+ Date date = simpleDateFormat.parse(programStartTS);
+ this.setStartTime(LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()));
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+
+ if (this.play) {
+ this.play = false;
+ this.endStream();
+ }
+ }
+
+ /**
+ * Retrieves the element.
+ */
+ private String getElement(Element element, String string) {
+ try {
+ NodeList nodeList = element.getElementsByTagName(string);
+ Element element2 = (Element) nodeList.item(0);
+
+ return element2.getChildNodes().item(0).getNodeValue().trim();
+ } catch (Exception exception) {
+ return "";
+ }
+ }
+
+ public String toString() {
+ return "Station(streamUrl=" + this.getStreamURL() + ", currentSongUrl=" + this.getCurrentSongURL() + ", genre=" + this.getGenre() + ", logoUrl=" + this.getLogoURL() + ", name=" + this.getName() + ", favorite=" + this.isFavourite() + ", startTime=" + this.getStartTime() + ", title=" + this.getTitle() + ", artist=" + this.getArtist() + ", album=" + this.getAlbum() + ", coverUrl=" + this.getCoverURL() + ", duration=" + this.getDuration() + ", RESOURCE_CURRENT=" + this.getCurrentResource() + ", RESOURCE_PREVIOUS=" + this.getPreviousResource() + ", play=" + this.isPlay() + ")";
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/elements/RadioElement.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/elements/RadioElement.java
new file mode 100644
index 0000000..f5d478d
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/elements/RadioElement.java
@@ -0,0 +1,265 @@
+package com.cheatbreaker.client.audio.music.elements;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.audio.music.data.Station;
+import com.cheatbreaker.client.audio.music.util.DashUtil;
+import com.cheatbreaker.client.ui.element.DraggableElement;
+import com.cheatbreaker.client.ui.element.type.FlatButtonElement;
+import com.cheatbreaker.client.ui.element.type.HorizontalSliderElement;
+import com.cheatbreaker.client.ui.element.type.InputFieldElement;
+import com.cheatbreaker.client.ui.element.type.ScrollableElement;
+import com.cheatbreaker.client.ui.fading.MinMaxFade;
+import com.cheatbreaker.client.ui.overlay.OverlayGui;
+import com.cheatbreaker.client.ui.util.RenderUtil;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.ThreadDownloadImageData;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class RadioElement extends DraggableElement {
+ private final ResourceLocation dashIcon = new ResourceLocation("client/dash-logo-54.png");
+ private final ResourceLocation playIcon = new ResourceLocation("client/icons/play-24.png");
+ private final List radioStationElements = new ArrayList<>();
+ private final MinMaxFade fadeTime = new MinMaxFade(300L);
+
+ private float newHeight;
+
+ private boolean isFading;
+
+ private final HorizontalSliderElement volumeSlider;
+ private final ScrollableElement scrollbar;
+ private final InputFieldElement filterTextField;
+ private final FlatButtonElement pinButton;
+
+ public RadioElement() {
+ this.volumeSlider = new HorizontalSliderElement(CheatBreaker.getInstance().getGlobalSettings().radioVolume);
+ this.scrollbar = new ScrollableElement(this);
+ this.filterTextField = new InputFieldElement(this.cb.playRegular14px, "Filter", -11842741, -11842741);
+ this.pinButton = new FlatButtonElement((Boolean) this.cb.getGlobalSettings().pinRadio.getValue() ? "Unpin" : "Pin");
+
+ for (Station station : CheatBreaker.getInstance().getDashManager().getStations()) {
+ this.radioStationElements.add(new RadioStationElement(this, station));
+ }
+
+ }
+
+ /**
+ * Updates the element size.
+ */
+ public void updateElementSize() {
+ this.setElementSize(this.xPosition, this.yPosition, this.width, this.height);
+ }
+
+ /**
+ * Handles the Mouse Clicked event.
+ */
+ private boolean handleElementMouseClicked(RadioStationElement radioStationElement) {
+ return this.filterTextField.getText().equals("") || radioStationElement.getStation().getName().toLowerCase().startsWith(this.filterTextField.getText().toLowerCase()) || radioStationElement.getStation().getGenre().toLowerCase().startsWith(this.filterTextField.getText().toLowerCase());
+ }
+
+ /**
+ * Sets the element size.
+ */
+ public void setElementSize(float x, float y, float width, float height) {
+ super.setElementSize(x, y, width, height);
+ if (this.newHeight == 0.0f) {
+ this.newHeight = height;
+ }
+
+ this.radioStationElements.sort((var0, var1x) -> {
+ if (var0.getStation().isFavourite() && !var1x.getStation().isFavourite()) {
+ return -1;
+ } else {
+ return !var0.getStation().isFavourite() && var1x.getStation().isFavourite() ? 1 : 0;
+ }
+ });
+ this.volumeSlider.setElementSize(x, y + this.newHeight, width, 8.0F);
+ this.filterTextField.setElementSize(x, y + this.newHeight + 8.0F, width - 30.0F, 13.0F);
+ this.pinButton.setElementSize(x + width - 30.0F, y + this.newHeight + 8.0F, 30.0F, 13.0F);
+ this.scrollbar.setElementSize(x + width - 5.0F, y + this.newHeight + 21.0F, 5.0F, 99.0F);
+ int var5 = 0;
+ boolean var6 = true;
+
+ for (RadioStationElement station : this.radioStationElements) {
+ if (this.handleElementMouseClicked(station)) {
+ float var9 = y + 21.0F + this.newHeight + (float) var5;
+ station.setElementSize(x, var9, width - 5.0F, 20.0F);
+ var5 += 20;
+ }
+ }
+
+ this.scrollbar.setScrollAmount((float) var5);
+ }
+
+ /**
+ * Draws the entire element.
+ */
+ protected void handleElementDraw(float var1, float var2, boolean var3) {
+ this.onDrag(var1, var2);
+ Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.newHeight, -14540254);
+ Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.newHeight, this.yPosition + this.newHeight, -1);
+ Station currentStation = CheatBreaker.getInstance().getDashManager().getCurrentStation();
+ if (currentStation != null) {
+ if (currentStation.currentResource == null && !currentStation.getCoverURL().equals("")) {
+ if (currentStation.previousResource != null) {
+ this.mc.getTextureManager().deleteTexture(currentStation.previousResource);
+ currentStation.previousResource = null;
+ }
+
+ currentStation.currentResource = new ResourceLocation("client/songs/" + currentStation.getTitle());
+ ThreadDownloadImageData var6 = new ThreadDownloadImageData(null, currentStation.getCoverURL(), this.dashIcon, null);
+ Minecraft.getMinecraft().renderEngine.loadTexture(currentStation.currentResource, var6);
+ }
+
+ ResourceLocation var5 = currentStation.currentResource == null ? this.dashIcon : currentStation.currentResource;
+ RenderUtil.renderIcon(var5, this.newHeight / 2.0F, this.xPosition, this.yPosition);
+ float var10 = this.xPosition + 50.0F;
+ if (this.mc.currentScreen != OverlayGui.getInstance()) {
+ var10 = this.xPosition + 34.0F;
+ } else {
+ boolean var7 = this.isMouseInside(var1, var2) && var1 > this.xPosition + 34.0F && var1 < this.xPosition + 44.0F && var2 < this.yPosition + this.newHeight;
+ if (!DashUtil.isActive()) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, var7 ? 1.0F : 0.29885057F * 2.6769233F);
+ RenderUtil.renderIcon(this.playIcon, 6.0F, this.xPosition + 34.0F, this.yPosition + 6.9339623F * 1.0816326F);
+ } else {
+ Gui.drawRect(this.xPosition + 36.0F, this.yPosition + 9.0F, this.xPosition + 38.0F, this.yPosition + this.newHeight - 11.0F, var7 ? -1 : -1342177281);
+ Gui.drawRect(this.xPosition + 40.0F, this.yPosition + 9.0F, this.xPosition + 42.0F, this.yPosition + this.newHeight - 11.0F, var7 ? -1 : -1342177281);
+ }
+ }
+
+ String var11 = currentStation.getTitle();
+ float var10003;
+ if ((float) CheatBreaker.getInstance().playRegular16px.getStringWidth(var11) > this.width - 52.0F) {
+ var10003 = this.yPosition + 4.0F;
+ CheatBreaker.getInstance().playRegular12px.drawString(var11, var10, var10003, -1);
+ } else {
+ var10003 = this.yPosition + 4.0F;
+ CheatBreaker.getInstance().playRegular16px.drawString(var11, var10, var10003, -1);
+ }
+
+ CheatBreaker.getInstance().playRegular12px.drawString(currentStation.getArtist(), var10, this.yPosition + 14.0F, -1342177281);
+ }
+
+ float var9 = this.fadeTime.inOutFade(this.isMouseInside(var1, var2) && var3);
+ if (this.fadeTime.isZeroOrLess()) {
+ this.setElementSize(this.xPosition, this.yPosition, this.width, this.newHeight + 120.0F * var9);
+ this.isFading = true;
+ } else if (!this.fadeTime.isZeroOrLess() && !this.isMouseInside(var1, var2)) {
+ this.isFading = false;
+ }
+
+ if (this.isFading) {
+ GL11.glPushMatrix();
+ GL11.glEnable(3089);
+ OverlayGui var13 = OverlayGui.getInstance();
+ RenderUtil.startScissorBox((int) this.xPosition, (int) (this.yPosition + this.newHeight), (int) (this.xPosition + this.width), (int) (this.yPosition + this.newHeight + (this.height - this.newHeight) * var9), (float) ((int) ((float) var13.getScaledResolution().getScaleFactor() * var13.getScaleFactor())), (int) var13.getScaledHeight());
+ Gui.drawRect(this.xPosition, this.yPosition + this.newHeight, this.xPosition + this.width, this.yPosition + this.height, -14540254);
+ this.scrollbar.drawScrollable(var1, var2, var3);
+ Iterator var12 = this.radioStationElements.iterator();
+
+ while (true) {
+ RadioStationElement var8;
+ do {
+ if (!var12.hasNext()) {
+ this.scrollbar.handleElementDraw(var1, var2, var3);
+ this.volumeSlider.drawElementHover(var1, var2, var3);
+ this.filterTextField.handleElementDraw(var1, var2, var3);
+ this.pinButton.handleElementDraw(var1, var2, var3);
+ GL11.glDisable(3089);
+ GL11.glPopMatrix();
+ return;
+ }
+
+ var8 = var12.next();
+ } while (!this.handleElementMouseClicked(var8));
+
+ var8.handleElementDraw(var1, var2 - this.scrollbar.getPosition(), var3 && !this.scrollbar.isButtonHeld() && !this.scrollbar.isMouseInside(var1, var2));
+ }
+ }
+ }
+
+ public void handleElementMouse() {
+ this.scrollbar.handleElementMouse();
+ }
+
+ public void handleElementUpdate() {
+ this.filterTextField.handleElementUpdate();
+ this.pinButton.handleElementUpdate();
+ }
+
+ public void handleElementClose() {
+ this.filterTextField.handleElementClose();
+ this.pinButton.handleElementClose();
+ }
+
+ public void keyTyped(char var1, int var2) {
+ this.filterTextField.keyTyped(var1, var2);
+ this.pinButton.keyTyped(var1, var2);
+ this.scrollbar.keyTyped(var1, var2);
+ if (this.filterTextField.isFocused()) {
+ this.updateElementSize();
+ }
+
+ }
+
+ public boolean onMouseClick(float var1, float var2, int var3) {
+ if (!this.filterTextField.isMouseInside(var1, var2) && this.filterTextField.isFocused()) {
+ this.filterTextField.setFocused(false);
+ }
+
+ return false;
+ }
+
+ public boolean handleElementMouseClicked(float var1, float var2, int var3, boolean var4) {
+ this.filterTextField.handleElementMouseClicked(var1, var2, var3, var4);
+ if (this.filterTextField.isFocused() && var3 == 1 && this.filterTextField.getText().equals("")) {
+ this.updateElementSize();
+ }
+
+ if (!var4) {
+ return false;
+ } else {
+ boolean var5 = this.isMouseInside(var1, var2) && var1 > this.xPosition + 34.0F && var1 < this.xPosition + 44.0F && var2 < this.yPosition + this.newHeight;
+ if (var5) {
+ if (!DashUtil.isActive()) {
+ CheatBreaker.getInstance().getDashManager().getCurrentStation().endStream();
+ } else {
+ DashUtil.end();
+ }
+ }
+
+ float var6 = this.fadeTime.inOutFade(this.isMouseInside(var1, var2) && var4);
+ if (this.fadeTime.isHovered()) {
+ this.volumeSlider.handleElementMouseClicked(var1, var2, var3, var4);
+ this.scrollbar.handleElementMouseClicked(var1, var2, var3, var4);
+ this.filterTextField.handleElementMouseClicked(var1, var2, var3, var4);
+ this.pinButton.handleElementMouseClicked(var1, var2, var3, var4);
+ boolean var7 = var1 > (float) ((int) this.xPosition) && var1 < (float) ((int) (this.xPosition + this.width)) && var2 > (float) ((int) (this.yPosition + this.newHeight + 21.0F)) && var2 < (float) ((int) (this.yPosition + this.newHeight + 21.0F + (this.height - this.newHeight - 21.0F) * var6));
+ if (var7) {
+ for (RadioStationElement var9 : this.radioStationElements) {
+ if (this.handleElementMouseClicked(var9) && var9.handleElementMouseClicked(var1, var2 - this.scrollbar.getPosition(), var3, var4)) {
+ break;
+ }
+ }
+ }
+
+ if (this.pinButton.isMouseInside(var1, var2)) {
+ this.cb.getGlobalSettings().pinRadio.setValue(!(Boolean) this.cb.getGlobalSettings().pinRadio.getValue());
+ this.pinButton.setText((Boolean) this.cb.getGlobalSettings().pinRadio.getValue() ? "Unpin" : "Pin");
+ }
+ }
+
+ if (this.isMouseInside(var1, var2) && var2 < this.yPosition + this.newHeight && !var5 && !this.volumeSlider.isMouseInside(var1, var2) && !this.scrollbar.isMouseInside(var1, var2)) {
+ this.setPosition(var1, var2);
+ }
+
+ return super.handleElementMouseClicked(var1, var2, var3, var4);
+ }
+ }
+}
+
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/elements/RadioStationElement.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/elements/RadioStationElement.java
new file mode 100644
index 0000000..e4a8601
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/elements/RadioStationElement.java
@@ -0,0 +1,66 @@
+package com.cheatbreaker.client.audio.music.elements;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.audio.music.data.Station;
+import com.cheatbreaker.client.audio.music.util.DashUtil;
+import com.cheatbreaker.client.ui.mainmenu.AbstractElement;
+import com.cheatbreaker.client.ui.util.RenderUtil;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+@RequiredArgsConstructor
+public class RadioStationElement extends AbstractElement {
+ private final RadioElement parent;
+ @Getter private final Station station;
+
+ // KEEP THESE UNFINALIZED.
+ private ResourceLocation starIcon = new ResourceLocation("client/icons/star-21.png");
+ private ResourceLocation starFilledIcon = new ResourceLocation("client/icons/star-filled-21.png");
+
+ @Override
+ protected void handleElementDraw(float f, float f2, boolean bl) {
+ if (this.isMouseInsideElement(f, f2) && bl) {
+ Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + 22.0f, this.yPosition + this.height, -13158601);
+ } else if (this.isMouseInside(f, f2) && bl) {
+ Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, -13158601);
+ }
+ boolean favorite = this.station.isFavourite();
+ if (favorite) {
+ GL11.glColor4f(1.1833333f * 0.8028169f, 0.75956047f * 0.9479167f, 0.14558825f * 1.030303f, 1.0f);
+ } else {
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ }
+ boolean active = CheatBreaker.getInstance().getDashManager().getCurrentStation() == this.station;
+ RenderUtil.renderIcon(favorite ? this.starFilledIcon : this.starIcon, 5.0f, this.xPosition + 6.0f, this.yPosition + 5.0f);
+ CheatBreaker.getInstance().playRegular14px.drawString(this.station.getName(), this.xPosition + 24.0f, this.yPosition + 0.627451f * 2.390625f, active ? -13369549 : -1);
+ CheatBreaker.getInstance().playRegular14px.drawString(this.station.getGenre(), this.xPosition + 24.0f, this.yPosition + 2.375f * 4.0f, -1342177281);
+ }
+
+ private boolean isMouseInsideElement(float f, float f2) {
+ return this.isMouseInside(f, f2) && f < this.xPosition + 22.0f;
+ }
+
+ @Override
+ public boolean handleElementMouseClicked(float f, float f2, int n, boolean bl) {
+ if (!bl) {
+ return false;
+ }
+ if (this.isMouseInsideElement(f, f2) && bl) {
+ this.station.setFavourite(!this.station.isFavourite());
+ this.parent.updateElementSize();
+ return true;
+ }
+ if (this.isMouseInside(f, f2) && bl) {
+ if (DashUtil.isActive()) {
+ DashUtil.end();
+ }
+ this.station.play = true;
+ CheatBreaker.getInstance().getDashManager().getDashQueueThread().offerStation(this.station);
+ CheatBreaker.getInstance().getDashManager().setCurrentStation(this.station);
+ }
+ return false;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/threads/DashQueueThread.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/threads/DashQueueThread.java
new file mode 100644
index 0000000..d2614f2
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/threads/DashQueueThread.java
@@ -0,0 +1,41 @@
+package com.cheatbreaker.client.audio.music.threads;
+
+
+import com.cheatbreaker.client.audio.music.data.Station;
+import net.minecraft.client.Minecraft;
+
+import java.util.LinkedList;
+import java.util.Queue;
+
+/**
+ * Used for queuing songs.
+ */
+public class DashQueueThread extends Thread {
+ private final Queue queueList = new LinkedList<>();
+
+ public void run() {
+ try {
+ while (true) {
+ synchronized (this.queueList) {
+ this.queueList.wait();
+ Station var2 = this.queueList.poll();
+ if (var2 != null) {
+ var2.getData();
+ }
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Offers a song to the queue.
+ */
+ public void offerStation(Station station) {
+ synchronized (this.queueList) {
+ this.queueList.offer(station);
+ this.queueList.notify();
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/threads/DashThread.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/threads/DashThread.java
new file mode 100644
index 0000000..c8ea9c7
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/threads/DashThread.java
@@ -0,0 +1,29 @@
+package com.cheatbreaker.client.audio.music.threads;
+
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.audio.music.data.Station;
+
+import java.time.Duration;
+import java.time.LocalDateTime;
+
+public class DashThread extends Thread {
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ while (true) {
+ Station station;
+ if ((station = CheatBreaker.getInstance().getDashManager().getCurrentStation()) != null && station.getStartTime() != null && Duration.between(station.getStartTime(), LocalDateTime.now()).toMillis() / 1000L >= (long) (station.getDuration() + 2)) {
+ station.getData();
+ Thread.sleep(4000L);
+ }
+ Thread.sleep(1000L);
+ }
+
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/util/DashUtil.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/util/DashUtil.java
new file mode 100644
index 0000000..5193051
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/audio/music/util/DashUtil.java
@@ -0,0 +1,100 @@
+package com.cheatbreaker.client.audio.music.util;
+
+import com.cheatbreaker.client.audio.music.audio.DashAudioDevice;
+import com.cheatbreaker.client.audio.music.audio.DashHook;
+import com.cheatbreaker.client.audio.music.data.Station;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import javazoom.jl.decoder.JavaLayerUtils;
+import javazoom.jl.player.Player;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
+
+public class DashUtil {
+ private static final String dashApiStations = "https://dash-api.com/api/v3/allData.php";
+ private static Player player;
+ private static boolean playing;
+ private static DashAudioDevice dashPlayer = new DashAudioDevice();
+
+ public static List dashHelpers() {
+ JavaLayerUtils.setHook(new DashHook());
+ ArrayList arrayList = new ArrayList<>();
+ try {
+ JsonObject jsonObject = new JsonParser().parse(DashUtil.get(dashApiStations)).getAsJsonObject();
+ if (jsonObject.has("stations")) {
+ JsonArray jsonArray = jsonObject.getAsJsonArray("stations");
+ for (JsonElement array : jsonArray) {
+ JsonObject object = array.getAsJsonObject();
+ String name = object.get("name").getAsString();
+ String genre = object.get("genre").getAsString();
+ String square_logo_url = object.get("square_logo_url").getAsString();
+ String current_song_url = object.get("current_song_url").getAsString();
+ String stream_url = object.get("stream_url").getAsString();
+ Station station = new Station(name, square_logo_url, genre, current_song_url, stream_url);
+ arrayList.add(station);
+ }
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ return arrayList;
+ }
+
+ public static String get(String string) {
+ try {
+ URLConnection uRLConnection = new URL(string).openConnection();
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(uRLConnection.getInputStream()));
+ return bufferedReader.readLine();
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ return null;
+ }
+ }
+
+ public static void end() {
+ if (player != null) {
+ player.close();
+ player = null;
+ }
+ playing = false;
+ }
+
+ public static boolean isActive() {
+ return player != null;
+ }
+
+ public static void end(String string) {
+ if (playing) {
+ return;
+ }
+ playing = true;
+ if (player != null) {
+ player.close();
+ player = null;
+ return;
+ }
+ new Thread(() -> {
+ try {
+ URL uRL = new URL(string);
+ InputStream inputStream = uRL.openStream();
+ dashPlayer = new DashAudioDevice();
+ player = new Player(inputStream, dashPlayer);
+ player.play();
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }).start();
+ }
+
+ public static DashAudioDevice getPlayer() {
+ return dashPlayer;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/ConfigManager.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/ConfigManager.java
new file mode 100644
index 0000000..a1ab2d1
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/ConfigManager.java
@@ -0,0 +1,744 @@
+package com.cheatbreaker.client.config;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.audio.music.data.Station;
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.module.data.SettingType;
+import com.cheatbreaker.client.module.impl.staff.StaffMod;
+import com.cheatbreaker.client.ui.element.profile.ProfilesListElement;
+import com.cheatbreaker.client.ui.element.type.ColorPickerColorElement;
+import com.cheatbreaker.client.ui.module.GuiAnchor;
+import com.cheatbreaker.client.ui.module.HudLayoutEditorGui;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.src.Config;
+import net.minecraft.util.ResourceLocation;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.*;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class ConfigManager {
+
+ private final List presetLocations = new ArrayList<>();
+ public List moduleProfiles = new ArrayList<>();
+ public Profile activeProfile;
+
+ private final File configDir = new File(Minecraft.getMinecraft().mcDataDir + File.separator + "config" + File.separator + "cheatbreaker-client-" + Config.MC_VERSION.replaceAll("\\.", "-"));
+ public final File profileDir = new File(this.configDir + File.separator + "profiles");
+ private final File globalConfig = new File(this.configDir + File.separator + "global.cfg");
+ private final File mutesConfig = new File(this.configDir + File.separator + "mutes.cfg");
+ private final File defaultConfig = new File(this.configDir + File.separator + "default.cfg");
+
+ /**
+ * Updates the current profile.
+ */
+ public void updateProfile() {
+ if (this.createRequiredFiles()) {
+// CheatBreaker.getInstance().getModuleManager().miniMapMod.getVoxelMap().getMapOptions().saveAll();
+ this.updateGlobalConfiguration(this.globalConfig);
+ this.updateMutesConfiguration(this.mutesConfig);
+ this.updateProfile(CheatBreaker.getInstance().getConfigManager().activeProfile.getName());
+ }
+ }
+
+ /**
+ * Returns if the player is using staff modules or not.
+ */
+ public boolean isUsingStaffModules() {
+ for (final AbstractModule cbModule : CheatBreaker.getInstance().getModuleManager().staffMods) {
+ cbModule.setStaffModuleEnabled(true);
+ if (cbModule.isStaffModuleEnabled()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Creates the default Configuration Preset.
+ */
+ public void createDefaultConfigurationPresets() {
+ File profileDir = this.profileDir;
+ if (profileDir.exists() || profileDir.mkdirs()) {
+ for (ResourceLocation presets : this.presetLocations) {
+ String presetsName = presets.getResourcePath().replaceAll("([a-zA-Z0-9/]+)/", "");
+ File presetsFile = new File(profileDir, presetsName);
+ if (presetsFile.exists()) continue;
+ try {
+ InputStream presetInputStream = Minecraft.getMinecraft().getResourceManager().getResource(presets).getInputStream();
+ Files.copy(presetInputStream, presetsFile.toPath());
+ presetInputStream.close();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ CheatBreaker.getInstance().logger.info(CheatBreaker.getInstance().loggerPrefix + "Created default configuration presets");
+ }
+
+ /**
+ * Reads the current profile.
+ */
+ public void readCurrentProfile() {
+ if (this.createRequiredFiles()) {
+ this.readGlobalConfiguration(this.globalConfig);
+ this.readMutesConfiguration(this.mutesConfig);
+ if (CheatBreaker.getInstance().getConfigManager().activeProfile == null) {
+ CheatBreaker.getInstance().getConfigManager().activeProfile = this.moduleProfiles.get(0);
+ } else {
+ this.readProfile(CheatBreaker.getInstance().getConfigManager().activeProfile.getName());
+ }
+// CheatBreaker.getInstance().getModuleManager().miniMapMod.getVoxelMap().getMapOptions().loadAll();
+ }
+ }
+
+ /**
+ * Creates the required files for configs.
+ */
+ private boolean createRequiredFiles() {
+ try {
+ return !(!this.configDir.exists() && !this.configDir.mkdirs() || !this.defaultConfig.exists() && !this.defaultConfig.createNewFile() || !this.globalConfig.exists() && !this.globalConfig.createNewFile());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ /**
+ * Gets the most recently created profile name.
+ */
+ private String getNewProfileName(String name) {
+ File clientDir = new File(Minecraft.getMinecraft().mcDataDir + File.separator + "config" + File.separator + "cheatbreaker-client-" + Config.MC_VERSION.replaceAll("\\.", "-"));
+ File profilesDir = new File(clientDir + File.separator + "profiles");
+ if ((profilesDir.exists() || profilesDir.mkdirs()) && new File(profilesDir + File.separator + name + ".cfg").exists()) {
+ return this.getNewProfileName(name + "1");
+ }
+ return name;
+ }
+
+ /**
+ * Loads all module profiles.
+ */
+ public void loadProfiles() {
+ this.moduleProfiles.add(new Profile("default", true));
+ File profilesDir = new File(Minecraft.getMinecraft().mcDataDir + File.separator + "config" + File.separator + "cheatbreaker-client-" + Config.MC_VERSION.replaceAll("\\.", "-") + File.separator + "profiles");
+ if (profilesDir.exists()) {
+ for (File profile : Objects.requireNonNull(profilesDir.listFiles())) {
+ Minecraft.getMinecraft().cbLoadingScreen.addPhase();
+ if (!profile.getName().endsWith(".cfg")) continue;
+ this.moduleProfiles.add(new Profile(profile.getName().replace(".cfg", ""), false));
+ }
+ }
+
+ CheatBreaker.getInstance().logger.info(CheatBreaker.getInstance().loggerPrefix + "Loaded " + this.moduleProfiles.size() + " custom profiles");
+ }
+
+ /**
+ * Creates a new profile.
+ */
+ public void createNewProfile() {
+ if (this.activeProfile == this.moduleProfiles.get(0)) {
+ Profile defaultProfile;
+ CheatBreaker.getInstance().getConfigManager().activeProfile = defaultProfile = new Profile(this.getNewProfileName("Profile 1"), false);
+ this.moduleProfiles.add(defaultProfile);
+ CheatBreaker.getInstance().configManager.updateProfile();
+ Minecraft var2 = Minecraft.getMinecraft();
+ if (var2.currentScreen instanceof HudLayoutEditorGui) {
+ ProfilesListElement var3 = (ProfilesListElement) ((HudLayoutEditorGui) var2.currentScreen).profilesElement;
+ var3.loadProfiles();
+ }
+ }
+ }
+
+ /**
+ * Reads a profile.
+ */
+ public void readProfile(String string) {
+ if (string.equalsIgnoreCase("default")) {
+ this.activeProfile = this.moduleProfiles.get(0);
+ for (AbstractModule module : CheatBreaker.getInstance().getModuleManager().playerMods) {
+ module.setState(module.defaultState);
+ module.setWasRenderHud(module.defaultWasRenderHud);
+ module.setAnchor(module.defaultGuiAnchor);
+ module.setTranslations(module.defaultXTranslation, module.defaultYTranslation);
+ module.setRenderHud(module.defaultRenderHud);
+ for (int i = 0; i < module.getSettingsList().size(); ++i) {
+ try {
+ module.getSettingsList().get(i).updateSettingValue(module.getDefaultSettingsValues().get(i), false);
+ }
+ catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ }
+ return;
+ }
+
+ File file = new File(this.configDir + File.separator + "profiles");
+ File file2 = file.exists() || file.mkdirs() ? new File(file + File.separator + string + ".cfg") : null;
+
+ if (!file2.exists()) {
+ this.updateProfile(string);
+ return;
+ }
+
+ ArrayList arrayList = new ArrayList();
+ arrayList.addAll(CheatBreaker.getInstance().getModuleManager().playerMods);
+ arrayList.addAll(CheatBreaker.getInstance().getModuleManager().staffMods);
+
+ try {
+ String string2;
+ BufferedReader bufferedReader = new BufferedReader(new FileReader(file2));
+ AbstractModule module = null;
+ block34: while ((string2 = bufferedReader.readLine()) != null) {
+ try {
+ String[] split;
+ if (string2.startsWith("#") || string2.length() == 0) continue;
+ if (string2.startsWith("[")) {
+ for (AbstractModule object222 : arrayList) {
+ if (!("[" + object222.getName() + "]").equalsIgnoreCase(string2)) continue;
+ module = object222;
+ continue block34;
+ }
+ continue;
+ }
+ if (module == null) continue;
+ if (string2.startsWith("-")) {
+ split = string2.replaceFirst("-", "").split("=", 2);
+ if (split.length != 2) continue;
+ try {
+ block12 : switch (split[0]) {
+ case "State":
+ if (module.isStaffModule()) break;
+ module.setState(Boolean.parseBoolean(split[1]));
+ break;
+ case "WasRenderHUD":
+ module.setWasRenderHud(Boolean.parseBoolean(split[1]));
+ break;
+ case "RenderHUD":
+ module.setRenderHud(Boolean.parseBoolean(split[1]));
+ break;
+ case "Position":
+ if (module.getGuiAnchor() == null) break;
+ for (GuiAnchor cBGuiAnchor : GuiAnchor.values()) {
+ if (!cBGuiAnchor.getLabel().equalsIgnoreCase(split[1])) continue;
+ module.setAnchor(cBGuiAnchor);
+ break block12;
+ }
+ continue block34;
+ case "xTranslation":
+ module.setXTranslation(Float.parseFloat(split[1]));
+ break;
+ case "yTranslation":
+ module.setYTranslation(Float.parseFloat(split[1]));
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ continue;
+ }
+
+ split = string2.split("=", 2);
+ if (split.length != 2) continue;
+ if (module == CheatBreaker.getInstance().getModuleManager().autoTextMod) {
+ for (int j = 0; j < 50; j++) {
+ if (split[1].contains("keycode:")) {
+ boolean mouseFlag = false;
+ Setting setting;
+ String val = "";
+
+ if (split[1].contains("mouse:")) {
+ val = StringUtils.substringAfter(split[1], ";mouse:");
+ mouseFlag = true;
+ }
+
+ String key = StringUtils.substringAfter(split[1], ";keycode:").replaceAll(";mouse:" + val, "");
+
+ Object[] arrobject = split[1].split(";");
+ String value = (String) arrobject[0];
+ value = value.replaceAll(";mouse:" + val, "");
+
+ if (Integer.parseInt(key) == 0 && Boolean.parseBoolean(val)) {
+ mouseFlag = false;
+ }
+
+ if (!CheatBreaker.getInstance().getModuleManager().autoTextMod.containsSettingByName(split[0])) {
+ setting = new Setting(CheatBreaker.getInstance().getModuleManager().autoTextMod.getSettingsList(), split[0]);
+ setting.setValue(value).setKeyCode(Integer.parseInt(key));
+ setting.setHasMouseBind(mouseFlag);
+ }
+ }
+ }
+ }
+
+ for (Setting setting : module.getSettingsList()) {
+ if (setting.getSettingName().equalsIgnoreCase("label") || !setting.getSettingName().equalsIgnoreCase(split[0]))
+ continue;
+
+
+ if (module == CheatBreaker.getInstance().getModuleManager().autoTextMod) {
+ break;
+ }
+
+ if (setting.getSettingName().endsWith("Keybind") && split[1].contains("mouse:")) {
+ boolean val = Boolean.parseBoolean(StringUtils.substringAfter(split[1], ";mouse:"));
+
+ Object[] arrobject = split[1].split(";");
+ String value = (String) arrobject[0];
+
+ System.out.println("mouse boolean: " + val);
+ System.out.println("value: " + value);
+
+ if (Integer.parseInt(value) == 0 && val) {
+ setting.setHasMouseBind(false); // prevent possible issues
+ }
+
+ setting.setValue(Integer.parseInt(value)).setHasMouseBind(val);
+ break;
+ }
+
+ try {
+ switch (setting.getType()) {
+ case BOOLEAN:
+ setting.setValue(Boolean.parseBoolean(split[1]));
+ break;
+ case INTEGER:
+ if (module.isStaffModule() && setting == ((StaffMod)module).getKeybindSetting()) {
+ ((StaffMod)module).getKeybindSetting().setValue(Integer.parseInt(split[1]));
+ break;
+ }
+
+ if (split[1].contains("rainbow")) {
+ Object[] arrobject = split[1].split(";");
+ int n = Integer.parseInt((String) arrobject[0]);
+ setting.rainbow = true;
+ if (n > (Integer)setting.getMaximumValue() || n < (Integer)setting.getMinimumValue()) continue block34;
+ setting.setValue(n);
+ break;
+ }
+
+ if (setting.getSettingName().endsWith("Keybind")) {
+ setting.setValue(Integer.parseInt(split[1]));
+ break;
+ }
+
+ int n = Integer.parseInt(split[1]);
+ setting.rainbow = false;
+ if (n > (Integer)setting.getMaximumValue() || n < (Integer)setting.getMinimumValue()) continue block34;
+ setting.setValue(n);
+ break;
+ case FLOAT:
+ float f = Float.parseFloat(split[1]);
+ if (!(f <= (Float) setting.getMaximumValue()) || !(f >= (Float) setting.getMinimumValue())) break;
+ setting.setValue(f);
+ break;
+ case DOUBLE:
+ double d = Double.parseDouble(split[1]);
+ if (!(d <= (Double)setting.getMaximumValue()) || !(d >= (Double)setting.getMinimumValue())) break;
+ setting.setValue(d);
+ break;
+ case ARRAYLIST:
+ ArrayList strList = new ArrayList<>(Arrays.asList(split[1].replaceAll("\\[", "").replaceAll("]", "").replaceAll(" ", "").split(",")));
+ List listOfInteger = strList.stream().map(Integer::parseInt).collect(Collectors.toList());
+ setting.setValue(listOfInteger);
+ break;
+ case STRING_ARRAY:
+ boolean bl = false;
+ for (String value : setting.getAcceptedStringValues()) {
+ if (!value.equalsIgnoreCase(split[1])) continue;
+ bl = true;
+ }
+ if (!bl) break;
+ setting.setValue(split[1]);
+ break;
+ case STRING:
+ if (setting.getSettingName().equalsIgnoreCase("label")) break;
+
+ if (setting == CheatBreaker.getInstance().getModuleManager().toggleSprintMod.flyBoostString) {
+ split[1] = split[1].replaceAll("%FPS%", "%BOOST%");
+ }
+
+ setting.setValue(split[1].replaceAll("&([abcdefghijklmrABCDEFGHIJKLMNR0-9])|(&$)", "§$1"));
+ }
+ continue block34;
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ if (setting != CheatBreaker.getInstance().getModuleManager().keystrokesMod.boxSize) continue;
+ CheatBreaker.getInstance().getModuleManager().keystrokesMod.updateKeyElements();
+ Minecraft.getMinecraft().ingameGUI.getChatGUI().clearChatMessages();
+ }
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ bufferedReader.close();
+ } catch (IOException iOException) {
+ iOException.printStackTrace();
+ }
+ this.updateProfile(string);
+ }
+
+ /**
+ * Reads the global settings configuration file.
+ */
+ public void readGlobalConfiguration(File file) {
+ if (!file.exists()) {
+ this.updateGlobalConfiguration(file);
+ return;
+ }
+ try {
+ String string;
+ BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
+ block21: while ((string = bufferedReader.readLine()) != null) {
+ try {
+ File profileFile;
+ String[] arrString;
+ if (string.startsWith("#") || string.length() == 0 || (arrString = string.split("=", 2)).length != 2) continue;
+
+ if (arrString[0].equalsIgnoreCase("FavoriteColors")) {
+ String[] declaration = arrString[1].split(",");
+ for (String object2 : declaration) {
+ try {
+ CheatBreaker.getInstance().getGlobalSettings().favouriteColors.add(new ColorPickerColorElement(1.0f, Integer.parseInt(object2), 1.0f));
+ } catch (NumberFormatException numberFormatException) {
+ numberFormatException.printStackTrace();
+ }
+ }
+ continue;
+ }
+
+ if (arrString[0].equalsIgnoreCase("FavoriteStations")) {
+ String[] declaration = arrString[1].split(",");
+ for (String object2 : declaration) {
+ try {
+ for (Station station : CheatBreaker.getInstance().getDashManager().getStations()) {
+ if (!station.getName().equalsIgnoreCase(object2)) continue;
+ station.setFavourite(true);
+ }
+ } catch (NumberFormatException numberFormatException) {
+ numberFormatException.printStackTrace();
+ }
+ }
+ continue;
+ }
+ if (arrString[0].equalsIgnoreCase("XrayBlocks")) {
+ CheatBreaker.getInstance().getModuleManager().xray.getBlocks().clear();
+ String[] declaration = arrString[1].split(",");
+ for (String object2 : declaration) {
+ try {
+ CheatBreaker.getInstance().getModuleManager().xray.getBlocks().add(Integer.parseInt(object2));
+ } catch (NumberFormatException numberFormatException) {
+ numberFormatException.printStackTrace();
+ }
+ }
+ continue;
+ }
+
+ if (arrString[0].startsWith("key_")) {
+ for (KeyBinding keyBinding : Minecraft.getMinecraft().gameSettings.keyBindings) {
+ if (!keyBinding.isCheatBreakerKeybind || !arrString[0].equalsIgnoreCase("key_" + keyBinding.getKeyDescription())) continue;
+ keyBinding.setKeyCode(Integer.parseInt(arrString[1]));
+ }
+ continue;
+ }
+
+ if (arrString[0].equalsIgnoreCase("ProfileIndexes")) {
+ String[] declaration = arrString[1].split("]\\[");
+ for (String object2 : declaration) {
+ object2 = object2.replaceFirst("\\[", "");
+ String[] arrstring2 = object2.split(",", 2);
+ try {
+ int n = Integer.parseInt(arrstring2[1]);
+ for (Profile profile : this.moduleProfiles) {
+ if (n == 0 || !profile.getName().equalsIgnoreCase(arrstring2[0])) continue;
+ profile.index = n;
+ }
+ } catch (NumberFormatException numberFormatException) {
+
+ }
+ }
+ continue;
+ }
+ if (arrString[0].equalsIgnoreCase("ActiveProfile")) {
+ profileFile = null;
+ File file2 = new File(this.configDir + File.separator + "profiles");
+ if (file2.exists() || file2.mkdirs()) {
+ profileFile = new File(file2 + File.separator + arrString[1] + ".cfg");
+ }
+ if (profileFile == null || !profileFile.exists()) continue;
+ Profile object3 = null;
+ for (Profile object2 : this.moduleProfiles) {
+ if (!arrString[1].equalsIgnoreCase(object2.getName())) continue;
+ object3 = object2;
+ }
+ if (object3 == null || object3.getName().equalsIgnoreCase("default")) continue;
+ this.activeProfile = object3;
+ continue;
+ }
+ for (Setting setting : CheatBreaker.getInstance().getGlobalSettings().settingsList) {
+ if (setting.getSettingName().equalsIgnoreCase("label") || !setting.getSettingName().equalsIgnoreCase(arrString[0])) continue;
+ try {
+ switch (setting.getType()) {
+ case BOOLEAN:
+ setting.setValue(Boolean.parseBoolean(arrString[1]));
+ break;
+ case INTEGER:
+ if (arrString[1].contains("rainbow")) {
+ String[] arrstring3 = arrString[1].split(";");
+ int n = Integer.parseInt(arrstring3[0]);
+ setting.rainbow = true;
+ if (n > (Integer)setting.getMaximumValue() || n < (Integer)setting.getMinimumValue()) continue block21;
+ setting.setValue(n);
+ break;
+ }
+ int n = Integer.parseInt(arrString[1]);
+ setting.rainbow = false;
+ if (n > (Integer)setting.getMaximumValue() || n < (Integer)setting.getMinimumValue()) continue block21;
+ setting.setValue(n);
+ break;
+ case FLOAT:
+ float f = Float.parseFloat(arrString[1]);
+ if (!(f <= (Float) setting.getMaximumValue()) || !(f >= (Float) setting.getMinimumValue())) break;
+ setting.setValue(f);
+ break;
+ case DOUBLE:
+ double d = Double.parseDouble(arrString[1]);
+ if (!(d <= (Double)setting.getMaximumValue()) || !(d >= (Double)setting.getMinimumValue())) break;
+ setting.setValue(d);
+ break;
+ case ARRAYLIST:
+ ArrayList strList = new ArrayList<>(Arrays.asList(arrString[1].split(",")));
+ List listOfInteger = strList.stream().map(Integer::parseInt).collect(Collectors.toList());
+ setting.setValue(listOfInteger);
+ break;
+ case STRING_ARRAY:
+ boolean bl = false;
+ for (String acceptedValue : setting.getAcceptedStringValues()) {
+ if (!acceptedValue.equalsIgnoreCase(arrString[1])) continue;
+ bl = true;
+ }
+ if (!bl) break;
+ setting.setValue(arrString[1]);
+ }
+ continue block21;
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ bufferedReader.close();
+ } catch (IOException iOException) {
+ iOException.printStackTrace();
+ }
+ this.updateGlobalConfiguration(file);
+ }
+
+ /**
+ * Writes to the global configuration file.
+ */
+ public void updateGlobalConfiguration(File file) {
+ try {
+ BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));
+ bufferedWriter.write("################################");
+ bufferedWriter.newLine();
+ bufferedWriter.write("# MC_Client: GLOBAL SETTINGS");
+ bufferedWriter.newLine();
+ bufferedWriter.write("################################");
+ bufferedWriter.newLine();
+ bufferedWriter.newLine();
+ if (this.activeProfile != null && !this.activeProfile.getName().equals("default")) {
+ bufferedWriter.write("ActiveProfile=" + this.activeProfile.getName());
+ bufferedWriter.newLine();
+ }
+ for (Setting setting : CheatBreaker.getInstance().getGlobalSettings().settingsList) {
+ if (setting.getSettingName().equalsIgnoreCase("label")) continue;
+ if (setting.rainbow) {
+ bufferedWriter.write(setting.getSettingName() + "=" + setting.getValue() + ";rainbow");
+ } else {
+ bufferedWriter.write(setting.getSettingName() + "=" + setting.getValue());
+ }
+ bufferedWriter.newLine();
+ }
+ for (KeyBinding keyBind : Minecraft.getMinecraft().gameSettings.keyBindings) {
+ if (!(keyBind.isCheatBreakerKeybind)) continue;
+ bufferedWriter.write("key_" + keyBind.getKeyDescription() + "=" + keyBind.getKeyCode());
+ bufferedWriter.newLine();
+ }
+ String object3 = "";
+ for (ColorPickerColorElement colorPickerColorElement : CheatBreaker.getInstance().getGlobalSettings().favouriteColors) {
+ object3 = object3 + colorPickerColorElement.color + (CheatBreaker.getInstance().getGlobalSettings().favouriteColors.indexOf(colorPickerColorElement) == CheatBreaker.getInstance().getGlobalSettings().favouriteColors.size() - 1 ? "" : ",");
+ }
+ if (!object3.equals("")) {
+ bufferedWriter.write("FavoriteColors=" + object3);
+ bufferedWriter.newLine();
+ }
+ StringBuilder stations = new StringBuilder();
+ for (Station station : CheatBreaker.getInstance().getDashManager().getStations()) {
+ if (!station.isFavourite()) continue;
+ if (stations.length() != 0) {
+ stations.append(",");
+ }
+ stations.append(station.getName());
+ }
+ if (!stations.toString().equals("")) {
+ bufferedWriter.write("FavoriteStations=" + stations);
+ bufferedWriter.newLine();
+ }
+ StringBuilder selectedXRayBlocks = new StringBuilder();
+ for (int blocks : CheatBreaker.getInstance().getModuleManager().xray.getBlocks()) {
+ if (selectedXRayBlocks.length() != 0) {
+ selectedXRayBlocks.append(",");
+ }
+ selectedXRayBlocks.append(blocks);
+ }
+ bufferedWriter.write("XrayBlocks=" + selectedXRayBlocks);
+ bufferedWriter.newLine();
+ bufferedWriter.write("ProfileIndexes=");
+ for (Profile profile : this.moduleProfiles) {
+ bufferedWriter.write("[" + profile.getName() + "," + profile.index + "]");
+ }
+ bufferedWriter.newLine();
+ bufferedWriter.close();
+ } catch (IOException iOException) {
+ iOException.printStackTrace();
+ }
+ }
+
+ /**
+ * Reads the muted configuration file.
+ * This is used for the Voice Chat integration.
+ */
+ public void readMutesConfiguration(File file) {
+ try {
+ String string;
+ if (!file.exists()) {
+ this.updateMutesConfiguration(file);
+ return;
+ }
+ BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
+ while ((string = bufferedReader.readLine()) != null) {
+ try {
+ UUID uUID = UUID.fromString(string);
+ CheatBreaker.getInstance().getCBNetHandler().getPlayersInVoiceChannel().add(uUID);
+ } catch (Exception ignored) {
+ }
+ }
+ } catch (IOException ignored) {
+
+ }
+ }
+
+ /**
+ * Writes to the muted configuration file.
+ * This is used for the Voice Chat integration.
+ */
+ public void updateMutesConfiguration(File file) {
+ try {
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+ BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));
+ for (UUID uUID : CheatBreaker.getInstance().getCBNetHandler().getPlayersInVoiceChannel()) {
+ bufferedWriter.write(uUID.toString());
+ bufferedWriter.newLine();
+ }
+ bufferedWriter.close();
+ } catch (IOException ignored) {
+
+ }
+ }
+
+ /**
+ * Reads the muted configuration file.
+ * This is used for the Voice Chat integration.
+ */
+ public void updateProfile(String profileName) {
+ if (profileName.equalsIgnoreCase("default")) {
+ return;
+ }
+ File file = new File(this.configDir + File.separator + "profiles");
+ File file2 = file.exists() || file.mkdirs() ? new File(file + File.separator + profileName + ".cfg") : null;
+ ArrayList modules = new ArrayList<>();
+ modules.addAll(CheatBreaker.getInstance().getModuleManager().playerMods);
+ modules.addAll(CheatBreaker.getInstance().getModuleManager().staffMods);
+ try {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(file2));
+ writer.write("################################");
+ writer.newLine();
+ writer.write("# MC_Client: MODULE SETTINGS");
+ writer.newLine();
+ writer.write("################################");
+ writer.newLine();
+ writer.newLine();
+ for (AbstractModule module : modules) {
+ writer.write("[" + module.getName() + "]");
+ writer.newLine();
+ writer.write("-State=" + module.isEnabled());
+ writer.newLine();
+ writer.write("-WasRenderHUD=" + module.isWasRenderHud());
+ writer.newLine();
+ if (module.getGuiAnchor() != null) {
+ writer.write("-Position=" + module.getGuiAnchor().getLabel());
+ writer.newLine();
+ }
+ writer.write("-xTranslation=" + module.getXTranslation());
+ writer.newLine();
+ writer.write("-yTranslation=" + module.getYTranslation());
+ writer.newLine();
+ writer.write("-RenderHUD=" + module.isRenderHud());
+ writer.newLine();
+ for (Setting setting : module.getSettingsList()) {
+ if (setting == CheatBreaker.getInstance().getModuleManager().coordinatesMod.customLine) {
+ writer.write("# Customize your HUD info display string.");
+ writer.newLine();
+ writer.write("# (& color formatting is allowed)");
+ writer.newLine();
+ writer.write("# Optional uses:");
+ writer.newLine();
+ writer.write("# %FPS% - Display current FPS.");
+ writer.newLine();
+ writer.write("# %DIR% - Display current look direction.");
+ writer.newLine();
+ writer.write("# %CPS% - Display CPS.");
+ writer.newLine();
+ writer.write("# %COORDS% - Display coordinates.");
+ writer.newLine();
+ writer.write("# %IP% - Current server IP.");
+ writer.newLine();
+ writer.write("# %X% - Your X location.");
+ writer.newLine();
+ writer.write("# %Y% - Your (foot) Y location.");
+ writer.newLine();
+ writer.write("# %Z% - Your Z location.");
+ writer.newLine();
+ writer.write("# %NL% - Break into a new line.");
+ writer.newLine();
+ }
+ if (setting.getSettingName().equalsIgnoreCase("label")) continue;
+ if (setting.getType() == SettingType.STRING && setting.getSettingName().startsWith("Hot key")) {
+ writer.write(setting.getSettingName() + "=" + (setting.getValue() + (setting.isHasKeycode() ? ";keycode:" + setting.getKeyCode() : "") + (setting.isHasMouseBind() ? ";mouse:" + setting.isHasMouseBind() : "")).replaceAll("§", "&"));
+ } else if (setting.getType() == SettingType.INTEGER && setting.getSettingName().endsWith("Keybind") && setting.getSettingName().contains("Toggle")) {
+ writer.write(setting.getSettingName() + "=" + setting.getValue() + (setting.isHasMouseBind() ? ";mouse:" + setting.isHasMouseBind() : ""));
+ } else if (setting.rainbow) {
+ writer.write(setting.getSettingName() + "=" + setting.getValue() + ";rainbow");
+ } else {
+ writer.write(setting.getSettingName() + "=" + setting.getValue());
+ }
+ writer.newLine();
+ }
+ writer.newLine();
+ }
+ writer.close();
+ } catch (IOException iOException) {
+ iOException.printStackTrace();
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/GlobalSettings.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/GlobalSettings.java
new file mode 100644
index 0000000..332a9e0
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/GlobalSettings.java
@@ -0,0 +1,441 @@
+package com.cheatbreaker.client.config;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.audio.music.util.DashUtil;
+import com.cheatbreaker.client.module.data.CustomizationLevel;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.ui.element.module.ModuleListElement;
+import com.cheatbreaker.client.ui.element.type.ColorPickerColorElement;
+import com.cheatbreaker.client.ui.mainmenu.MainMenuBase;
+import com.cheatbreaker.client.ui.module.HudLayoutEditorGui;
+import com.cheatbreaker.client.util.render.serverlist.UnsafeServerAction;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.GameSettings;
+import net.minecraft.client.settings.KeyBinding;
+import org.apache.commons.lang3.ArrayUtils;
+import org.lwjgl.input.Keyboard;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class GlobalSettings {
+ public KeyBinding keyBindOpenMenu;
+ public KeyBinding keyBindDragToLook;
+ public KeyBinding keyBindBackLook;
+ public KeyBinding keyBindFrontLook;
+ public KeyBinding keyBindEmote;
+
+ public final List settingsList = new ArrayList<>();
+ @Getter private final List pinnedServers = new ArrayList<>();
+ @Getter private final List unsafeServers = new ArrayList<>();
+
+ public boolean isDebug = false;
+ public boolean SHOW_MODIFIERS = true;
+
+ public int sessionCheckInteral = 60;
+
+ public String webapiCrashReportUpload = "http://server.noxiuam.gq/crashReport";
+ public String webapiDebugUpload = "http://moosecbapi.000webhostapp.com/debug-upload.php";
+ public String mojangStatusURL = "https://mojan.ga/api/check";
+
+ // private final Setting debugSettingsLabel;
+// public Setting showDebugOutput;
+ private final Setting audioSettingsLabel;
+ // public Setting microphone;
+ public Setting radioVolume;
+ // public Setting microphoneVolume;
+// public Setting speakerVolume;
+ public Setting pinRadio;
+ public Setting muteCBSounds;
+
+ private final Setting fpsBoostSettingsLabel;
+ public Setting enableFpsBoost;
+ public Setting slowChunkLoading;
+ public Setting fullBright;
+ public Setting entityShadows;
+ public Setting hideGroundedArrows;
+ public Setting hideStuckArrows;
+ public Setting hideFoliage;
+ public Setting hideMovingArrows;
+ public Setting hidePlacedSkulls;
+
+ private final Setting fpsLimitSettingsLabel;
+ public Setting useCustomFPSLimiter;
+ public Setting customFPSLimit;
+ public Setting limitWhenUnfocused;
+ public Setting unfocusedFPS;
+ // public Setting limitWhenInactive;
+// public Setting inactiveFPS;
+ public Setting mainMenuFPS;
+
+ private final Setting teamViewLabel;
+ public Setting enableTeamView;
+ public Setting showDistance;
+ public Setting showOffScreenMarker;
+
+// private final Setting generalSettingsLabel;
+ public Setting compactMode;
+ public static Setting darkMode;
+ // public Setting lookView;
+ public Setting customizationLevel;
+
+ private final Setting displaySettingsLabel;
+ public Setting borderlessFullscreen;
+ public Setting unfullscreenWhenUnfocused;
+
+ private final Setting hudEditorSettingsLabel;
+ public Setting snapModules;
+ public Setting snappingStrength;
+ public Setting showModName;
+// public Setting useBackgroundOverlay;
+
+ private final Setting moduleCommandSettingsLabel;
+ public Setting enableModuleCommands;
+ public Setting hideCallbackMessages;
+
+ private final Setting renderSettingsLabel;
+ public Setting showHudInDebug;
+ public Setting showPotionInfo;
+ public Setting showServerBasedHitCooldowns;
+ public Setting achievements;
+ public Setting guiBlur;
+ public Setting containerBackground;
+ public Setting shiftPotionInfo;
+
+ private final Setting streamerModeSettingsLabel;
+ public Setting streamerMode;
+ public Setting disableModMenuKeybind;
+ public Setting notifyWhenModMenuKeybindPressed;
+ public Setting holdDownModsGameMenuButton;
+ public Setting holdDuration;
+
+ private final Setting packSettingsLabel;
+ public Setting packMenu;
+ public Setting widePackMenu;
+ public Setting transparentBackground;
+ public Setting packFolderInfo;
+ public Setting packFolderIcons;
+ public Setting packIcons;
+ public Setting packDescriptions;
+ public Setting packSearchBar;
+ public Setting packSortMethod;
+ public Setting packSmoothScrolling;
+ public Setting packListBackgroundColor;
+
+ private final Setting scalingSettingsLabel;
+ public Setting guiScale;
+ public Setting globalGuiScale;
+ public Setting scaleModsDownSmallerResoltion;
+
+ private final Setting screenshotSettingsLabel;
+ public Setting shutterSound;
+ public Setting sendScreenshotMessage;
+ public Setting compactOptions;
+ public Setting copyAutomatically;
+ public Setting openOption;
+ public Setting copyOption;
+ public Setting uploadOption;
+
+ private final Setting keybindHandlingSettingsLabel;
+ public Setting keybindFix;
+ public Setting excludeSneakKeybind;
+ public Setting excludeThrowKeybind;
+
+ private final Setting cosmeticSettingsLabel;
+ public Setting showOptifineCapes;
+ public Setting showOptifineHats;
+ public Setting showCheatBreakerCapes;
+ public Setting showCheatBreakerWings;
+
+ private final Setting rpcSettings;
+ public Setting showRPC;
+ public Setting showServer;
+ public Setting showAccount;
+
+
+ private final Setting colorSettingsLabel;
+ public Setting resetColors;
+ public Setting defaultColor;
+ public Setting emoteRadialColor;
+ @Getter @Setter
+ private Setting currentMenuSetting;
+
+ public List favouriteColors = new ArrayList<>();
+ public List recentColors = new ArrayList<>();
+
+ /**
+ * Sets up all the global settings
+ */
+ public GlobalSettings() {
+ CheatBreaker.getInstance().logger.info(CheatBreaker.getInstance().loggerPrefix + "Created settings");
+
+// String[] microphones = CheatBreaker.getInstance().getAudioManager().getMicrophoneArray();
+// StringBuilder availableMicrophones = new StringBuilder();
+// for (String microphone : microphones) {
+// availableMicrophones.append("\n- ").append(microphone);
+// }
+// this.debugSettingsLabel = new Setting(this.settingsList, "label").setValue("Debug Settings");
+// this.showDebugOutput = new Setting(this.settingsList, "Show Debug Output", "Show any debug information.").setValue(false);
+ this.audioSettingsLabel = new Setting(this.settingsList, "label").setValue("Audio Settings");
+// this.microphone = microphones.length > 0 ? new Setting(this.settingsList, "Microphone", "Change the microphone for voice chat." +
+// "\n" +
+// "\nAvailable microphones:" + availableMicrophones).setValue(microphones[0]).acceptedValues(microphones).onChange(var0 -> {
+// try {
+// System.out.println("[CB] Updated audio device!");
+// Message.h(CheatBreaker.getInstance().getAudioManager().getMicrophone((String)var0));
+// } catch (UnsatisfiedLinkError ignored) {}
+// }) : new Setting(this.settingsList, "Microphone", "Change the microphone for voice chat (none detected).").setValue("Unknown").acceptedValue("Unknown").onChange(var0 -> {
+// try {
+// System.out.println("[CB] Updated audio device!");
+// Message.h(CheatBreaker.getInstance().getAudioManager().getMicrophone((String)var0));
+// } catch (UnsatisfiedLinkError ignored) {}
+// });
+ this.muteCBSounds = new Setting(this.settingsList, "Mute CheatBreaker sounds", "Mute notification sounds generated from CheatBreaker.").setValue(false);
+ this.pinRadio = new Setting(this.settingsList, "Pin Radio Player", "Pin the radio to the HUD.").setValue(false);
+ this.radioVolume = new Setting(this.settingsList, "Radio Volume", "Adjusts the volume of the Dash Radio.").onChange(value -> {
+ if (DashUtil.isActive()) {
+ DashUtil.getPlayer().setFloatControlValue(Float.parseFloat(value.toString()));
+ }
+ }).setValue(85).setMinMax(0, 100).setUnit("%").setCenterLabel("MEDIUM");
+// this.microphoneVolume = new Setting(this.settingsList, "Microphone Volume", "Adjust the input Microphone volume.").onChange(volume -> {
+// try {
+// Message.l(Float.parseFloat(volume.toString()));
+// } catch (UnsatisfiedLinkError ignored) {}
+// }).setValue(70.0F).setMinMax(0.0F, 100.0F).setUnit("%").setCenterLabel("MEDIUM");
+// this.speakerVolume = new Setting(this.settingsList, "Speaker Volume", "Adjust the speaker volume for voice chat.").onChange(var0 -> {
+// try {
+// float volume = 20000.0f / (float)(20000.0F - Math.max(0.0F, Math.min(19500.0F, (Float)var0 * 195.0F)));
+// Message.m(volume);
+// } catch (UnsatisfiedLinkError ignored) {}
+// }).setValue(85.0F).setMinMax(0.0F, 100.0F).setUnit("%").setCenterLabel("MEDIUM");
+
+ this.fpsBoostSettingsLabel = new Setting(this.settingsList, "label").setValue("FPS Boost");
+ this.enableFpsBoost = new Setting(this.settingsList, "Enable FPS Boost", "Enables all FPS boost settings in this category.").setValue(true);
+// this.slowChunkLoading = new Setting(this.settingsList, "Slow chunk loading", "Determines how fast chunks should load as a percentage." +
+// "\n§e§oHigher values may increase performance!" +
+// "\n§6§oHigher values will make chunks load slower." +
+// "\n" +
+// "\n§276% - 100%:§r Slowest chunk loading speed (Higher FPS)." +
+// "\n§a51% - 75%:§r Slow chunk loading speed (High FPS)." +
+// "\n§e50%:§r Medium chunk loading speed (Medium FPS)." +
+// "\n§626% - 49%:§r Fast chunk loading speed (Low FPS)." +
+// "\n§c0.1% - 25%:§r Faster chunk loading speed (Lower FPS)." +
+// "\n§b0%:§r Vanilla chunk loading speed (Lowest FPS).").setMinMax(0.0f, 100.0f).setValue(70.0f).setUnit("%").setCenterLabel("MEDIUM").setIcons("fps-inverse-52", "fps-52").setCondition(() -> (Boolean) this.enableFpsBoost.getValue());
+ this.fullBright = new Setting(this.settingsList, "Fullbright", "Set the brightness/gamma to the max.").setValue(true).setCondition(() -> (Boolean) this.enableFpsBoost.getValue()).onChange(value -> {
+
+ float gamma = Minecraft.getMinecraft().gameSettings.gammaSetting;
+ if (gamma != 1000F) {
+ if (Minecraft.getMinecraft().gameSettings.oldGammaSetting < 1F)
+ gamma = 1F;
+
+ Minecraft.getMinecraft().gameSettings.oldGammaSetting = gamma;
+ Minecraft.getMinecraft().gameSettings.saveOptions();
+ }
+
+ Minecraft.getMinecraft().gameSettings.gammaSetting =
+ (fullBright.getBooleanValue() ? 1000F : Minecraft.getMinecraft().gameSettings.oldGammaSetting);
+
+ });
+ this.entityShadows = new Setting(this.settingsList, "Entity Shadows", "Draws a shadow below entities.").setValue(true).onChange(value -> Minecraft.getMinecraft().getRenderManager().options.entityShadows = Boolean.parseBoolean(value.toString()));
+ this.hideGroundedArrows = new Setting(this.settingsList, "Hide Grounded Arrows").setValue(false);
+ this.hideStuckArrows = new Setting(this.settingsList, "Hide Stuck Arrows").setValue(false);
+ this.hideMovingArrows = new Setting(this.settingsList, "Hide Moving Arrows").setValue(false);
+ this.hideFoliage = new Setting(this.settingsList, "Hide Foliage", "Hides things like tall grass, flowers, and shrubs").setValue(false).onChange(e -> CheatBreaker.getInstance().getMc().renderGlobal.loadRenderers());
+ this.hidePlacedSkulls = new Setting(this.settingsList, "Hide Placed Skulls").setValue(false);
+ this.fpsLimitSettingsLabel = new Setting(this.settingsList, "label").setValue("FPS Limiting Settings");
+ this.useCustomFPSLimiter = new Setting(this.settingsList, "Use Custom FPS Limiter", "Overrides the default FPS limiter with a custom one." +
+ "\n§e§oWill not override when VSync is enabled.").setValue(false);
+ this.limitWhenUnfocused = new Setting(this.settingsList, "Limit When Game is Unfocused", "Limits the FPS when you are not interacting with the game.").setValue(false);
+ this.customFPSLimit = new Setting(this.settingsList, "Maximum FPS").setMinMax(5, 1000).setValue(390).setUnit(" FPS").setIcons("fps-inverse-52", "fps-52").setCondition(() -> (Boolean) this.useCustomFPSLimiter.getValue());
+ this.unfocusedFPS = new Setting(this.settingsList, "Unfocused FPS").setMinMax(1, 390).setValue(60).setUnit(" FPS").setIcons("fps-inverse-52", "fps-52").setCondition(() -> (Boolean) this.limitWhenUnfocused.getValue());
+// this.limitWhenInactive = new Setting(this.settingsList, "Limit When Inactive", "Limits the FPS when your player is focused on the game but is not interacting for a certain period of time.").setValue(false);
+// this.inactiveFPS = new Setting(this.settingsList, "Inactive FPS").setMinMax(15, 390).setValue(60).setUnit(" FPS").setIcons("fps-inverse-52", "fps-52").setCondition(() -> (Boolean) this.limitWhenInactive.getValue());
+ this.mainMenuFPS = new Setting(this.settingsList, "Main Menu FPS").setMinMax(30, 500).setValue(90).setUnit(" FPS").setIcons("fps-inverse-52", "fps-52");
+
+ this.teamViewLabel = new Setting(this.settingsList, "label").setValue("Team View Settings");
+ this.enableTeamView = new Setting(this.settingsList, "Enable Team View", "Enables the Team View.").setValue(true);
+ this.showOffScreenMarker = new Setting(this.settingsList, "Show off-screen marker", "Show a marker above players.").setValue(true).setCondition(() -> (Boolean) this.enableTeamView.getValue());
+ this.showDistance = new Setting(this.settingsList, "Show distance", "Show the distance amount above a your teammates' heads.").setValue(true).setCondition(() -> (Boolean) this.enableTeamView.getValue());
+
+// this.generalSettingsLabel = new Setting(this.settingsList, "label").setValue("General Settings");
+ this.currentMenuSetting = new Setting(this.settingsList, "Current Menu", "Sets which main menu should show." +
+ "\n" +
+ "\n0: 2017" +
+ "\n1: 2018" +
+ "\n2: 2016").setMinMax(0, 2).setValue(1);
+// this.lookView = new Setting(this.settingsList, "Look View").setValue("Third").acceptedStringValues("Third", "Reverse", "First");
+ this.displaySettingsLabel = new Setting(this.settingsList, "label").setValue("Display Settings");
+ this.borderlessFullscreen = new Setting(this.settingsList, "Borderless Fullscreen").setValue(false).onChange(value -> {
+ if (Minecraft.getMinecraft().isFullScreen() && Minecraft.getMinecraft().currentScreen instanceof HudLayoutEditorGui) {
+ Minecraft.getMinecraft().toggleFullscreen();
+ Minecraft.getMinecraft().toggleFullscreen();
+
+ HudLayoutEditorGui hudEditor = new HudLayoutEditorGui();
+ Minecraft.getMinecraft().displayGuiScreen(hudEditor);
+ hudEditor.currentScrollableElement = hudEditor.settingsElement;
+ ((ModuleListElement) HudLayoutEditorGui.instance.settingsElement).isCheatBreakerSettings = true;
+ HudLayoutEditorGui.instance.settingsElement.scrollAmount = CheatBreaker.getInstance().getModuleManager().lastSettingScrollPos;
+ }
+ });
+ this.unfullscreenWhenUnfocused = new Setting(this.settingsList, "Unfullscreen when Unfocused").setValue(false);
+
+ this.hudEditorSettingsLabel = new Setting(this.settingsList, "label").setValue("Hud Editor Settings");
+ this.compactMode = new Setting(this.settingsList, "Mod List").setValue("Normal").acceptedStringValues("Normal", "Compact").setCustomizationLevel(CustomizationLevel.ADVANCED).onChange(value -> {
+ if (Minecraft.getMinecraft().currentScreen instanceof HudLayoutEditorGui) {
+ HudLayoutEditorGui hudEditor = new HudLayoutEditorGui();
+ Minecraft.getMinecraft().displayGuiScreen(hudEditor);
+ hudEditor.currentScrollableElement = hudEditor.modulesElement;
+ }
+ });
+ this.darkMode = new Setting(this.settingsList, "Dark Mode", "Switch between light and dark mode.").setValue(false);
+ this.customizationLevel = new Setting(this.settingsList, "Customization Level").setValue("Simple").acceptedStringValues("Simple", "Medium", "Advanced");
+ this.showModName = new Setting(this.settingsList, "Show Mod Name (GUI)").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM);
+// this.useBackgroundOverlay = new Setting(this.settingsList, "Use Background overlay (GUI)").setValue(false).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.snapModules = new Setting(this.settingsList, "Snap mods to other mods (GUI)").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.snappingStrength = new Setting(this.settingsList, "Snapping Strength").setValue(2.0F).setMinMax(1.0F, 10.0F).setUnit("px").setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.snapModules.getValue());
+
+ this.moduleCommandSettingsLabel = new Setting(this.settingsList, "label").setValue("Mod Command Settings").setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.enableModuleCommands = new Setting(this.settingsList, "Enable Mod Commands").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.hideCallbackMessages = new Setting(this.settingsList, "Hide Callback Messages").setValue(false).setCustomizationLevel(CustomizationLevel.MEDIUM);
+
+ this.renderSettingsLabel = new Setting(this.settingsList, "label").setValue("Render Settings");
+ this.showPotionInfo = new Setting(this.settingsList, "Show Potion info in inventory").setValue(true).setCondition(() -> CheatBreaker.getInstance().getModuleManager().potionEffectsMod.isEnabled());
+ this.shiftPotionInfo = new Setting(this.settingsList, "Potion info shifts inventory", "Choose to make the potion info shift the inventory position.").setValue(false);
+ this.achievements = new Setting(this.settingsList, "Show Achievements").setValue(true);
+ this.showHudInDebug = new Setting(this.settingsList, "Show HUD while in debug view", "Show the CheatBreaker HUD when the debug view is open.").setValue(false);
+ this.guiBlur = new Setting(this.settingsList, "GUI Blur", "Blurs the menus.").onChange(value -> Minecraft.getMinecraft().entityRenderer.loadGuiBlurShader()).setValue(false);
+ this.containerBackground = new Setting(this.settingsList, "Container Background").setValue("CheatBreaker").acceptedStringValues("Vanilla", "CheatBreaker", "None");
+ this.showServerBasedHitCooldowns = new Setting(this.settingsList, "Server Based 1.9 Combat Indicator", "On some servers, a hit cooldown is shown because of the newer versions of the game,\nthis gives you the ability to toggle it.").setValue(true);
+
+ this.streamerModeSettingsLabel = new Setting(this.settingsList, "label").setValue("Streamer Mode Settings");
+ this.streamerMode = new Setting(this.settingsList, "Streamer Mode", "Enables Streamer Mode Features").setValue(false);
+ this.disableModMenuKeybind = new Setting(this.settingsList, "Disable Mod Menu Keybind", "Disables the Mod Menu keybind from opening the Mod Menu when Streamer Mode is enabled.").setValue(true).setCondition(() -> this.streamerMode.getBooleanValue());
+ this.notifyWhenModMenuKeybindPressed = new Setting(this.settingsList, "Notify when pressed", "Notifies when the player presses the Mod Menu keybind while disabled.").setValue(true).setCondition(() -> this.streamerMode.getBooleanValue() && this.disableModMenuKeybind.getBooleanValue());
+ this.holdDownModsGameMenuButton = new Setting(this.settingsList, "Require Mods Button Held in Game Menu", "Requires the mouse to be held for a certain period of time when clicking on Mods.").setValue(true).setCondition(() -> this.streamerMode.getBooleanValue());
+ this.holdDuration = new Setting(this.settingsList, "Hold Duration", "The amount of time the Mods button must be held down before entering the Mod Menu.").setValue(5.0F).setMinMax(1.0F, 10.0F).setUnit("s").setCondition(() -> this.streamerMode.getBooleanValue() && this.holdDownModsGameMenuButton.getBooleanValue());
+
+ this.packSettingsLabel = new Setting(this.settingsList, "label").setValue("Resource Pack Settings").setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.widePackMenu = new Setting(this.settingsList, "Wide Pack Menu").setValue(false).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.transparentBackground = new Setting(this.settingsList, "Transparent background", "Remove the dirt background in the resource pack menu.").setValue(false).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.packFolderInfo = new Setting(this.settingsList, "Show Pack Folder Information", "Show the ").setValue(true).setCustomizationLevel(CustomizationLevel.ADVANCED);
+ this.packFolderIcons = new Setting(this.settingsList, "Show Pack Folder Icons").setValue(true).setCustomizationLevel(CustomizationLevel.ADVANCED);
+ this.packIcons = new Setting(this.settingsList, "Show Pack Icons").setValue(true).setCustomizationLevel(CustomizationLevel.ADVANCED);
+ this.packDescriptions = new Setting(this.settingsList, "Show Pack Descriptions").setValue(true).setCustomizationLevel(CustomizationLevel.ADVANCED);
+ this.packSearchBar = new Setting(this.settingsList, "Show Search Bar").setValue(true).setCustomizationLevel(CustomizationLevel.ADVANCED);
+ this.packSortMethod = new Setting(this.settingsList, "Sort Method", "Sort packs in a specific order." +
+ "\n" +
+ "\n§bA-Z:§r Sort packs alphabetically starting from A to Z." +
+ "\n§bZ-A:§r Sort packs alphabetically in reverse starting from Z to A.").setValue("A-Z").acceptedStringValues("A-Z", "Z-A").setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.packSmoothScrolling = new Setting(this.settingsList, "Smooth Scrolling", "Makes scrolling smooth").setValue(false).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.packListBackgroundColor = new Setting(this.settingsList, "List Background color", "Change the background color in the resource pack lists.").setValue(0x80000000).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.MEDIUM);
+
+ this.keybindHandlingSettingsLabel = new Setting(this.settingsList, "label").setValue("Keybind Handling Settings");
+ this.keybindFix = new Setting(this.settingsList, "Modern Keybind Handling").setValue(true);
+ this.excludeSneakKeybind = new Setting(this.settingsList, "Exclude Sneak Keybind").setValue(true).setCondition(() -> (Boolean) this.keybindFix.getValue());
+ this.excludeThrowKeybind = new Setting(this.settingsList, "Exclude Block/Throw Keybind").setValue(true).setCondition(() -> (Boolean) this.keybindFix.getValue());
+
+ this.scalingSettingsLabel = new Setting(this.settingsList, "label").setValue("Scaling Settings");
+ this.guiScale = new Setting(this.settingsList, "Mod Scale").setValue("Default").acceptedStringValues("Default", "Small", "Normal", "Large", "Auto");
+ this.globalGuiScale = new Setting(this.settingsList, "Mod Scale Multiplier").setValue(1.0F).setMinMax(0.25F, 2.0F).setUnit("x");
+ this.scaleModsDownSmallerResoltion = new Setting(this.settingsList, "Use Legacy Scaling").setValue(false);
+
+ this.screenshotSettingsLabel = new Setting(this.settingsList, "label").setValue("Screenshot Settings").setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.shutterSound = new Setting(this.settingsList, "Make Shutter Sound").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.copyAutomatically = new Setting(this.settingsList, "Copy Screenshot Automatically").setValue(false).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.sendScreenshotMessage = new Setting(this.settingsList, "Send Message").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.compactOptions = new Setting(this.settingsList, "Compact Options").setValue(false).setCustomizationLevel(CustomizationLevel.ADVANCED).setCondition(() -> (Boolean) this.sendScreenshotMessage.getValue());
+ this.openOption = new Setting(this.settingsList, "Show Open Option").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.sendScreenshotMessage.getValue());
+ this.copyOption = new Setting(this.settingsList, "Show Copy Option").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.sendScreenshotMessage.getValue());
+ this.uploadOption = new Setting(this.settingsList, "Show Upload Option").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.sendScreenshotMessage.getValue());
+
+ this.cosmeticSettingsLabel = new Setting(this.settingsList, "label").setValue("Cosmetic Settings");
+ this.showOptifineCapes = new Setting(this.settingsList, "Show OptiFine Capes").setValue(true);
+ this.showOptifineHats = new Setting(this.settingsList, "Show OptiFine Hats").setValue(true);
+ this.showCheatBreakerCapes = new Setting(this.settingsList, "Show CheatBreaker Capes").setValue(true);
+ this.showCheatBreakerWings = new Setting(this.settingsList, "Show CheatBreaker Wings").setValue(true);
+
+ String os = System.getProperty("os.name").toLowerCase();
+ this.rpcSettings = (new Setting(this.settingsList, "label")).setValue("Discord Rich Presence Settings").setCondition(() -> os.contains("win"));
+ this.showRPC = (new Setting(this.settingsList, "Show Discord Rich Presence")).setValue(true).setCondition(() -> os.contains("win")).onChange(value -> {
+ if (os.contains("win") && Minecraft.getMinecraft().currentScreen instanceof HudLayoutEditorGui) {
+ try {
+ if ((Boolean) value) {
+ CheatBreaker.getInstance().connectDiscordIPC();
+ } else {
+ CheatBreaker.getInstance().getRpcClient().close();
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ });
+
+ this.showServer = (new Setting(this.settingsList, "Show Active Server")).setValue(true).setCondition(() -> os.contains("win") && this.showRPC.getBooleanValue()).onChange(value -> this.updateRPC());
+ this.showAccount = (new Setting(this.settingsList, "Show Active Account")).setValue(true).setCondition(() -> os.contains("win") && this.showRPC.getBooleanValue()).onChange(value -> this.updateRPC());
+
+ this.colorSettingsLabel = new Setting(this.settingsList, "label").setValue("Color Settings");
+ this.resetColors = new Setting(this.settingsList, "Apply Default Color When Enabling Mods").setValue(true);
+ this.defaultColor = new Setting(this.settingsList, "Default color", "Change the default color that will be displayed when mods are enabled.").setValue(-1).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE);
+ //this.emoteRadialColor = new Setting(this.settingsList, "Emote Radial color", "Change the color for the highlighted radial in emotes.").setValue(0x8033334D).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ // this.pinnedServers.add(new String[]{"Minemen Club [NA]", "na.minemen.club"});
+ this.pinnedServers.add(new String[]{"Minemen Club [EU]", "eu.minemen.club"});
+ this.unsafeServers.add(new String[]{"warnedserver.us", "This server is a test IP for warned servers", String.valueOf(UnsafeServerAction.WARN)});
+ this.unsafeServers.add(new String[]{"blockedserver.us", "This server is a test IP for blocked servers", String.valueOf(UnsafeServerAction.BLOCK)});
+
+ GameSettings gameSettings = Minecraft.getMinecraft().gameSettings;
+// this.keyBindVoicePushToTalk = new KeyBinding("Voice Chat", 47, "CheatBreaker Client", true);
+ this.keyBindOpenMenu = new KeyBinding("Open Menu", 54, "CheatBreaker Client", true);
+// this.keyBindOpenVoiceMenu = new KeyBinding("Open Voice Menu", 25, "CheatBreaker Client", true);
+ this.keyBindDragToLook = new KeyBinding("Drag to look", 56, "CheatBreaker Client", true);
+ this.keyBindBackLook = new KeyBinding("Back look", 0, "CheatBreaker Client", true);
+ this.keyBindFrontLook = new KeyBinding("Front look", 0, "CheatBreaker Client", true);
+ this.keyBindEmote = new KeyBinding("Emote", Keyboard.KEY_B, "CheatBreaker Client", true);
+ gameSettings.keyBindings = ArrayUtils.addAll(gameSettings.keyBindings, /*this.keyBindVoicePushToTalk, */this.keyBindOpenMenu, /*this.keyBindOpenVoiceMenu, */this.keyBindDragToLook, this.keyBindBackLook, this.keyBindFrontLook, this.keyBindEmote);
+ }
+
+ /**
+ * Gets the current menu the player is in.
+ */
+ public MainMenuBase.MenuTypes getCurrentMenu() {
+ return MainMenuBase.MenuTypes.values()[(int) currentMenuSetting.getValue()];
+ }
+
+ /**
+ * Returns if a color is already a favorite color or not.
+ */
+ public boolean isFavouriteColor(int colorValue) {
+ ColorPickerColorElement var3;
+ Iterator var2 = this.favouriteColors.iterator();
+ do {
+ if (!var2.hasNext()) {
+ return false;
+ }
+ var3 = var2.next();
+ } while (var3.color != colorValue);
+ return true;
+ }
+
+ /**
+ * Removes a favorite color from the player's config.
+ */
+ public void removeFavouriteColor(int colorValue) {
+ this.favouriteColors.removeIf(var1x -> var1x.color == colorValue);
+ }
+
+ /**
+ * Update's the Discord RPC.
+ */
+ private void updateRPC() {
+ try {
+ if (Minecraft.getMinecraft().currentScreen instanceof HudLayoutEditorGui) {
+ String account = this.showAccount.getBooleanValue() ? Minecraft.getMinecraft().getSession().getUsername() : null;
+ CheatBreaker.getInstance().updateServerInfo(account);
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/Profile.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/Profile.java
new file mode 100644
index 0000000..e1859fd
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/config/Profile.java
@@ -0,0 +1,19 @@
+package com.cheatbreaker.client.config;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Defines the module Profile Object.
+ */
+@Getter @Setter
+public class Profile {
+ private String name;
+ private boolean notEditable;
+ public int index = 0;
+
+ public Profile(String name, boolean notEditable) {
+ this.name = name;
+ this.notEditable = notEditable;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/Cosmetic.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/Cosmetic.java
new file mode 100644
index 0000000..84ba2ef
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/Cosmetic.java
@@ -0,0 +1,86 @@
+package com.cheatbreaker.client.cosmetic;
+
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * This defines the CheatBreaker Client's cosmetic Object.
+ */
+@Getter @Setter
+public class Cosmetic {
+ private String playerId;
+ private String name;
+
+ private CosmeticType type;
+
+ private float scale;
+
+ private int emoteId;
+
+ private long lastUpdate;
+
+ private boolean equipped;
+
+ private ResourceLocation location;
+ private ResourceLocation previewLocation;
+
+ /**
+ * This should be used for animated capes.
+ */
+ public Cosmetic(long time, String playerId, String name, CosmeticType type, float scale, boolean equipped, String location) {
+ this.lastUpdate = time;
+ this.playerId = playerId;
+ this.name = name;
+ this.type = type;
+ this.scale = scale;
+ this.equipped = equipped;
+ this.location = new ResourceLocation(location);
+ this.previewLocation = new ResourceLocation("client/preview/" + location.replaceAll("client/", ""));
+ }
+
+ /**
+ * This is the normal capes/wings
+ */
+ public Cosmetic(String playerId, String name, CosmeticType type, float scale, boolean equipped, String location) {
+ this.playerId = playerId;
+ this.name = name;
+ this.type = type;
+ this.scale = scale;
+ this.equipped = equipped;
+ this.location = new ResourceLocation(location);
+ this.previewLocation = new ResourceLocation("client/preview/" + location.replace("client/", ""));
+ }
+
+ /**
+ * This is for emotes, this will be setup at a later time.
+ */
+ public Cosmetic(String playerId, int emoteId, CosmeticType type) {
+ this.playerId = playerId;
+ this.emoteId = emoteId;
+ this.type = type;
+ }
+
+ /**
+ * This defines the type of cosmetic that the player has.
+ */
+ public enum CosmeticType {
+ WINGS("dragon_wings"),
+ CAPE("cape"),
+ EMOTE("emote");
+
+ @Getter private final String typeName;
+ CosmeticType(String typeName) {
+ this.typeName = typeName;
+ }
+
+ public static CosmeticType get(String name) {
+ for (Cosmetic.CosmeticType cosmetic : CosmeticType.values()) {
+ if (cosmetic.getTypeName().equals(name)) {
+ return cosmetic;
+ }
+ }
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/CosmeticManager.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/CosmeticManager.java
new file mode 100644
index 0000000..05e19d8
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/CosmeticManager.java
@@ -0,0 +1,208 @@
+package com.cheatbreaker.client.cosmetic;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.cosmetic.data.AnimationStage;
+import com.cheatbreaker.client.cosmetic.type.emote.*;
+import com.cheatbreaker.client.event.impl.keyboard.KeyboardEvent;
+import com.cheatbreaker.client.event.impl.mouse.ClickStateEvent;
+import com.cheatbreaker.client.event.impl.render.PlayerAnimationEvent;
+import com.cheatbreaker.client.event.impl.tick.TickEvent;
+import com.cheatbreaker.client.network.websocket.shared.WSPacketEmote;
+import com.cheatbreaker.client.ui.cosmetic.EmoteGUI;
+import com.google.common.collect.ImmutableBiMap;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelBiped;
+import net.minecraft.client.model.ModelPlayer;
+import net.minecraft.entity.player.EntityPlayer;
+import org.lwjgl.input.Keyboard;
+
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+
+@Getter
+@Setter
+public class CosmeticManager {
+
+ private final List capes = new ArrayList<>();
+ private final List wings = new ArrayList<>();
+ private final List emotes = new ArrayList<>();
+
+ private final Map activeEmotes = new ConcurrentHashMap<>();
+ private final Map models = new ConcurrentHashMap<>();
+
+ private List ownedEmotes = new ArrayList<>();
+
+ private boolean doingEmote;
+ private boolean sendingEmote;
+ private Emote currentEmote;
+
+ public static final ImmutableBiMap CLIENT_EMOTES = ImmutableBiMap.builder()
+ .put(0, WaveEmote.class)
+ .put(1, HandsUpEmote.class)
+ .put(2, FlossEmote.class)
+ .put(3, DabEmote.class)
+ .put(4, TPoseEmote.class)
+ .put(5, ShrugEmote.class)
+ .put(6, FacepalmEmote.class)
+ .put(7, NarutoRunEmote.class)
+ .put(8, SuperFacepalmEmote.class)
+ .build();
+
+ public CosmeticManager() {
+ ownedEmotes.addAll(new ArrayList<>(emotes));
+ CheatBreaker.getInstance().logger.info(CheatBreaker.getInstance().loggerPrefix + "Created Cosmetic Manager");
+
+ CheatBreaker.getInstance().getEventBus().addEvent(TickEvent.class, this::onTick);
+ CheatBreaker.getInstance().getEventBus().addEvent(PlayerAnimationEvent.class, this::onPlayerAnimation);
+
+ CheatBreaker.getInstance().getEventBus().addEvent(ClickStateEvent.class, (event) -> {
+ if (event.getMouseButton() == 0 && event.isState()) this.stopEmote(Minecraft.getMinecraft().thePlayer);
+ });
+
+ CheatBreaker.getInstance().getEventBus().addEvent(KeyboardEvent.class, (event) -> {
+ if (Minecraft.getMinecraft().currentScreen == null && !this.ownedEmotes.isEmpty()
+ && event.getPressed() == Keyboard.KEY_B) {
+ Minecraft.getMinecraft().displayGuiScreen(new EmoteGUI(event.getPressed()));
+ }
+ });
+ }
+
+ public List getFullCosmeticList() {
+ ArrayList cosmetics = new ArrayList<>();
+
+ // Adds the wings first so that they are at the front of the list always.
+ for (Cosmetic wing : this.wings) {
+ if (!wing.getPlayerId().equals(Minecraft.getMinecraft().getSession().getPlayerID())) continue;
+ cosmetics.add(wing);
+ }
+
+ for (Cosmetic cape : this.capes) {
+ if (!cape.getPlayerId().equals(Minecraft.getMinecraft().getSession().getPlayerID())) continue;
+ cosmetics.add(cape);
+ }
+
+ return cosmetics;
+ }
+
+ public Cosmetic getActiveCape(UUID uuid) {
+ for (Cosmetic cape : this.getCapes()) {
+ if (cape.isEquipped() && uuid.toString().equals(cape.getPlayerId())) {
+ return cape;
+ }
+ }
+ return null;
+ }
+
+ public Cosmetic getActiveWings(UUID uuid) {
+ for (Cosmetic wing : this.getWings()) {
+ if (wing.isEquipped() && uuid.toString().equals(wing.getPlayerId())) {
+ return wing;
+ }
+ }
+ return null;
+ }
+
+ public void clearCosmetics(String uuid) {
+ this.getCapes().removeIf(cape -> cape.getPlayerId().equals(uuid));
+ this.getWings().removeIf(wings -> wings.getPlayerId().equals(uuid));
+ }
+
+ public void playEmote(Emote emote) {
+ if (this.hasEmote(emote)) {
+ if (this.doingEmote) {
+ this.doingEmote = false;
+ this.sendingEmote = true;
+ }
+
+ currentEmote = emote;
+ this.stopEmote(Minecraft.getMinecraft().thePlayer);
+ int emoteId = (Integer) CLIENT_EMOTES.inverse().get(emote.getClass());
+ CheatBreaker.getInstance().getWsNetHandler().sendPacket(
+ new WSPacketEmote(Minecraft.getMinecraft().thePlayer.getUniqueID(), emoteId));
+ }
+ }
+
+ private boolean hasEmote(Emote var1) {
+ return this.emotes.contains(CLIENT_EMOTES.inverse().get(var1));
+ }
+
+ public Emote getEmoteById(int var1) {
+ if (!CLIENT_EMOTES.containsKey(var1)) {
+ return null;
+ } else {
+ try {
+ return (Emote) ((Class) CLIENT_EMOTES.get(var1)).newInstance();
+ } catch (Exception var3) {
+ var3.printStackTrace();
+ return null;
+ }
+ }
+ }
+
+ public void playEmote(AbstractClientPlayer player, Emote var2) {
+ if (player.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) {
+ if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 || this.sendingEmote) {
+ Minecraft.getMinecraft().gameSettings.thirdPersonView = 1;
+ this.doingEmote = true;
+ }
+
+ this.sendingEmote = false;
+ }
+
+ currentEmote = var2;
+ this.activeEmotes.putIfAbsent(player.getUniqueID(), var2);
+ }
+
+ public void stopEmote(AbstractClientPlayer var1) {
+ if (this.activeEmotes.containsKey(var1.getUniqueID())) {
+ currentEmote = null;
+ Emote var2 = this.activeEmotes.get(var1.getUniqueID());
+ var2.endEmote(var1);
+ this.activeEmotes.remove(var1.getUniqueID());
+ }
+ }
+
+ private void onTick(TickEvent event) {
+ if (!this.activeEmotes.isEmpty()) {
+ ArrayList list = new ArrayList<>();
+ this.activeEmotes.forEach((uuid, emote) -> {
+ if (Minecraft.getMinecraft().theWorld != null) {
+ EntityPlayer var3 = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(uuid);
+ if (emote.isEmoteOver()) {
+ currentEmote = null;
+ activeEmotes.remove(var3.getUniqueID());
+ emote.endEmote((AbstractClientPlayer) var3);
+ ModelPlayer modelPlayer = this.getModels().get(uuid);
+ if (modelPlayer == null || modelPlayer.bipedCape == null)
+ return;
+
+ modelPlayer.bipedCape.rotateAngleZ = 0;
+ this.getModels().remove(uuid);
+ list.add(uuid);
+ }
+ }
+ });
+ list.forEach(this.activeEmotes::remove);
+ }
+ }
+
+ private void onPlayerAnimation(PlayerAnimationEvent event) {
+ Emote activeEmotes = this.activeEmotes.get(event.getPlayer().getUniqueID());
+ if (activeEmotes != null) {
+ if (event.getStage() == AnimationStage.START) {
+ activeEmotes.playEmote(event.getPlayer(), event.getModel(), event.getPartialTicks());
+ } else {
+ activeEmotes.tickEmote(event.getPlayer(), event.getPartialTicks());
+ }
+ }
+ }
+
+ public List getOwnedEmotes() {
+ return ownedEmotes;
+ }
+
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/Emote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/Emote.java
new file mode 100644
index 0000000..e3d6e74
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/Emote.java
@@ -0,0 +1,47 @@
+package com.cheatbreaker.client.cosmetic;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.ui.fading.AbstractFade;
+import lombok.Getter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+import net.minecraft.util.ResourceLocation;
+
+import java.util.UUID;
+
+@Getter
+public abstract class Emote {
+ private final String name;
+ protected final AbstractFade duration;
+ private final ResourceLocation resourceLocation;
+
+ public Emote(String name, AbstractFade duration) {
+ this.duration = duration;
+ duration.startAnimation();
+ this.name = name;
+ this.resourceLocation = new ResourceLocation("client/emote/" + name.toLowerCase().replace("-", "").replace(" ", "") + ".png");
+ }
+
+ public abstract void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks);
+
+ public abstract void tickEmote(AbstractClientPlayer player, float partialTicks);
+
+ protected void endEmote(AbstractClientPlayer abstractClientPlayer) {
+ if (abstractClientPlayer == null) {
+ return;
+ }
+
+ if (abstractClientPlayer.getUniqueID().equals(UUID.fromString(Minecraft.getMinecraft().getSession().getPlayerID()))) {
+ if (CheatBreaker.getInstance().getCosmeticManager().isDoingEmote()) {
+ Minecraft.getMinecraft().gameSettings.thirdPersonView = 0;
+ CheatBreaker.getInstance().getCosmeticManager().setDoingEmote(false);
+ CheatBreaker.getInstance().getCosmeticManager().setSendingEmote(false);
+ }
+ }
+ }
+
+ public boolean isEmoteOver() {
+ return this.duration.isOver();
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/data/AnimationStage.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/data/AnimationStage.java
new file mode 100644
index 0000000..b99f7f0
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/data/AnimationStage.java
@@ -0,0 +1,9 @@
+package com.cheatbreaker.client.cosmetic.data;
+
+/**
+ * These are used for the PlayerAnimationEvent
+ */
+public enum AnimationStage {
+ START,
+ END
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/profile/ClientProfile.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/profile/ClientProfile.java
new file mode 100644
index 0000000..aec851b
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/profile/ClientProfile.java
@@ -0,0 +1,15 @@
+package com.cheatbreaker.client.cosmetic.profile;
+
+import lombok.*;
+
+/**
+ * Defines the CheatBreaker Client's player profile.
+ * This is currently only used for Player Icons, however will probably be used for more later.
+ */
+@Getter
+@AllArgsConstructor
+public class ClientProfile {
+ @Setter private String username;
+ private int color;
+ private int color2;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/profile/ProfileHandler.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/profile/ProfileHandler.java
new file mode 100644
index 0000000..0c0a4ac
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/profile/ProfileHandler.java
@@ -0,0 +1,62 @@
+package com.cheatbreaker.client.cosmetic.profile;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.module.impl.normal.hypixel.ModuleNickHider;
+import lombok.Getter;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Handles everything to do with ClientProfiles.
+ */
+public class ProfileHandler {
+ @Getter private final Map wsOnlineUsers = new HashMap<>();
+
+ /**
+ * Returns a ClientProfile based on a player's UUID.
+ */
+ public ClientProfile getProfile(String playerId) {
+ return this.getWsOnlineUsers().get(UUID.fromString(playerId));
+ }
+
+ /**
+ * Returns a dashed UUID since 1.7 is weird as fuck.
+ */
+ public String recompileUUID(String uuidIn) {
+ return UUID.fromString(uuidIn.replaceFirst (
+ "(\\p{XDigit}{8})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}+)",
+ "$1-$2-$3-$4-$5"
+ )).toString();
+ }
+
+ public boolean validate(String target, boolean username) {
+ ModuleNickHider nickHider = CheatBreaker.getInstance().getModuleManager().nickHiderMod;
+
+ if (username) {
+ try {
+ for (ClientProfile profile : this.wsOnlineUsers.values()) {
+ if (target.contains(profile.getUsername()) || (nickHider.hideRealName.getBooleanValue() && target.contains(nickHider.customNameString.getStringValue()))) {
+ return true;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ try {
+ for (UUID playerId : this.wsOnlineUsers.keySet()) {
+// System.out.println(target);
+// System.out.println(playerId);
+ if (UUID.fromString(target).equals(playerId)) {
+ return true;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/DabEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/DabEmote.java
new file mode 100644
index 0000000..d1d3350
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/DabEmote.java
@@ -0,0 +1,53 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.MinMaxFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class DabEmote extends Emote {
+ private final MinMaxFade name = new MinMaxFade(250L);
+ private final MinMaxFade resourceLoc = new MinMaxFade(250L);
+
+ public DabEmote() {
+ super("Dab", new MinMaxFade(1000L));
+ this.name.startAnimation();
+ }
+
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ float var4 = 1.0F;
+ if (this.name.getDuration() > this.duration.llIIllIlIlllllIlIllIIlIll()) {
+ var4 = this.name.getFadeAmount();
+ } else if (this.duration.getRemainingTime() <= this.resourceLoc.getDuration()) {
+ if (!this.resourceLoc.isTimeNotAtZero()) {
+ this.resourceLoc.startAnimation();
+ }
+
+ var4 = 1.0F - this.resourceLoc.getFadeAmount();
+ }
+
+ model.bipedRightArm.rotateAngleX = (float) Math.toRadians(-90.0F * var4);
+ model.bipedRightArm.rotateAngleY = (float) Math.toRadians(-35.0F * var4);
+ model.bipedLeftArm.rotateAngleX = (float) Math.toRadians(15.0F * var4);
+ model.bipedLeftArm.rotateAngleY = (float) Math.toRadians(15.0F * var4);
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(-110.0F * var4);
+
+ model.bipedRightArmwear.rotateAngleX = (float) Math.toRadians(-90.0F * var4);
+ model.bipedRightArmwear.rotateAngleY = (float) Math.toRadians(-35.0F * var4);
+ model.bipedLeftArmwear.rotateAngleX = (float) Math.toRadians(15.0F * var4);
+ model.bipedLeftArmwear.rotateAngleY = (float) Math.toRadians(15.0F * var4);
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(-110.0F * var4);
+
+ float var5 = player.rotationPitch;
+ float var6 = player.prevRenderYawOffset - player.rotationYaw;
+
+ model.bipedHead.rotateAngleX = (float) Math.toRadians(-var5 * var4) + (float) Math.toRadians(45.0F * var4 + var5);
+ model.bipedHead.rotateAngleY = (float) Math.toRadians(var6 * var4) + (float) Math.toRadians(35.0F * var4 - var6);
+ model.bipedHeadwear.rotateAngleX = (float) Math.toRadians(-var5 * var4) + (float) Math.toRadians(45.0F * var4 + var5);
+ model.bipedHeadwear.rotateAngleY = (float) Math.toRadians(var6 * var4) + (float) Math.toRadians(35.0F * var4 - var6);
+ }
+}
+
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/FacepalmEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/FacepalmEmote.java
new file mode 100644
index 0000000..4e0ce34
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/FacepalmEmote.java
@@ -0,0 +1,73 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.CosineFade;
+import com.cheatbreaker.client.ui.fading.ExponentialFade;
+import com.cheatbreaker.client.ui.fading.FloatFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class FacepalmEmote extends Emote {
+ private final ExponentialFade startTransitionTime = new ExponentialFade(150L);
+ private final ExponentialFade endTransitionTime = new ExponentialFade(200L);
+ private final CosineFade headShakeTime = new CosineFade(300L);
+ private final float headXRotationAngle = (float) Math.toRadians(45.0);
+ private final float rightArmYRotationAngle = (float) Math.toRadians(-30.0);
+ private final float rightArmXRotationAngle = (float) Math.toRadians(-100.0);
+
+ public FacepalmEmote() {
+ super("Facepalm", new FloatFade(2000L));
+ }
+
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ float fadeAmount = this.startTransitionTime.getFadeAmount();
+ if (!this.startTransitionTime.isTimeNotAtZero() && this.duration.llIIllIlIlllllIlIllIIlIll() >= 150L) {
+ this.startTransitionTime.startAnimation();
+ }
+
+ if (this.startTransitionTime.isTimeNotAtZero()) {
+ if (this.startTransitionTime.isOver() && !this.headShakeTime.isZeroOrLess() && !this.endTransitionTime.isTimeNotAtZero()) {
+ this.headShakeTime.startAnimation();
+ }
+
+ float var5 = model.bipedHead.rotateAngleX;
+ float var6 = model.bipedHead.rotateAngleY;
+
+ model.bipedHead.rotateAngleZ = -((float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount()));
+ model.bipedHeadwear.rotateAngleZ = -((float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount()));
+ model.bipedHead.rotateAngleY = (float) Math.toRadians(10.0) * fadeAmount - (float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount());
+ model.bipedHeadwear.rotateAngleY = (float) Math.toRadians(10.0) * fadeAmount - (float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount());
+ model.bipedHead.rotateAngleX = this.headXRotationAngle * fadeAmount;
+ model.bipedHeadwear.rotateAngleX = this.headXRotationAngle * fadeAmount;
+ model.bipedRightArm.rotateAngleY = this.rightArmYRotationAngle * fadeAmount - (this.endTransitionTime.isTimeNotAtZero() ? 0.0F : (float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount()));
+ model.bipedRightArm.rotateAngleX = this.rightArmXRotationAngle * fadeAmount;
+
+ model.bipedRightArmwear.rotateAngleY = this.rightArmYRotationAngle * fadeAmount - (this.endTransitionTime.isTimeNotAtZero() ? 0.0F : (float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount()));
+ model.bipedRightArmwear.rotateAngleX = this.rightArmXRotationAngle * fadeAmount;
+
+ if (!this.endTransitionTime.isTimeNotAtZero() && this.duration.getRemainingTime() <= this.endTransitionTime.getDuration()) {
+ this.endTransitionTime.startAnimation();
+ }
+
+ if (this.endTransitionTime.isTimeNotAtZero()) {
+ fadeAmount = this.endTransitionTime.getFadeAmount();
+ model.bipedHead.rotateAngleY = var6 * fadeAmount;
+ model.bipedHeadwear.rotateAngleY = var6 * fadeAmount;
+ model.bipedHead.rotateAngleZ = 0.0F;
+ model.bipedHeadwear.rotateAngleZ = 0.0F;
+ model.bipedHead.rotateAngleX -= (this.headXRotationAngle - var5) * fadeAmount;
+ model.bipedHeadwear.rotateAngleX -= (this.headXRotationAngle - var5) * fadeAmount;
+
+ model.bipedRightArm.rotateAngleY -= this.rightArmYRotationAngle * fadeAmount;
+ model.bipedRightArm.rotateAngleX -= this.rightArmXRotationAngle * fadeAmount;
+
+ model.bipedRightArmwear.rotateAngleY -= this.rightArmYRotationAngle * fadeAmount;
+ model.bipedRightArmwear.rotateAngleX -= this.rightArmXRotationAngle * fadeAmount;
+ }
+
+ }
+ }
+
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/FlossEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/FlossEmote.java
new file mode 100644
index 0000000..49e0da4
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/FlossEmote.java
@@ -0,0 +1,137 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.CosineFade;
+import com.cheatbreaker.client.ui.fading.ExponentialFade;
+import com.cheatbreaker.client.ui.fading.FloatFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class FlossEmote extends Emote {
+ private final ExponentialFade swapTransitionTime = new ExponentialFade(375L);
+ private final CosineFade swingTransitionTime = new CosineFade(375L);
+ private final CosineFade bodyRotationTransitionTime = new CosineFade(250L);
+ boolean swap = false;
+ private FlossStage flossStage;
+
+ public FlossEmote() {
+ super("Floss", new FloatFade(7500L));
+ this.bodyRotationTransitionTime.startAnimation();
+ this.flossStage = FlossStage.LEFT_TO_RIGHT;
+ }
+
+ @Override
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+
+ @Override
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ CheatBreaker.getInstance().getCosmeticManager().getModels().put(player.getUniqueID(), model);
+
+ if (!this.swapTransitionTime.isTimeNotAtZero()) {
+ if ((double) this.bodyRotationTransitionTime.getFadeAmount() >= 0.5) {
+ this.swapTransitionTime.startAnimation();
+ this.swingTransitionTime.startAnimation();
+ }
+ } else if (this.swapTransitionTime.isOver()) {
+ this.swapTransitionTime.startAnimation();
+ this.swingTransitionTime.startAnimation();
+ this.flossStage = this.getFlossStage();
+ }
+ if (this.bodyRotationTransitionTime.isOver()) {
+ this.swap = !this.swap;
+ this.bodyRotationTransitionTime.startAnimation();
+ }
+ float f2 = this.swapTransitionTime.getFadeAmount();
+ float f3 = this.swingTransitionTime.getFadeAmount();
+ model.bipedRightArm.rotateAngleX = (float) Math.toRadians((float) (this.flossStage == FlossStage.RIGHT_TO_BACK ? 45 : -45) * f3);
+ model.bipedLeftArm.rotateAngleX = (float) Math.toRadians((float) (this.flossStage == FlossStage.LEFT_TO_BACK ? 45 : -45) * f3);
+
+ model.bipedRightArmwear.rotateAngleX = (float) Math.toRadians((float) (this.flossStage == FlossStage.RIGHT_TO_BACK ? 45 : -45) * f3);
+ model.bipedLeftArmwear.rotateAngleX = (float) Math.toRadians((float) (this.flossStage == FlossStage.LEFT_TO_BACK ? 45 : -45) * f3);
+ float f4 = 150.0f;
+ float f5 = f4 / 2.0f;
+ switch (this.flossStage) {
+
+ case LEFT_TO_RIGHT:
+ model.bipedRightArm.rotateAngleZ = (float) Math.toRadians(f4 * f2 - f5);
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(f4 * f2 - f5);
+
+ model.bipedRightArmwear.rotateAngleZ = (float) Math.toRadians(f4 * f2 - f5);
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(f4 * f2 - f5);
+ break;
+
+ case RIGHT_TO_BACK:
+ model.bipedRightArm.rotateAngleZ = (float) Math.toRadians(f5 - f5 * f3);
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(f5 - f5 * f3);
+
+ model.bipedRightArmwear.rotateAngleZ = (float) Math.toRadians(f5 - f5 * f3);
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(f5 - f5 * f3);
+ break;
+
+ case RIGHT_TO_LEFT:
+ model.bipedRightArm.rotateAngleZ = (float) Math.toRadians(-f4 * f2 + f5);
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(-f4 * f2 + f5);
+
+ model.bipedRightArmwear.rotateAngleZ = (float) Math.toRadians(-f4 * f2 + f5);
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(-f4 * f2 + f5);
+ break;
+
+ case LEFT_TO_BACK:
+ model.bipedRightArm.rotateAngleZ = (float) Math.toRadians(f5 * f3 - f5);
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(f5 * f3 - f5);
+
+ model.bipedRightArmwear.rotateAngleZ = (float) Math.toRadians(f5 * f3 - f5);
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(f5 * f3 - f5);
+
+ }
+
+ f3 = this.bodyRotationTransitionTime.getFadeAmount();
+ if (this.swap) {
+ model.bipedBody.rotateAngleZ = (float) Math.toRadians(-15.0f * f3);
+ model.bipedCape.rotateAngleZ = (float) Math.toRadians(15.0f * f3);
+ model.bipedRightLeg.rotateAngleZ = (float) Math.toRadians(15.0f * f3);
+ model.bipedLeftLeg.rotateAngleZ = (float) Math.toRadians(15.0f * f3);
+ model.bipedLeftLeg.offsetX = 0.2f * f3;
+ model.bipedRightLeg.offsetX = 0.2f * f3;
+
+ model.bipedBodyWear.rotateAngleZ = (float) Math.toRadians(-15.0f * f3);
+ model.bipedRightLegwear.rotateAngleZ = (float) Math.toRadians(15.0f * f3);
+ model.bipedLeftLegwear.rotateAngleZ = (float) Math.toRadians(15.0f * f3);
+ model.bipedLeftLegwear.offsetX = 0.2f * f3;
+ model.bipedRightLegwear.offsetX = 0.2f * f3;
+ } else {
+ model.bipedBody.rotateAngleZ = (float) Math.toRadians(15.0f * f3);
+ model.bipedCape.rotateAngleZ = (float) Math.toRadians(-15.0f * f3);
+ model.bipedRightLeg.rotateAngleZ = (float) Math.toRadians(-15.0f * f3);
+ model.bipedLeftLeg.rotateAngleZ = (float) Math.toRadians(-15.0f * f3);
+ model.bipedLeftLeg.offsetX = -0.2f * f3;
+ model.bipedRightLeg.offsetX = -0.2f * f3;
+
+ model.bipedBodyWear.rotateAngleZ = (float) Math.toRadians(15.0f * f3);
+ model.bipedRightLegwear.rotateAngleZ = (float) Math.toRadians(-15.0f * f3);
+ model.bipedLeftLegwear.rotateAngleZ = (float) Math.toRadians(-15.0f * f3);
+ model.bipedLeftLegwear.offsetX = -0.2f * f3;
+ model.bipedRightLegwear.offsetX = -0.2f * f3;
+ }
+ }
+
+ private FlossStage getFlossStage() {
+ switch (this.flossStage) {
+ default:
+ return FlossStage.RIGHT_TO_BACK;
+ case RIGHT_TO_BACK:
+ return FlossStage.RIGHT_TO_LEFT;
+ case RIGHT_TO_LEFT:
+ return FlossStage.LEFT_TO_BACK;
+ case LEFT_TO_BACK:
+ }
+ return FlossStage.LEFT_TO_RIGHT;
+ }
+
+ enum FlossStage {
+ LEFT_TO_RIGHT, RIGHT_TO_LEFT, RIGHT_TO_BACK, LEFT_TO_BACK
+ }
+}
+
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/HandsUpEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/HandsUpEmote.java
new file mode 100644
index 0000000..494a59b
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/HandsUpEmote.java
@@ -0,0 +1,44 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.FloatFade;
+import com.cheatbreaker.client.ui.fading.MinMaxFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class HandsUpEmote extends Emote {
+ private final MinMaxFade startTransitionTime = new MinMaxFade(250L);
+ private final MinMaxFade endTransitionTime = new MinMaxFade(250L);
+
+ public HandsUpEmote() {
+ super("Hands Up", new FloatFade(2000L));
+ this.startTransitionTime.startAnimation();
+ }
+
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ float var4 = 1.0F;
+ if (this.startTransitionTime.getDuration() > this.duration.llIIllIlIlllllIlIllIIlIll()) {
+ var4 = this.startTransitionTime.getFadeAmount();
+ } else if (this.duration.getRemainingTime() <= this.endTransitionTime.getDuration()) {
+ if (!this.endTransitionTime.isTimeNotAtZero()) {
+ this.endTransitionTime.startAnimation();
+ }
+
+ var4 = 1.0F - this.endTransitionTime.getFadeAmount();
+ }
+
+ model.bipedLeftArm.rotateAngleX = (float) Math.toRadians(-180.0F * var4);
+ model.bipedRightArm.rotateAngleX = (float) Math.toRadians(-180.0F * var4);
+ model.bipedRightArm.rotateAngleZ = (float) Math.toRadians(-15.0F * var4);
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(15.0F * var4);
+
+ model.bipedLeftArmwear.rotateAngleX = (float) Math.toRadians(-180.0F * var4);
+ model.bipedRightArmwear.rotateAngleX = (float) Math.toRadians(-180.0F * var4);
+ model.bipedRightArmwear.rotateAngleZ = (float) Math.toRadians(-15.0F * var4);
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(15.0F * var4);
+ }
+}
+
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/NarutoRunEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/NarutoRunEmote.java
new file mode 100644
index 0000000..01b74d5
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/NarutoRunEmote.java
@@ -0,0 +1,60 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.ExponentialFade;
+import com.cheatbreaker.client.ui.fading.MinMaxFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class NarutoRunEmote extends Emote {
+ private final ExponentialFade startTransitionTime = new ExponentialFade(300L);
+ private final MinMaxFade endTransitionTime = new MinMaxFade(500L);
+
+ public NarutoRunEmote() {
+ super("Naruto Run", new MinMaxFade(10000L));
+ this.startTransitionTime.startAnimation();
+ }
+
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ model.bipedRightArm.rotateAngleX *= this.endTransitionTime.getFadeAmount();
+ model.bipedLeftArm.rotateAngleX *= this.endTransitionTime.getFadeAmount();
+
+ model.bipedRightArmwear.rotateAngleX *= this.endTransitionTime.getFadeAmount();
+ model.bipedLeftArmwear.rotateAngleX *= this.endTransitionTime.getFadeAmount();
+
+ if (this.startTransitionTime.isZeroOrLess()) {
+
+ model.bipedRightArm.rotateAngleX = (float) Math.toRadians(90.0F * this.startTransitionTime.getFadeAmount());
+ model.bipedLeftArm.rotateAngleX = (float) Math.toRadians(90.0F * this.startTransitionTime.getFadeAmount());
+
+ model.bipedRightArmwear.rotateAngleX = (float) Math.toRadians(90.0F * this.startTransitionTime.getFadeAmount());
+ model.bipedLeftArmwear.rotateAngleX = (float) Math.toRadians(90.0F * this.startTransitionTime.getFadeAmount());
+
+ } else if (this.duration.getRemainingTime() <= this.endTransitionTime.getDuration()) {
+
+ if (!this.endTransitionTime.isTimeNotAtZero()) {
+ this.endTransitionTime.startAnimation();
+ }
+
+ model.bipedRightArm.rotateAngleX = Math.max((float) Math.toRadians(90.0F - 90.0F * this.endTransitionTime.getFadeAmount()), model.bipedRightArm.rotateAngleZ);
+ model.bipedLeftArm.rotateAngleX = Math.min((float) Math.toRadians(-270.0F - 90.0F * this.endTransitionTime.getFadeAmount()), model.bipedRightArm.rotateAngleZ);
+
+ model.bipedRightArmwear.rotateAngleX = Math.max((float) Math.toRadians(90.0F - 90.0F * this.endTransitionTime.getFadeAmount()), model.bipedRightArmwear.rotateAngleZ);
+ model.bipedLeftArmwear.rotateAngleX = Math.min((float) Math.toRadians(-270.0F - 90.0F * this.endTransitionTime.getFadeAmount()), model.bipedRightArmwear.rotateAngleZ);
+
+ } else {
+
+ player.setSneaking(true);
+ model.bipedRightArm.rotateAngleX = (float) Math.toRadians(90.0);
+ model.bipedLeftArm.rotateAngleX = (float) Math.toRadians(90.0);
+
+ model.bipedRightArmwear.rotateAngleX = (float) Math.toRadians(90.0);
+ model.bipedLeftArmwear.rotateAngleX = (float) Math.toRadians(90.0);
+
+ }
+
+ }
+
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/ShrugEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/ShrugEmote.java
new file mode 100644
index 0000000..12b253b
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/ShrugEmote.java
@@ -0,0 +1,26 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.CosineFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class ShrugEmote extends Emote {
+ public ShrugEmote() {
+ super("Shrug", new CosineFade(500L));
+ }
+
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ model.bipedRightArm.offsetY = -0.2F * this.duration.getFadeAmount();
+ model.bipedLeftArm.offsetY = -0.2F * this.duration.getFadeAmount();
+
+ model.bipedRightArmwear.offsetY = -0.2F * this.duration.getFadeAmount();
+ model.bipedLeftArmwear.offsetY = -0.2F * this.duration.getFadeAmount();
+
+ model.bipedHead.offsetY = 0.05F * this.duration.getFadeAmount();
+ model.bipedHeadwear.offsetY = 0.05F * this.duration.getFadeAmount();
+ }
+
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/SuperFacepalmEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/SuperFacepalmEmote.java
new file mode 100644
index 0000000..f8be696
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/SuperFacepalmEmote.java
@@ -0,0 +1,71 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.CosineFade;
+import com.cheatbreaker.client.ui.fading.ExponentialFade;
+import com.cheatbreaker.client.ui.fading.FloatFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class SuperFacepalmEmote extends Emote {
+ private final ExponentialFade startTransitionTime = new ExponentialFade(1000L);
+ private final ExponentialFade endTransitionTime = new ExponentialFade(2000L);
+ private final CosineFade headShakeTime = new CosineFade(100L);
+ private final float headXRotationAngle = (float) Math.toRadians(45.0);
+ private final float rightArmYRotationAngle = (float) Math.toRadians(-30.0);
+ private final float rightArmXRotationAngle = (float) Math.toRadians(-100.0);
+
+ public SuperFacepalmEmote() {
+ super("Super Facepalm", new FloatFade(20000L));
+ }
+
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ float var4 = this.startTransitionTime.getFadeAmount();
+ if (!this.startTransitionTime.isTimeNotAtZero() && this.duration.llIIllIlIlllllIlIllIIlIll() >= 150L) {
+ this.startTransitionTime.startAnimation();
+ }
+
+ if (this.startTransitionTime.isTimeNotAtZero()) {
+ if (this.startTransitionTime.isOver() && !this.headShakeTime.isZeroOrLess() && !this.endTransitionTime.isTimeNotAtZero()) {
+ this.headShakeTime.startAnimation();
+ }
+
+ float var5 = model.bipedHead.rotateAngleX;
+ float var6 = model.bipedHead.rotateAngleY;
+ model.bipedHead.rotateAngleZ = -((float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount()));
+ model.bipedHeadwear.rotateAngleZ = -((float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount()));
+ model.bipedHead.rotateAngleY = (float) Math.toRadians(10.0) * var4 - (float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount());
+ model.bipedHeadwear.rotateAngleY = (float) Math.toRadians(10.0) * var4 - (float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount());
+ model.bipedHead.rotateAngleX = this.headXRotationAngle * var4;
+ model.bipedHeadwear.rotateAngleX = this.headXRotationAngle * var4;
+ model.bipedRightArm.rotateAngleY = this.rightArmYRotationAngle * var4 - (this.endTransitionTime.isTimeNotAtZero() ? 0.0F : (float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount()));
+ model.bipedRightArm.rotateAngleX = this.rightArmXRotationAngle * var4;
+
+ model.bipedRightArmwear.rotateAngleY = this.rightArmYRotationAngle * var4 - (this.endTransitionTime.isTimeNotAtZero() ? 0.0F : (float) Math.toRadians(10.0F * this.headShakeTime.getFadeAmount()));
+ model.bipedRightArmwear.rotateAngleX = this.rightArmXRotationAngle * var4;
+
+ if (!this.endTransitionTime.isTimeNotAtZero() && this.duration.getRemainingTime() <= this.endTransitionTime.getDuration()) {
+ this.endTransitionTime.startAnimation();
+ }
+
+ if (this.endTransitionTime.isTimeNotAtZero()) {
+ var4 = this.endTransitionTime.getFadeAmount();
+ model.bipedHead.rotateAngleY = var6 * var4;
+ model.bipedHeadwear.rotateAngleY = var6 * var4;
+ model.bipedHead.rotateAngleZ = 0.0F;
+ model.bipedHeadwear.rotateAngleZ = 0.0F;
+ model.bipedHead.rotateAngleX -= (this.headXRotationAngle - var5) * var4;
+ model.bipedHeadwear.rotateAngleX -= (this.headXRotationAngle - var5) * var4;
+ model.bipedRightArm.rotateAngleY -= this.rightArmYRotationAngle * var4;
+ model.bipedRightArm.rotateAngleX -= this.rightArmXRotationAngle * var4;
+
+ model.bipedRightArmwear.rotateAngleY -= this.rightArmYRotationAngle * var4;
+ model.bipedRightArmwear.rotateAngleX -= this.rightArmXRotationAngle * var4;
+ }
+
+ }
+ }
+
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/TPoseEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/TPoseEmote.java
new file mode 100644
index 0000000..d2cc3d2
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/TPoseEmote.java
@@ -0,0 +1,53 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.ExponentialFade;
+import com.cheatbreaker.client.ui.fading.MinMaxFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class TPoseEmote extends Emote {
+ private final ExponentialFade startTransitionTime = new ExponentialFade(600L);
+ private final MinMaxFade endTransitionTime = new MinMaxFade(600L);
+
+ public TPoseEmote() {
+ super("T-Pose", new MinMaxFade(5000L));
+ this.startTransitionTime.startAnimation();
+ }
+
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ model.bipedRightArm.rotateAngleX *= this.endTransitionTime.getFadeAmount();
+ model.bipedLeftArm.rotateAngleX *= this.endTransitionTime.getFadeAmount();
+
+ model.bipedRightArmwear.rotateAngleX *= this.endTransitionTime.getFadeAmount();
+ model.bipedLeftArmwear.rotateAngleX *= this.endTransitionTime.getFadeAmount();
+
+ if (this.startTransitionTime.isZeroOrLess()) {
+ model.bipedRightArm.rotateAngleZ = (float) Math.toRadians(90.0F * this.startTransitionTime.getFadeAmount());
+ model.bipedRightArmwear.rotateAngleZ = (float) Math.toRadians(90.0F * this.startTransitionTime.getFadeAmount());
+
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(-90.0F * this.startTransitionTime.getFadeAmount());
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(-90.0F * this.startTransitionTime.getFadeAmount());
+
+ } else if (this.duration.getRemainingTime() <= this.endTransitionTime.getDuration()) {
+ if (!this.endTransitionTime.isTimeNotAtZero()) {
+ this.endTransitionTime.startAnimation();
+ }
+
+ model.bipedLeftArm.rotateAngleZ = Math.min((float) Math.toRadians(-90.0F + 90.0F * this.endTransitionTime.getFadeAmount()), model.bipedLeftArm.rotateAngleZ);
+ model.bipedLeftArmwear.rotateAngleZ = Math.min((float) Math.toRadians(-90.0F + 90.0F * this.endTransitionTime.getFadeAmount()), model.bipedLeftArmwear.rotateAngleZ);
+
+ model.bipedRightArm.rotateAngleZ = Math.max((float) Math.toRadians(90.0F - 90.0F * this.endTransitionTime.getFadeAmount()), model.bipedRightArm.rotateAngleZ);
+ model.bipedRightArmwear.rotateAngleZ = Math.max((float) Math.toRadians(90.0F - 90.0F * this.endTransitionTime.getFadeAmount()), model.bipedRightArmwear.rotateAngleZ);
+ } else {
+ model.bipedRightArm.rotateAngleZ = (float) Math.toRadians(90.0);
+ model.bipedRightArmwear.rotateAngleZ = (float) Math.toRadians(90.0);
+
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(-90.0);
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(-90.0);
+ }
+ }
+
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/WaveEmote.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/WaveEmote.java
new file mode 100644
index 0000000..370f4cd
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/emote/WaveEmote.java
@@ -0,0 +1,49 @@
+package com.cheatbreaker.client.cosmetic.type.emote;
+
+import com.cheatbreaker.client.cosmetic.Emote;
+import com.cheatbreaker.client.ui.fading.CosineFade;
+import com.cheatbreaker.client.ui.fading.FloatFade;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+public class WaveEmote extends Emote {
+ private final FloatFade name = new FloatFade(250L);
+ private final FloatFade resourceLoc = new FloatFade(250L);
+ private final CosineFade waveTransitionTime = new CosineFade(500L);
+
+ public WaveEmote() {
+ super("Wave", new FloatFade(2000L));
+ this.name.startAnimation();
+ }
+
+ public void tickEmote(AbstractClientPlayer player, float partialTicks) {
+ }
+
+ public void playEmote(AbstractClientPlayer player, ModelPlayer model, float partialTicks) {
+ float var4 = 1.0F;
+ float var5 = 0.5F;
+ if (this.name.getDuration() > this.duration.llIIllIlIlllllIlIllIIlIll()) {
+ var4 = this.name.getFadeAmount();
+ } else if (this.duration.getRemainingTime() <= this.resourceLoc.getDuration()) {
+ if (!this.resourceLoc.isTimeNotAtZero()) {
+ this.resourceLoc.startAnimation();
+ }
+
+ var4 = 1.0F - this.resourceLoc.getFadeAmount();
+ } else {
+ if (!this.waveTransitionTime.isTimeNotAtZero()) {
+ this.waveTransitionTime.startAnimationFromStartOrEnd(125.0F);
+ this.waveTransitionTime.loopAnimation();
+ }
+
+ var5 = this.waveTransitionTime.getFadeAmount();
+ }
+
+ model.bipedLeftArm.rotateAngleX = (float) Math.toRadians(-150.0F * var4);
+ model.bipedLeftArm.rotateAngleZ = (float) Math.toRadians(40.0F * var5 - 20.0F);
+
+ model.bipedLeftArmwear.rotateAngleX = (float) Math.toRadians(-150.0F * var4);
+ model.bipedLeftArmwear.rotateAngleZ = (float) Math.toRadians(40.0F * var5 - 20.0F);
+ }
+}
+
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/model/CosmeticModelAnimatedCape.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/model/CosmeticModelAnimatedCape.java
new file mode 100644
index 0000000..d679da4
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/model/CosmeticModelAnimatedCape.java
@@ -0,0 +1,11 @@
+package com.cheatbreaker.client.cosmetic.type.model;
+
+import net.minecraft.client.model.ModelBiped;
+
+public class CosmeticModelAnimatedCape extends ModelBiped {
+
+ public CosmeticModelAnimatedCape() {
+
+ }
+
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/model/CosmeticModelWings.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/model/CosmeticModelWings.java
new file mode 100644
index 0000000..e035ade
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/cosmetic/type/model/CosmeticModelWings.java
@@ -0,0 +1,71 @@
+package com.cheatbreaker.client.cosmetic.type.model;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * This is the wings cosmetic that will appear on player's backs
+ * if they own them and have them equipped.
+ */
+public class CosmeticModelWings extends ModelBase {
+ private final ResourceLocation enderDragonTextures = new ResourceLocation("textures/entity/enderdragon/dragon.png");
+ private final ModelRenderer wing;
+ private final ModelRenderer wingTip;
+
+ public CosmeticModelWings(float f) {
+ this.textureWidth = 256;
+ this.textureHeight = 256;
+
+ this.setTextureOffset("wing.skin", -56, 88);
+ this.setTextureOffset("wingtip.skin", -56, 144);
+ this.setTextureOffset("wing.bone", 112, 88);
+ this.setTextureOffset("wingtip.bone", 112, 136);
+
+ this.wing = new ModelRenderer(this, "wing");
+ this.wing.setRotationPoint(-12, 5, 2.0f);
+ this.wing.addBox("bone", (float) -56, (float) -4, (float) -4, 56, 8, 8);
+ this.wing.addBox("skin", (float) -56, 0.0f, 2.0f, 56, 0, 56);
+
+ this.wingTip = new ModelRenderer(this, "wingtip");
+ this.wingTip.setRotationPoint(-56, 0.0f, 0.0f);
+ this.wingTip.addBox("bone", (float) -56, (float) -2, (float) -2, 56, 4, 4);
+ this.wingTip.addBox("skin", (float) -56, 0.0f, 2.0f, 56, 0, 56);
+ this.wing.addChild(this.wingTip);
+ }
+
+ public void render(Entity entity, float f, float f2, float f3, float f4, float f5, float f6, float f7, ResourceLocation resourceLocation) {
+ if (!(entity instanceof EntityPlayer)) {
+ return;
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation);
+ GL11.glPushMatrix();
+ GL11.glScaled(f7, f7, f7);
+ GL11.glRotatef(15, 1.0f, 0.0f, 0.0f);
+ GL11.glTranslatef(0.0f, 0.5f, 0.25f);
+
+ float f8 = (float) (System.currentTimeMillis() % 2000L) / 2000.0f * (float) Math.PI * 2.0f;
+
+ for (int i = 0; i < 2; ++i) {
+ GL11.glEnable(2884);
+ this.wing.rotateAngleX = 1.1f * -0.11363636f - (float) Math.cos(f8) * (0.175f * 1.1428572f);
+ this.wing.rotateAngleY = 1.069853f * 0.7010309f;
+ this.wing.rotateAngleZ = (float) (Math.sin(f8) + 0.125F) * 0.8F;
+ this.wingTip.rotateAngleZ = (float) (Math.sin(f8 + 2.0f) + 0.5) * 0.75f;
+ this.wing.render(f6);
+ GL11.glScalef(-1, 1.0f, 1.0f);
+
+ if (i != 0) continue;
+ GL11.glCullFace(1028);
+ }
+
+ GL11.glPopMatrix();
+ GL11.glCullFace(1029);
+ GL11.glDisable(2884);
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/EventBus.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/EventBus.java
new file mode 100644
index 0000000..81c4e83
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/EventBus.java
@@ -0,0 +1,78 @@
+package com.cheatbreaker.client.event;
+
+import com.cheatbreaker.client.CheatBreaker;
+
+import java.io.Serializable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.function.Consumer;
+
+/**
+ * CheatBreaker's Event Manager.
+ */
+public class EventBus {
+
+ public EventBus()
+ {
+ CheatBreaker.getInstance().logger.info(CheatBreaker.getInstance().loggerPrefix + "Created EventBus");
+ }
+
+ /**
+ * Currently registered events.
+ */
+ private final ConcurrentHashMap, CopyOnWriteArrayList>> registeredEvents = new ConcurrentHashMap<>();
+
+ /**
+ * Registers an event.
+ */
+ public boolean addEvent(Class clazz, Consumer consumer) {
+ return this.registeredEvents.computeIfAbsent(clazz, p0 -> new CopyOnWriteArrayList<>()).add((Consumer) consumer);
+ }
+
+ /**
+ * Unregisters an event.
+ */
+ public void removeEvent(final Class clazz, final Consumer consumer) {
+ final CopyOnWriteArrayList> list = this.registeredEvents.get(clazz);
+ if (list != null) list.remove(consumer);
+ }
+
+ /**
+ * Handles the event.
+ */
+ public void handleEvent(Event event) {
+ try {
+ for (Serializable s = event.getClass(); s != null && s != Event.class; s = ((Class) s).getSuperclass()) {
+ final CopyOnWriteArrayList> list = this.registeredEvents.get(s);
+ if (list != null) {
+ list.forEach(consumer -> consumer.accept(event));
+ }
+ }
+ } catch (Exception ex) {
+ System.err.println("EventBus [" + event.getClass() + "]");
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * The event class, defines what an event is (NOTHING LOL).
+ */
+ public static class Event {
+ }
+
+ /**
+ * Defines the data for an event.
+ */
+ public static class EventData extends Event {
+ private boolean canceled = false;
+
+ public boolean isCanceled() {
+ return this.canceled;
+ }
+
+ public void setCanceled(boolean canceled) {
+ this.canceled = canceled;
+ }
+ }
+
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/InitializationEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/InitializationEvent.java
new file mode 100644
index 0000000..9155eda
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/InitializationEvent.java
@@ -0,0 +1,10 @@
+package com.cheatbreaker.client.event.impl;
+
+import com.cheatbreaker.client.event.EventBus;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * Used to mainly initialize the updated resource packs menu.
+ */
+public class InitializationEvent extends EventBus.Event {
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/chat/ChatReceivedEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/chat/ChatReceivedEvent.java
new file mode 100644
index 0000000..5234824
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/chat/ChatReceivedEvent.java
@@ -0,0 +1,9 @@
+package com.cheatbreaker.client.event.impl.chat;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.*;
+
+@Getter @AllArgsConstructor
+public class ChatReceivedEvent extends EventBus.Event {
+ private final String receivedChatMessage;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/keyboard/KeyboardEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/keyboard/KeyboardEvent.java
new file mode 100644
index 0000000..94a08fd
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/keyboard/KeyboardEvent.java
@@ -0,0 +1,16 @@
+package com.cheatbreaker.client.event.impl.keyboard;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This event is for when the keyboard is used.
+ */
+@Getter
+@AllArgsConstructor
+public class KeyboardEvent extends EventBus.Event {
+ private int pressed;
+}
+
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/mouse/ClickEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/mouse/ClickEvent.java
new file mode 100644
index 0000000..cca7aa6
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/mouse/ClickEvent.java
@@ -0,0 +1,15 @@
+package com.cheatbreaker.client.event.impl.mouse;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This event is for when the mouse is used.
+ */
+@Getter
+@AllArgsConstructor
+public class ClickEvent extends EventBus.Event {
+ private final int mouseButton;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/mouse/ClickStateEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/mouse/ClickStateEvent.java
new file mode 100644
index 0000000..6109d10
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/mouse/ClickStateEvent.java
@@ -0,0 +1,16 @@
+package com.cheatbreaker.client.event.impl.mouse;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This event is for getting the mouse button and state when the mouse is used.
+ */
+@Getter
+@AllArgsConstructor
+public class ClickStateEvent extends EventBus.Event {
+ private final int mouseButton;
+ private final boolean state;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/movement/CollisionEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/movement/CollisionEvent.java
new file mode 100644
index 0000000..7ac6d30
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/movement/CollisionEvent.java
@@ -0,0 +1,22 @@
+package com.cheatbreaker.client.event.impl.movement;
+
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import net.minecraft.util.AxisAlignedBB;
+
+import java.util.List;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This is used for player collision, most notably used in the NoClip staff module.
+ */
+@Getter
+@AllArgsConstructor
+public class CollisionEvent extends EventBus.EventData {
+ private List boxes;
+ private double x;
+ private double y;
+ private double z;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/movement/PlayerLookEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/movement/PlayerLookEvent.java
new file mode 100644
index 0000000..2c1f540
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/movement/PlayerLookEvent.java
@@ -0,0 +1,10 @@
+package com.cheatbreaker.client.event.impl.movement;
+
+import com.cheatbreaker.client.event.EventBus;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This is unused, however I believe the use is meant for tracking when a player looks at another player.
+ */
+public class PlayerLookEvent extends EventBus.Event {
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/ChatPacketEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/ChatPacketEvent.java
new file mode 100644
index 0000000..7a6fc06
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/ChatPacketEvent.java
@@ -0,0 +1,20 @@
+package com.cheatbreaker.client.event.impl.network;
+
+import com.cheatbreaker.client.event.EventBus;
+import net.minecraft.network.play.server.S02PacketChat;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This is fired when the player sends a chat message or receives a chat message.
+ */
+public class ChatPacketEvent extends EventBus.Event {
+ private final S02PacketChat packetIn;
+
+ public ChatPacketEvent(S02PacketChat packetIn) {
+ this.packetIn = packetIn;
+ }
+
+ public S02PacketChat getPacketIn() {
+ return this.packetIn;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/ConnectEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/ConnectEvent.java
new file mode 100644
index 0000000..e0208cc
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/ConnectEvent.java
@@ -0,0 +1,10 @@
+package com.cheatbreaker.client.event.impl.network;
+
+import com.cheatbreaker.client.event.EventBus;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This is fired when a player connects to a server.
+ */
+public class ConnectEvent extends EventBus.Event {
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/DisconnectEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/DisconnectEvent.java
new file mode 100644
index 0000000..035f37e
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/DisconnectEvent.java
@@ -0,0 +1,10 @@
+package com.cheatbreaker.client.event.impl.network;
+
+import com.cheatbreaker.client.event.EventBus;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This is fired when a player disconnects from a server.
+ */
+public class DisconnectEvent extends EventBus.Event {
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/LoadWorldEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/LoadWorldEvent.java
new file mode 100644
index 0000000..8cfbde7
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/LoadWorldEvent.java
@@ -0,0 +1,16 @@
+package com.cheatbreaker.client.event.impl.network;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import net.minecraft.client.multiplayer.WorldClient;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This is fired when loading the world in, and when you change dimensions.
+ */
+@Getter
+@AllArgsConstructor
+public class LoadWorldEvent extends EventBus.Event {
+ private WorldClient worldClient;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/PluginMessageEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/PluginMessageEvent.java
new file mode 100644
index 0000000..2947bad
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/PluginMessageEvent.java
@@ -0,0 +1,18 @@
+package com.cheatbreaker.client.event.impl.network;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This is fired when the server sends a custom payload to the client.
+ *
+ * The payload can mainly be defined as a custom client packet for CB-Client.
+ */
+@Getter
+@AllArgsConstructor
+public class PluginMessageEvent extends EventBus.Event {
+ private String channelName;
+ private byte[] bufferData;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/RenderWorldEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/RenderWorldEvent.java
new file mode 100644
index 0000000..e9bd8f3
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/network/RenderWorldEvent.java
@@ -0,0 +1,22 @@
+package com.cheatbreaker.client.event.impl.network;
+
+import com.cheatbreaker.client.event.EventBus;
+
+import java.beans.ConstructorProperties;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * This is fired when rendering the world, only in for World Border's though.
+ */
+public class RenderWorldEvent extends EventBus.Event {
+ private final float partialTicks;
+
+ public float getPartialTicks() {
+ return this.partialTicks;
+ }
+
+ @ConstructorProperties(value = {"partialTicks"})
+ public RenderWorldEvent(float partialTicks) {
+ this.partialTicks = partialTicks;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/GuiDrawBypassDebugEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/GuiDrawBypassDebugEvent.java
new file mode 100644
index 0000000..7634bef
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/GuiDrawBypassDebugEvent.java
@@ -0,0 +1,16 @@
+package com.cheatbreaker.client.event.impl.render;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import net.minecraft.client.gui.ScaledResolution;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * Used for the scoreboard.
+ */
+@AllArgsConstructor
+@Getter
+public class GuiDrawBypassDebugEvent extends EventBus.Event {
+ private ScaledResolution scaledResolution;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/GuiDrawEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/GuiDrawEvent.java
new file mode 100644
index 0000000..0f15cd9
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/GuiDrawEvent.java
@@ -0,0 +1,16 @@
+package com.cheatbreaker.client.event.impl.render;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import net.minecraft.client.gui.ScaledResolution;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * Used to draw a mod to the screen.
+ */
+@AllArgsConstructor
+@Getter
+public class GuiDrawEvent extends EventBus.Event {
+ private ScaledResolution scaledResolution;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/PlayerAnimationEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/PlayerAnimationEvent.java
new file mode 100644
index 0000000..382ac18
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/PlayerAnimationEvent.java
@@ -0,0 +1,21 @@
+package com.cheatbreaker.client.event.impl.render;
+
+import com.cheatbreaker.client.cosmetic.data.AnimationStage;
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelPlayer;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * Used for emotes and emote rendering.
+ */
+@AllArgsConstructor
+@Getter
+public class PlayerAnimationEvent extends EventBus.Event {
+ private final AnimationStage stage;
+ private final AbstractClientPlayer player;
+ private final ModelPlayer model;
+ private final float partialTicks;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/PreviewDrawEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/PreviewDrawEvent.java
new file mode 100644
index 0000000..a88141b
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/render/PreviewDrawEvent.java
@@ -0,0 +1,16 @@
+package com.cheatbreaker.client.event.impl.render;
+
+import com.cheatbreaker.client.event.EventBus;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import net.minecraft.client.gui.ScaledResolution;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * Used to draw a mod preview.
+ */
+@AllArgsConstructor
+@Getter
+public class PreviewDrawEvent extends EventBus.Event {
+ private ScaledResolution scaledResolution;
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/tick/KeepAliveEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/tick/KeepAliveEvent.java
new file mode 100644
index 0000000..63ca9e7
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/tick/KeepAliveEvent.java
@@ -0,0 +1,10 @@
+package com.cheatbreaker.client.event.impl.tick;
+
+import com.cheatbreaker.client.event.EventBus;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * Used only for notifcations.
+ */
+public class KeepAliveEvent extends EventBus.Event {
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/tick/TickEvent.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/tick/TickEvent.java
new file mode 100644
index 0000000..6023461
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/event/impl/tick/TickEvent.java
@@ -0,0 +1,10 @@
+package com.cheatbreaker.client.event.impl.tick;
+
+import com.cheatbreaker.client.event.EventBus;
+
+/**
+ * @see com.cheatbreaker.client.event.EventBus.Event
+ * An event that is constantly fired every tick when a given condition is met.
+ */
+public class TickEvent extends EventBus.Event {
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/AbstractModule.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/AbstractModule.java
new file mode 100644
index 0000000..013d2d9
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/AbstractModule.java
@@ -0,0 +1,407 @@
+package com.cheatbreaker.client.module;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.cosmetic.profile.ClientProfile;
+import com.cheatbreaker.client.event.EventBus;
+import com.cheatbreaker.client.event.impl.keyboard.KeyboardEvent;
+import com.cheatbreaker.client.event.impl.mouse.ClickEvent;
+import com.cheatbreaker.client.module.data.CustomizationLevel;
+import com.cheatbreaker.client.module.data.PreviewType;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.module.impl.normal.hypixel.ModuleNickHider;
+import com.cheatbreaker.client.ui.module.AnchorHelper;
+import com.cheatbreaker.client.ui.module.GuiAnchor;
+import com.cheatbreaker.client.ui.module.Position;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+import java.util.*;
+import java.util.function.Consumer;
+
+/**
+ * @see Object (LMFAO)
+ *
+ * This Object defines the module Object of the CheatBreaker Client.
+ */
+@Getter @Setter
+public abstract class AbstractModule {
+ protected Minecraft mc = Minecraft.getMinecraft();
+
+ private final Map, Consumer> eventMap = new HashMap<>();
+ private final List defaultSettingsValues;
+ private final List settingsList;
+
+ private boolean staffModule = false;
+ private boolean staffModuleEnabled = false;
+ public boolean defaultState = false;
+ private boolean renderHud = true;
+ public boolean defaultRenderHud = true;
+ public boolean notRenderHUD = true;
+ public boolean hiddenFromHud = false;
+ private boolean enabled = false;
+ private boolean wasRenderHud = false;
+ public boolean defaultWasRenderHud = false;
+
+ private final String name;
+ private String description;
+ private List creators;
+ private List aliases;
+
+ public String defaultGuiScale;
+ private String previewLabel;
+
+ private float xTranslation = 0.0f;
+ private float yTranslation = 0.0f;
+ public float defaultXTranslation = 0.0f;
+ public float defaultYTranslation = 0.0f;
+
+ public float width = 0.0f;
+ public float height = 0.0f;
+
+ private float previewIconWidth;
+ private float previewIconHeight;
+ private float previewLabelSize;
+
+ public GuiAnchor guiAnchor;
+ public GuiAnchor defaultGuiAnchor;
+
+ public Setting scale;
+ public Setting guiScale;
+ public Setting toggleKeybind;
+ public Setting hideFromHUDKeybind;
+ public Setting tempHideFromHUDKeybind;
+
+ private PreviewType previewType;
+
+ private ResourceLocation previewIcon;
+
+ public AbstractModule(String name) {
+ this.name = name;
+ this.settingsList = new ArrayList<>();
+ this.defaultSettingsValues = new ArrayList<>();
+ this.defaultGuiScale = "Global";
+ this.scale = new Setting(this, "Scale", "Change the scale of the mod.").setValue(1.0f).setMinMax(0.5f, 1.5f).setUnit("x").setCenterLabel("1.0x");
+ this.guiScale = new Setting(this, "GUI Scale", "Change the scale of the mod.").setValue(defaultGuiScale).acceptedStringValues("Global", "Default", "Small", "Normal", "Large", "Auto").setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.toggleKeybind = new Setting(this, "Toggle Mod Keybind").setValue(0).setMouseBind(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.hideFromHUDKeybind = new Setting(this, "Toggle HUD Keybind").setValue(0).setMouseBind(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.tempHideFromHUDKeybind = new Setting(this, "Temp Toggle HUD Keybind").setValue(0).setMouseBind(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.registerStaticEvent(KeyboardEvent.class, this::onKeyPress);
+ this.registerStaticEvent(ClickEvent.class, this::onMousePress);
+ }
+
+ public AbstractModule(String name, String defaultGuiScale) {
+ this.name = name;
+ this.settingsList = new ArrayList<>();
+ this.defaultSettingsValues = new ArrayList<>();
+ this.defaultGuiScale = defaultGuiScale;
+ this.scale = new Setting(this, "Scale", "Change the scale of the mod.").setValue(1.0f).setMinMax(0.5f, 1.5f).setUnit("x").setCenterLabel("1.0x");
+ this.guiScale = new Setting(this, "GUI Scale", "Change the scale of the mod.").setValue(defaultGuiScale).acceptedStringValues("Global", "Default", "Small", "Normal", "Large", "Auto").setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.toggleKeybind = new Setting(this, "Toggle Mod Keybind").setValue(0).setMouseBind(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.hideFromHUDKeybind = new Setting(this, "Toggle HUD Keybind").setValue(0).setMouseBind(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.tempHideFromHUDKeybind = new Setting(this, "Temp Toggle HUD Keybind").setValue(0).setMouseBind(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.registerStaticEvent(KeyboardEvent.class, this::onKeyPress);
+ this.registerStaticEvent(ClickEvent.class, this::onMousePress);
+ }
+
+ protected void addEvent(Class eventClass, Consumer consumer) {
+ this.eventMap.put(eventClass, consumer);
+ }
+
+ protected void registerStaticEvent(Class eventClass, Consumer consumer) {
+ CheatBreaker.getInstance().getEventBus().addEvent(eventClass, consumer);
+ }
+
+ protected void addAllEvents() {
+ for (Map.Entry, Consumer> entry : this.eventMap.entrySet()) {
+ CheatBreaker.getInstance().getEventBus().addEvent(entry.getKey(), entry.getValue());
+ }
+ }
+
+ protected void removeAllEvents() {
+ for (Map.Entry, Consumer> entry : this.eventMap.entrySet()) {
+ CheatBreaker.getInstance().getEventBus().removeEvent(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public void setState(boolean state) {
+ if (state != this.defaultState) {
+ CheatBreaker.getInstance().getConfigManager().createNewProfile();
+ }
+ if (state) {
+ if (!this.enabled) {
+ this.enabled = true;
+ this.addAllEvents();
+ }
+ } else if (this.enabled) {
+ this.enabled = false;
+ this.removeAllEvents();
+ }
+ }
+
+ public void setDefaultState(boolean state) {
+ if (state) {
+ if (!this.enabled) {
+ this.enabled = true;
+ this.addAllEvents();
+ }
+ } else if (this.enabled) {
+ this.enabled = false;
+ this.removeAllEvents();
+ }
+ this.defaultState = this.enabled;
+ }
+
+ public void setTranslations(float x, float y) {
+ this.xTranslation = x;
+ this.yTranslation = y;
+ }
+
+ public void setDefaultTranslations(float x, float y) {
+ this.xTranslation = x;
+ this.yTranslation = y;
+ this.defaultXTranslation = x;
+ this.defaultYTranslation = y;
+ }
+
+ public void setDimensions(float width, float height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ public void setStaffModuleEnabled(boolean bl) {
+ this.staffModuleEnabled = bl;
+ if (!bl && this.isEnabled()) {
+ this.setState(false);
+ }
+ }
+
+ // Master toggle key bind logic (keyboard)
+ private void onKeyPress(KeyboardEvent event) {
+ if (event.getPressed() == 0) return;
+ if (event.getPressed() == this.toggleKeybind.getIntegerValue() && !this.toggleKeybind.isHasMouseBind()) {
+ this.setState(!this.enabled);
+ }
+ if (event.getPressed() == this.hideFromHUDKeybind.getIntegerValue() && !this.hideFromHUDKeybind.isHasMouseBind() && !this.notRenderHUD) {
+ this.setRenderHud(!this.renderHud);
+ }
+ if (event.getPressed() == this.tempHideFromHUDKeybind.getIntegerValue() && !this.tempHideFromHUDKeybind.isHasMouseBind()) {
+ this.setHiddenFromHud(!this.hiddenFromHud);
+ }
+ }
+
+ // Master toggle key bind logic (mice)
+ private void onMousePress(ClickEvent event) {
+ if (event.getMouseButton() == 0) return; // DO NOT REMOVE IT CAUSES SO MANY PROBLEMS
+ if (event.getMouseButton() == this.toggleKeybind.getIntegerValue() && this.toggleKeybind.isHasMouseBind()) {
+ this.setState(!this.enabled);
+ }
+ if (event.getMouseButton() == this.hideFromHUDKeybind.getIntegerValue() && this.hideFromHUDKeybind.isHasMouseBind() && !this.notRenderHUD) {
+ this.setRenderHud(!this.renderHud);
+ }
+ if (event.getMouseButton() == this.tempHideFromHUDKeybind.getIntegerValue() && this.tempHideFromHUDKeybind.isHasMouseBind()) {
+ this.setHiddenFromHud(!this.hiddenFromHud);
+ }
+ Setting nameTagsKeybind = CheatBreaker.getInstance().getModuleManager().nameTagMod.hideNamePlatesKeybind;
+ if (event.getMouseButton() == nameTagsKeybind.getIntegerValue() && nameTagsKeybind.isHasMouseBind()) {
+ CheatBreaker.getInstance().hideNameTags = !CheatBreaker.getInstance().hideNameTags;
+ }
+ }
+
+ public void setCreators(String... creators) {
+ this.creators = Arrays.asList(creators);
+ }
+
+ public void setAliases(String... aliases) {
+ this.aliases = Arrays.asList(aliases);
+ }
+
+ public void scaleAndTranslate(ScaledResolution scaledResolution) {
+ this.scaleAndTranslate(scaledResolution, this.width, this.height);
+ }
+
+ public boolean containsSettingByName(String name) {
+ for (Setting setting : this.getSettingsList()) {
+ if (setting.getSettingName().equalsIgnoreCase(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public float masterScale() {
+ float var15 = 1.0f;
+ if (this.guiScale.getValue().equals("Global")) {
+ switch ((String) CheatBreaker.getInstance().getGlobalSettings().guiScale.getValue()) {
+ case "Small":
+ var15 = var15 * 0.5F / CheatBreaker.getScaleFactor();
+ break;
+ case "Normal":
+ var15 = var15 / CheatBreaker.getScaleFactor();
+ break;
+ case "Large":
+ var15 = var15 * 1.5F / CheatBreaker.getScaleFactor();
+ break;
+ case "Auto":
+ var15 = var15 * 2.0F / CheatBreaker.getScaleFactor();
+ }
+ } else {
+ switch ((String) this.guiScale.getValue()) {
+ case "Small":
+ var15 = var15 * 0.5F / CheatBreaker.getScaleFactor();
+ break;
+ case "Normal":
+ var15 = var15 / CheatBreaker.getScaleFactor();
+ break;
+ case "Large":
+ var15 = var15 * 1.5F / CheatBreaker.getScaleFactor();
+ break;
+ case "Auto":
+ var15 = var15 * 2.0F / CheatBreaker.getScaleFactor();
+ }
+ }
+ return (Float) this.scale.getValue() * (float) CheatBreaker.getInstance().getGlobalSettings().globalGuiScale.getValue() * var15;
+ }
+
+ public void scaleAndTranslate(ScaledResolution scaledResolution, float width, float height) {
+ float f3 = 0.0f;
+ float f4 = 0.0f;
+ float scale = this.masterScale();
+ GL11.glScalef(scale, scale, scale);
+ width *= scale;
+ height *= scale;
+
+ switch (this.guiAnchor) {
+ case LEFT_TOP:
+ f3 = 2.0f;
+ f4 = 2.0f;
+ break;
+ case LEFT_MIDDLE:
+ f3 = 2.0f;
+ f4 = (float) (scaledResolution.getScaledHeight() / 2) - height / 2.0f;
+ break;
+ case LEFT_BOTTOM:
+ f4 = (float) scaledResolution.getScaledHeight() - height - 2.0f;
+ f3 = 2.0f;
+ break;
+ case MIDDLE_TOP:
+ f3 = (float) (scaledResolution.getScaledWidth() / 2) - width / 2.0f;
+ f4 = 2.0f;
+ break;
+ case MIDDLE_MIDDLE:
+ f3 = (float) (scaledResolution.getScaledWidth() / 2) - width / 2.0f;
+ f4 = (float) (scaledResolution.getScaledHeight() / 2) - height / 2.0f;
+ break;
+ case MIDDLE_BOTTOM_LEFT:
+ f3 = (float) (scaledResolution.getScaledWidth() / 2) - width;
+ f4 = (float) scaledResolution.getScaledHeight() - height - 2.0f;
+ break;
+ case MIDDLE_BOTTOM_RIGHT:
+ f3 = scaledResolution.getScaledWidth() / 2F;
+ f4 = (float) scaledResolution.getScaledHeight() - height - 2.0f;
+ break;
+ case RIGHT_TOP:
+ f3 = (float) scaledResolution.getScaledWidth() - width - 2.0f;
+ f4 = 2.0f;
+ break;
+ case RIGHT_MIDDLE:
+ f3 = (float) scaledResolution.getScaledWidth() - width;
+ f4 = (float) (scaledResolution.getScaledHeight() / 2) - height / 2.0f;
+ break;
+ case RIGHT_BOTTOM:
+ f3 = (float) scaledResolution.getScaledWidth() - width;
+ f4 = (float) scaledResolution.getScaledHeight() - height;
+ }
+
+ GL11.glTranslatef(f3 / scale, f4 / scale, 0.0f);
+ GL11.glTranslatef(this.xTranslation / scale, this.yTranslation / scale, 0.0f);
+ }
+
+ public float[] getScaledPoints(ScaledResolution scaledResolution, boolean bl) {
+ float f = 0.0f;
+ float f2 = 0.0f;
+ float f3 = this.width * this.masterScale();
+ float f4 = this.height * this.masterScale();
+ switch (this.guiAnchor) {
+ case LEFT_TOP:
+ f = 2.0f;
+ f2 = 2.0f;
+ break;
+ case LEFT_MIDDLE:
+ f = 2.0f;
+ f2 = (float) (scaledResolution.getScaledHeight() / 2) - f4 / 2.0f;
+ break;
+ case LEFT_BOTTOM:
+ f2 = (float) scaledResolution.getScaledHeight() - f4 - 2.0f;
+ f = 2.0f;
+ break;
+ case MIDDLE_TOP:
+ f = (float) (scaledResolution.getScaledWidth() / 2) - f3 / 2.0f;
+ f2 = 2.0f;
+ break;
+ case MIDDLE_MIDDLE:
+ f = (float) (scaledResolution.getScaledWidth() / 2) - f3 / 2.0f;
+ f2 = (float) (scaledResolution.getScaledHeight() / 2) - f4 / 2.0f;
+ break;
+ case MIDDLE_BOTTOM_LEFT:
+ f = (float) (scaledResolution.getScaledWidth() / 2) - f3;
+ f2 = (float) scaledResolution.getScaledHeight() - f4 - 2.0f;
+ break;
+ case MIDDLE_BOTTOM_RIGHT:
+ f = scaledResolution.getScaledWidth() / 2F;
+ f2 = (float) scaledResolution.getScaledHeight() - f4 - 2.0f;
+ break;
+ case RIGHT_TOP:
+ f = (float) scaledResolution.getScaledWidth() - f3 - 2.0f;
+ f2 = 2.0f;
+ break;
+ case RIGHT_MIDDLE:
+ f = (float) scaledResolution.getScaledWidth() - f3;
+ f2 = (float) (scaledResolution.getScaledHeight() / 2) - f4 / 2.0f;
+ break;
+ case RIGHT_BOTTOM:
+ f = (float) scaledResolution.getScaledWidth() - f3;
+ f2 = (float) scaledResolution.getScaledHeight() - f4;
+ }
+ return new float[]{(f + (bl ? this.xTranslation : 0.0f)) / this.masterScale(), (f2 + (bl ? this.yTranslation : 0.0f)) / this.masterScale()};
+ }
+
+ public void setAnchor(GuiAnchor anchor) {
+ if (anchor != this.defaultGuiAnchor) {
+ CheatBreaker.getInstance().getConfigManager().createNewProfile();
+ }
+ this.guiAnchor = anchor;
+ }
+
+ public void setDefaultAnchor(GuiAnchor anchor) {
+ this.guiAnchor = anchor;
+ this.defaultGuiAnchor = anchor;
+ }
+
+ public Position getPosition() {
+ return AnchorHelper.getHorizontalPositionEnum(this.guiAnchor);
+ }
+
+ protected void setPreviewIcon(ResourceLocation resourceLocation, int width, int height) {
+ this.previewType = PreviewType.ICON;
+ this.previewIcon = resourceLocation;
+ this.previewIconWidth = width;
+ this.previewIconHeight = height;
+ }
+
+ protected void setPreviewLabel(String label, float size) {
+ this.previewType = PreviewType.LABEL;
+ this.previewLabel = label;
+ this.previewLabelSize = size;
+ }
+
+ public void setRenderHud(boolean bl) {
+ if (bl != this.defaultRenderHud) {
+ CheatBreaker.getInstance().getConfigManager().createNewProfile();
+ }
+ this.renderHud = bl;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/ModuleManager.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/ModuleManager.java
new file mode 100644
index 0000000..db3c4a3
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/ModuleManager.java
@@ -0,0 +1,244 @@
+package com.cheatbreaker.client.module;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.event.EventBus;
+import com.cheatbreaker.client.event.impl.keyboard.KeyboardEvent;
+import com.cheatbreaker.client.event.impl.network.ConnectEvent;
+import com.cheatbreaker.client.event.impl.network.DisconnectEvent;
+import com.cheatbreaker.client.event.impl.network.LoadWorldEvent;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.module.data.SettingType;
+import com.cheatbreaker.client.module.impl.disallowed.DisallowedModManager;
+import com.cheatbreaker.client.module.impl.fixes.ModuleKeyBindFix;
+import com.cheatbreaker.client.module.impl.normal.hud.simple.combat.*;
+import com.cheatbreaker.client.module.impl.normal.hypixel.*;
+import com.cheatbreaker.client.module.impl.normal.animation.ModuleOneSevenVisuals;
+import com.cheatbreaker.client.module.impl.normal.hud.*;
+import com.cheatbreaker.client.module.impl.normal.hud.armorstatus.ModuleArmorStatus;
+import com.cheatbreaker.client.module.impl.normal.hud.chat.ModuleChat;
+import com.cheatbreaker.client.module.impl.normal.hud.cooldowns.ModuleCooldowns;
+import com.cheatbreaker.client.module.impl.normal.hud.keystrokes.ModuleKeyStrokes;
+import com.cheatbreaker.client.module.impl.normal.hud.simple.module.*;
+import com.cheatbreaker.client.module.impl.normal.hypixel.ModuleNickHider;
+import com.cheatbreaker.client.module.impl.normal.misc.ModuleAutoText;
+import com.cheatbreaker.client.module.impl.normal.misc.ModulePackTweaks;
+import com.cheatbreaker.client.module.impl.normal.misc.ModuleTeamMates;
+import com.cheatbreaker.client.module.impl.normal.misc.ModuleZansMiniMap;
+import com.cheatbreaker.client.module.impl.normal.perspective.ModuleDragToLook;
+import com.cheatbreaker.client.module.impl.normal.perspective.ModulePerspective;
+import com.cheatbreaker.client.module.impl.normal.perspective.ModuleSnapLook;
+import com.cheatbreaker.client.module.impl.normal.shader.ModuleMotionBlur;
+import com.cheatbreaker.client.module.impl.normal.vanilla.*;
+import com.cheatbreaker.client.module.impl.packmanager.ResourcePackManager;
+import com.cheatbreaker.client.module.impl.staff.StaffMod;
+import com.cheatbreaker.client.module.impl.staff.impl.StaffModuleBunnyhop;
+import com.cheatbreaker.client.module.impl.staff.impl.StaffModuleNameTags;
+import com.cheatbreaker.client.module.impl.staff.impl.StaffModuleNoClip;
+import com.cheatbreaker.client.module.impl.staff.impl.StaffModuleXray;
+import com.cheatbreaker.client.ui.element.type.custom.KeybindElement;
+import com.cheatbreaker.client.util.voicechat.ModuleVoiceChat;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.multiplayer.ServerData;
+import net.minecraft.util.EnumChatFormatting;
+
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+public class ModuleManager {
+ public final List playerMods = new ArrayList<>();
+ public final List staffMods = new ArrayList<>();
+
+ public final Map keybinds = new HashMap<>();
+
+ @Setter public String currentModule;
+ @Setter public int lastSettingScrollPos;
+
+ public final ModuleCoordinates coordinatesMod;
+ public final ModuleZansMiniMap miniMapMod;
+ public final SimpleModuleToggleSprint toggleSprintMod;
+ public final SimpleModuleHearingAssistance hearingAssistance;
+ public final ModulePotionEffects potionEffectsMod;
+ public final ModuleArmorStatus armourStatus;
+ public final ModuleKeyStrokes keystrokesMod;
+ public final ModuleScoreboard scoreboardMod;
+ public final ModuleCooldowns coolDownsMod;
+ public final ModuleNotifications notificationsMod;
+ public final ModuleDirectionHUD directionHUDMod;
+ public final ModuleCrosshair crosshairMod;
+ public final ModuleEnchantmentGlint enchantmentGlintMod;
+ public final ModuleBossBar bossBarMod;
+
+ public final SimpleModulePotionCounter potionCounterMod;
+ public final SimpleModuleCPS cpsMod;
+ public final SimpleModuleFPS fpsMod;
+ public final SimpleModuleMemoryUsage memoryUsageMod;
+ public final SimpleModuleComboCounter comboCounterMod;
+ public final SimpleModuleSprintResetCounter sprintResetCounterMod;
+ public final SimpleModuleReachDisplay reachDisplayMod;
+ public final SimpleModuleServerAddress serverAddressMod;
+ public final SimpleModulePing pingMod;
+ public final SimpleModuleClock clockMod;
+ public final SimpleModuleSaturation saturationMod;
+ public final SimpleModulePackDisplay packDisplayMod;
+ public final SimpleModuleFlickTracker flickTrackerMod;
+
+ public final ModuleMotionBlur motionBlurMod;
+ public final ModuleHitColor hitColorMod;
+ public final ModuleParticles particlesMod;
+ public final ModuleNameTag nameTagMod;
+ public final ModuleBlockOverlay blockOverlayMod;
+ public final ModulePackTweaks packTweaksMod;
+ public final ModuleEnvironmentChanger environmentChangerMod;
+// public final ModulePlayerList playerListMod;
+ public final ModuleChat chatMod;
+ public final CollectionModuleHypixel hypixelMod;
+ public final ModuleOneSevenVisuals animationsMod;
+ public final ModuleNickHider nickHiderMod;
+ public final ModuleAutoText autoTextMod;
+ public final ModuleTNTTimer tntTimerMod;
+
+ public final StaffModuleXray xray;
+ public final StaffModuleNameTags staffNameTags;
+ public final StaffModuleNoClip staffNoClip;
+ public final StaffModuleBunnyhop staffBunnyhop;
+
+ public final ModuleDragToLook dragToLook;
+ public final ModuleSnapLook snapLook;
+ public final ModuleTeamMates teammatesMod;
+ public final ModuleVoiceChat voiceChat;
+ public final ModulePerspective perspectiveMod;
+ public final ModuleKeyBindFix keybindFix;
+ public final ModuleHitboxes hitboxesMod;
+
+ public final DisallowedModManager disallowedModManager;
+
+ public ModuleManager(EventBus eventManager) {
+ CheatBreaker.getInstance().logger.info(CheatBreaker.getInstance().loggerPrefix + "Created Mod Manager");
+
+ this.playerMods.add(this.coordinatesMod = new ModuleCoordinates());
+ this.playerMods.add(this.animationsMod = new ModuleOneSevenVisuals());
+ this.playerMods.add(this.miniMapMod = new ModuleZansMiniMap());
+ this.playerMods.add(this.toggleSprintMod = new SimpleModuleToggleSprint());
+ this.playerMods.add(this.potionEffectsMod = new ModulePotionEffects());
+ this.playerMods.add(this.armourStatus = new ModuleArmorStatus());
+ this.playerMods.add(this.keystrokesMod = new ModuleKeyStrokes());
+ this.playerMods.add(this.scoreboardMod = new ModuleScoreboard());
+// this.playerMods.add(this.playerListMod = new ModulePlayerList());
+ this.playerMods.add(this.chatMod = new ModuleChat());
+ this.playerMods.add(this.bossBarMod = new ModuleBossBar());
+ this.playerMods.add(this.coolDownsMod = new ModuleCooldowns());
+ this.playerMods.add(this.notificationsMod = new ModuleNotifications());
+ this.playerMods.add(this.directionHUDMod = new ModuleDirectionHUD());
+ this.playerMods.add(this.environmentChangerMod = new ModuleEnvironmentChanger());
+ this.playerMods.add(this.enchantmentGlintMod = new ModuleEnchantmentGlint());
+ this.playerMods.add(this.crosshairMod = new ModuleCrosshair());
+ this.playerMods.add(this.hitColorMod = new ModuleHitColor());
+ this.playerMods.add(this.particlesMod = new ModuleParticles());
+ this.playerMods.add(this.nameTagMod = new ModuleNameTag());
+ this.playerMods.add(this.nickHiderMod = new ModuleNickHider());
+ this.playerMods.add(this.autoTextMod = new ModuleAutoText());
+ this.playerMods.add(this.tntTimerMod = new ModuleTNTTimer());
+ this.playerMods.add(this.blockOverlayMod = new ModuleBlockOverlay());
+ this.playerMods.add(this.packTweaksMod = new ModulePackTweaks());
+ this.playerMods.add(this.perspectiveMod = new ModulePerspective());
+ this.playerMods.add(this.hitboxesMod = new ModuleHitboxes());
+ this.playerMods.add(this.hearingAssistance = new SimpleModuleHearingAssistance());
+ this.playerMods.add(this.hypixelMod = new CollectionModuleHypixel());
+
+ new Timer().scheduleAtFixedRate(new AutoTipThread(), TimeUnit.SECONDS.toMillis(15L), TimeUnit.MINUTES.toMillis(1L));
+
+ this.playerMods.add(this.cpsMod = new SimpleModuleCPS());
+ this.playerMods.add(this.fpsMod = new SimpleModuleFPS());
+ this.playerMods.add(this.memoryUsageMod = new SimpleModuleMemoryUsage());
+ this.playerMods.add(this.potionCounterMod = new SimpleModulePotionCounter());
+ this.playerMods.add(this.comboCounterMod = new SimpleModuleComboCounter());
+ this.playerMods.add(this.sprintResetCounterMod = new SimpleModuleSprintResetCounter());
+ this.playerMods.add(this.reachDisplayMod = new SimpleModuleReachDisplay());
+ this.playerMods.add(this.serverAddressMod = new SimpleModuleServerAddress());
+ this.playerMods.add(this.pingMod = new SimpleModulePing());
+ this.playerMods.add(this.clockMod = new SimpleModuleClock());
+ this.playerMods.add(this.saturationMod = new SimpleModuleSaturation());
+ this.playerMods.add(this.flickTrackerMod = new SimpleModuleFlickTracker());
+ this.playerMods.add(this.packDisplayMod = new SimpleModulePackDisplay());
+ //this.playerMods.add(this.flickTrackerMod = new SimpleFlickTrackerModule());
+ this.playerMods.add(this.motionBlurMod = new ModuleMotionBlur());
+
+ this.staffMods.add(this.xray = new StaffModuleXray());
+ this.staffMods.add(this.staffNameTags = new StaffModuleNameTags());
+ this.staffMods.add(this.staffNoClip = new StaffModuleNoClip());
+ this.staffMods.add(this.staffBunnyhop = new StaffModuleBunnyhop());
+
+ this.voiceChat = new ModuleVoiceChat();
+ this.dragToLook = new ModuleDragToLook();
+ this.snapLook = new ModuleSnapLook();
+ this.teammatesMod = new ModuleTeamMates();
+ this.keybindFix = new ModuleKeyBindFix();
+
+ this.teammatesMod.setEnabled(true);
+ new ResourcePackManager();
+
+ disallowedModManager = new DisallowedModManager();
+ disallowedModManager.startup();
+
+ eventManager.addEvent(LoadWorldEvent.class, this::setWorldTime);
+ eventManager.addEvent(KeyboardEvent.class, this::handleStaffModKeybind);
+ eventManager.addEvent(ConnectEvent.class, ignored -> {
+ ServerData serverData = Minecraft.getMinecraft().currentServerData;
+ if (serverData != null) {
+ CheatBreaker.getInstance().syncCurrentServerWithAssetServer(serverData.serverIP, serverData.domain, serverData.port);
+ }
+ });
+
+ eventManager.addEvent(DisconnectEvent.class, ignored -> {
+ CheatBreaker.getInstance().syncCurrentServerWithAssetServer("", "", 0);
+ for (AbstractModule var3 : this.staffMods) {
+ var3.setState(false);
+ var3.setStaffModuleEnabled(false);
+ }
+ });
+ }
+
+ private void setWorldTime(LoadWorldEvent event) {
+ if (this.environmentChangerMod.isEnabled()) this.environmentChangerMod.setWorldTime();
+ }
+
+ public boolean isBoundToAnother(Setting settingIn, int key) {
+ boolean flag = false;
+ for (Setting setting : this.keybinds.keySet()) {
+ if (setting.getType() == SettingType.INTEGER) {
+ // Key code check
+ if (setting.isHasKeycode() && key == setting.getKeyCode()) {
+ flag = true;
+ }
+ // Mouse bind check
+ if (setting.isHasMouseBind() && key == setting.getIntegerValue()) {
+ flag = true;
+ }
+ // General check
+ if ((setting.getSettingName().toLowerCase().startsWith("hot key") || setting.getSettingName().toLowerCase().endsWith("keybind")) && key == setting.getIntegerValue()) {
+ flag = true;
+ }
+ }
+ }
+
+ if (flag)
+ CheatBreaker.getInstance().getModuleManager().notificationsMod.send("error", EnumChatFormatting.RED + settingIn.getSettingName() + " is already bound to another keybind!", 5000L);
+
+ return flag;
+ }
+
+ public AbstractModule getModByName(String name) {
+ return this.playerMods.stream().filter(m -> m.getName().equalsIgnoreCase(name)).findFirst().orElse(null);
+ }
+
+ private void handleStaffModKeybind(KeyboardEvent event) {
+ if (event.getPressed() != 0) {
+ for (StaffMod staffMod : this.staffMods) {
+ if (!staffMod.isStaffModuleEnabled() || (Integer) staffMod.getKeybindSetting().getValue() != event.getPressed())
+ continue;
+ staffMod.setState(!staffMod.isEnabled());
+ }
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/ModuleCommand.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/ModuleCommand.java
new file mode 100644
index 0000000..b75c670
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/ModuleCommand.java
@@ -0,0 +1,15 @@
+package com.cheatbreaker.client.module.command;
+
+import com.cheatbreaker.client.module.AbstractModule;
+import lombok.*;
+
+@Getter @AllArgsConstructor
+public abstract class ModuleCommand {
+ public final AbstractModule mod;
+ private final String command;
+
+ /*
+ Handles the command.
+ */
+ public abstract void handle();
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/ModuleCommandManager.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/ModuleCommandManager.java
new file mode 100644
index 0000000..b7a570e
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/ModuleCommandManager.java
@@ -0,0 +1,28 @@
+package com.cheatbreaker.client.module.command;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.module.command.impl.*;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.ChatComponentText;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ModuleCommandManager {
+ public List moduleCommands = new ArrayList<>();
+
+ public IncreaseTimeCommand increaseStaticTimeCommand;
+ public DecreaseTimeCommand decreaseStaticTimeCommand;
+
+ public ModuleCommandManager() {
+ this.moduleCommands.add(this.increaseStaticTimeCommand = new IncreaseTimeCommand());
+ this.moduleCommands.add(this.decreaseStaticTimeCommand = new DecreaseTimeCommand());
+ }
+
+ public void sendModCommandCallback(ChatComponentText chatComponent) {
+ if (CheatBreaker.getInstance().getGlobalSettings().hideCallbackMessages.getBooleanValue()) return;
+
+ chatComponent.setBranded(true);
+ Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(chatComponent);
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/impl/DecreaseTimeCommand.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/impl/DecreaseTimeCommand.java
new file mode 100644
index 0000000..889ceba
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/impl/DecreaseTimeCommand.java
@@ -0,0 +1,37 @@
+package com.cheatbreaker.client.module.command.impl;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.module.command.ModuleCommand;
+import com.cheatbreaker.client.module.impl.normal.vanilla.ModuleEnvironmentChanger;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class DecreaseTimeCommand extends ModuleCommand {
+
+ public DecreaseTimeCommand() {
+ super(CheatBreaker.getInstance().getModuleManager().environmentChangerMod, "/cb_decrease_time");
+ }
+
+ @Override
+ public void handle() {
+ long decreaseAmount = Integer.parseInt(((ModuleEnvironmentChanger)this.mod).worldTime.getValue().toString()) - ((ModuleEnvironmentChanger)this.mod).increaseDecreaseAmount.getIntegerValue();
+
+ if (((ModuleEnvironmentChanger)this.mod).timeType.getStringValue().equalsIgnoreCase("Static")) {
+ if (Minecraft.getMinecraft().theWorld != null) {
+ if (decreaseAmount < -22880) {
+ return;
+ }
+ ((ModuleEnvironmentChanger)this.mod).worldTime.setValue(Integer.parseInt(((ModuleEnvironmentChanger)this.mod).worldTime.getValue().toString())
+ - ((ModuleEnvironmentChanger)this.mod).increaseDecreaseAmount.getIntegerValue());
+ Minecraft.getMinecraft().theWorld.setWorldTime(decreaseAmount);
+
+ String msg = "Decreased time by " + CheatBreaker.getInstance().getModuleManager().environmentChangerMod.increaseDecreaseAmount.getIntegerValue() + ".";
+ CheatBreaker.getInstance().getModuleCommandManager().sendModCommandCallback(new ChatComponentText(msg));
+ }
+ } else {
+ String msg = EnumChatFormatting.RED + "This mod command only works with the \"Static\" time type.";
+ CheatBreaker.getInstance().getModuleCommandManager().sendModCommandCallback(new ChatComponentText(msg));
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/impl/IncreaseTimeCommand.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/impl/IncreaseTimeCommand.java
new file mode 100644
index 0000000..0402967
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/command/impl/IncreaseTimeCommand.java
@@ -0,0 +1,37 @@
+package com.cheatbreaker.client.module.command.impl;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.module.command.ModuleCommand;
+import com.cheatbreaker.client.module.impl.normal.vanilla.ModuleEnvironmentChanger;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class IncreaseTimeCommand extends ModuleCommand {
+
+ public IncreaseTimeCommand() {
+ super(CheatBreaker.getInstance().getModuleManager().environmentChangerMod, "/cb_increase_time");
+ }
+
+ @Override
+ public void handle() {
+ long increaseAmount = Integer.parseInt(((ModuleEnvironmentChanger)this.mod).worldTime.getValue().toString()) + ((ModuleEnvironmentChanger)this.mod).increaseDecreaseAmount.getIntegerValue();
+
+ if (((ModuleEnvironmentChanger)this.mod).timeType.getStringValue().equalsIgnoreCase("Static")) {
+ if (Minecraft.getMinecraft().theWorld != null) {
+ if (increaseAmount > -6100) {
+ return;
+ }
+ ((ModuleEnvironmentChanger)this.mod).worldTime.setValue(Integer.parseInt(((ModuleEnvironmentChanger)this.mod).worldTime.getValue().toString())
+ + ((ModuleEnvironmentChanger)this.mod).increaseDecreaseAmount.getIntegerValue());
+ Minecraft.getMinecraft().theWorld.setWorldTime(increaseAmount);
+
+ String msg = "Increased time by " + CheatBreaker.getInstance().getModuleManager().environmentChangerMod.increaseDecreaseAmount.getIntegerValue() + ".";
+ CheatBreaker.getInstance().getModuleCommandManager().sendModCommandCallback(new ChatComponentText(msg));
+ }
+ } else {
+ String msg = EnumChatFormatting.RED + "This mod command only works with the \"Static\" time type.";
+ CheatBreaker.getInstance().getModuleCommandManager().sendModCommandCallback(new ChatComponentText(msg));
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/CustomizationLevel.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/CustomizationLevel.java
new file mode 100644
index 0000000..9410e8c
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/CustomizationLevel.java
@@ -0,0 +1,10 @@
+package com.cheatbreaker.client.module.data;
+
+/**
+ * Defines all the customization levels for mods and settings.
+ */
+public enum CustomizationLevel {
+ SIMPLE,
+ MEDIUM,
+ ADVANCED
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/MiniMapRules.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/MiniMapRules.java
new file mode 100644
index 0000000..201e3c4
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/MiniMapRules.java
@@ -0,0 +1,10 @@
+package com.cheatbreaker.client.module.data;
+
+/**
+ * Defines all Waypoint levels for Voxel Map.
+ */
+public enum MiniMapRules {
+ NEUTRAL,
+ ALLOWED,
+ FORCED_OFF
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/PreviewType.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/PreviewType.java
new file mode 100644
index 0000000..ae7cd13
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/PreviewType.java
@@ -0,0 +1,9 @@
+package com.cheatbreaker.client.module.data;
+
+/**
+ * Defines all types of preview types for the mod list.
+ */
+public enum PreviewType {
+ LABEL,
+ ICON
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/ScreenLocation.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/ScreenLocation.java
new file mode 100644
index 0000000..554740c
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/ScreenLocation.java
@@ -0,0 +1,11 @@
+package com.cheatbreaker.client.module.data;
+
+/**
+ * Defines all locations a module can be on the screen.
+ */
+public enum ScreenLocation {
+ RIGHT_BOTTOM,
+ LEFT_BOTTOM,
+ RIGHT_TOP,
+ LEFT_TOP
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/Setting.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/Setting.java
new file mode 100644
index 0000000..4715cbc
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/Setting.java
@@ -0,0 +1,308 @@
+package com.cheatbreaker.client.module.data;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.module.AbstractModule;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.BooleanSupplier;
+import java.util.function.Consumer;
+
+/**
+ * Defines a Setting for CheatBreaker Modules and CheatBreaker Settings.
+ */
+@Getter
+public class Setting {
+ private final String settingName;
+ private String settingDescription = "";
+ private String unit = "";
+ private String centerLabel = "";
+ private String leftIcon = "";
+ private String rightIcon = "";
+ private String[] acceptedStringValues;
+
+ private int keyCode; // done since keybind element is so good
+ @Setter private boolean hasKeycode;
+
+ @Setter private boolean hasMouseBind;
+
+ private boolean showValue = true;
+ public boolean rainbow;
+ public boolean speed;
+
+ public int[] color;
+
+ private Object value;
+ private Object minimumValue;
+ private Object maximumValue;
+ private Object acceptedValue;
+ private Object customizationLevel;
+ private Object[] acceptedValues;
+
+ private Consumer changeConsumer;
+
+ private Setting parent;
+
+ private BooleanSupplier condition;
+
+ private AbstractModule container;
+
+ public Setting(String settingName) {
+ this.settingName = settingName;
+ }
+
+ public Setting(AbstractModule container, String settingName) {
+ this.container = container;
+ container.getSettingsList().add(this);
+ this.settingName = settingName;
+ }
+
+ public Setting(AbstractModule container, String settingName, String description) {
+ this.container = container;
+ container.getSettingsList().add(this);
+ this.settingName = settingName;
+ this.settingDescription = description;
+ }
+
+ public Setting(List list, String settingName) {
+ list.add(this);
+ this.settingName = settingName;
+ }
+
+ public Setting(List list, String settingName, String description) {
+ list.add(this);
+ this.settingName = settingName;
+ this.settingDescription = description;
+ }
+
+ /**
+ * Returns the color value for text color, background color, etc.
+ */
+ public int getColorValue() {
+ if (this.rainbow) {
+ Integer var1 = (Integer) this.value;
+ int var2 = var1 >> 24 & 0xFF;
+ float var3 = (float) System.nanoTime() / 1.0E10f % 1.0f;
+ if (this.speed)
+ return var2 << 24 | Color.HSBtoRGB((float) (System.currentTimeMillis() % 1000L) / 1000.0f, 1.0f, 1.0f) & 0xFFFFFF;
+ return var2 << 24 | Color.HSBtoRGB(var3, 1.0f, 1.0f) & 0xFFFFFF;
+ }
+ return (Integer) this.value;
+ }
+
+ public Color getColorFromColorValue(int colorValue) {
+ float A = (float)(colorValue >> 24 & 255) / 255.0F;
+ float R = (float)(colorValue >> 16 & 255) / 255.0F;
+ float G = (float)(colorValue >> 8 & 255) / 255.0F;
+ float B = (float)(colorValue & 255) / 255.0F;
+
+ return new Color(R, G, B, A);
+ }
+
+ /**
+ * Casts and returns the value as a boolean.
+ */
+ public boolean getBooleanValue() {
+ return (Boolean) this.value;
+ }
+
+ /**
+ * Casts and returns the value as a string.
+ */
+ public String getStringValue() {
+ return (String) this.value;
+ }
+
+ /**
+ * Casts and returns the value as a float.
+ */
+ public float getFloatValue() {
+ return (Float) this.value;
+ }
+
+ /**
+ * Casts and returns the value as an integer.
+ */
+ public int getIntegerValue() {
+ return (Integer) this.value;
+ }
+
+ /**
+ * Casts and returns the value as an ArrayList.
+ */
+ public ArrayList getArrayListValue() {
+ return (ArrayList) this.value;
+ }
+
+ /**
+ * Sets a singular accepted value for a setting.
+ */
+ public Setting acceptedValue(Object value) {
+ this.acceptedValue = value;
+ return this;
+ }
+
+ /**
+ * Gets the parent setting value.
+ */
+ public boolean getParentValue() {
+ return this.parent != null && (Boolean) this.parent.getValue();
+ }
+
+ /**
+ * Sets the value of a setting.
+ */
+ public Setting setValue(Object value) {
+ return this.updateSettingValue(value, true);
+ }
+
+ public Setting setMouseBind(boolean hasMouseBind) {
+ this.hasMouseBind = hasMouseBind;
+ return this;
+ }
+
+ /**
+ * Updates a setting value.
+ */
+ public Setting updateSettingValue(Object value, boolean usingDefaultProfile) {
+ if (CheatBreaker.getInstance().getConfigManager().activeProfile != null && CheatBreaker.getInstance().getConfigManager().activeProfile.getName().equals("default")) {
+ if (usingDefaultProfile) {
+ CheatBreaker.getInstance().getConfigManager().createNewProfile();
+ }
+ } else if (this.container != null) {
+ this.container.getDefaultSettingsValues().add(value);
+ }
+ this.value = value;
+ if (this.changeConsumer != null) {
+ this.changeConsumer.accept(value);
+ }
+ return this;
+ }
+
+ /**
+ * Sets the accepted String values of a setting.
+ */
+ public Setting acceptedStringValues(String... values) {
+ this.acceptedStringValues = values;
+ return this;
+ }
+
+ public Setting setKeyCode(int keycode) {
+ this.keyCode = keycode;
+ this.hasKeycode = true;
+ return this;
+ }
+
+ /**
+ * Sets the accepted values of a setting.
+ */
+ public Setting acceptedValues(Object... values) {
+ this.acceptedValues = values;
+ return this;
+ }
+
+ /**
+ * Gets fired when a setting is changed.
+ */
+ public Setting onChange(Consumer var1) {
+ this.changeConsumer = var1;
+ return this;
+ }
+
+ /**
+ * Sets min and max slider values
+ */
+ public Setting setMinMax(Object minValue, Object maxValue) {
+ this.minimumValue = minValue;
+ this.maximumValue = maxValue;
+ return this;
+ }
+
+ /**
+ * Sets the customization level of the setting.
+ */
+ public Setting setCustomizationLevel(Object level) {
+ this.customizationLevel = level;
+ return this;
+ }
+
+ /**
+ * Sets the setting condition.
+ */
+ public Setting setCondition(BooleanSupplier condition) {
+ this.condition = condition;
+ return this;
+ }
+
+ /**
+ * Sets the parent setting.
+ */
+ public Setting setParent(Setting parent) {
+ if (parent.getType() != SettingType.BOOLEAN) {
+ throw new IllegalStateException("Parent can only be boolean.");
+ }
+ this.parent = parent;
+ return this;
+ }
+
+ /**
+ * Gets the setting type.
+ */
+ public SettingType getType() {
+ if (this.value.getClass().isAssignableFrom(Boolean.class)) {
+ return SettingType.BOOLEAN;
+ }
+ if (this.value.getClass().isAssignableFrom(ArrayList.class) && this.acceptedValues != null && this.acceptedValues.length != 0) {
+ return SettingType.ARRAYLIST;
+ }
+ if (this.value.getClass().isAssignableFrom(String.class)) {
+ return this.acceptedStringValues != null && this.acceptedStringValues.length != 0 ? SettingType.STRING_ARRAY : SettingType.STRING;
+ }
+ if (this.value.getClass().isAssignableFrom(Float.class)) {
+ return SettingType.FLOAT;
+ }
+ if (this.value.getClass().isAssignableFrom(Double.class)) {
+ return SettingType.DOUBLE;
+ }
+ if (this.value.getClass().isAssignableFrom(String[].class)) {
+ return SettingType.STRING_ARRAY;
+ }
+ return this.value.getClass().isAssignableFrom(Integer.class) ? SettingType.INTEGER : null;
+ }
+
+ /**
+ * Sets unit string.
+ */
+ public Setting setUnit(String value) {
+ this.unit = value;
+ return this;
+ }
+
+ /**
+ * Sets showValue boolean.
+ */
+ public Setting setShowValue(boolean value) {
+ this.showValue = value;
+ return this;
+ }
+
+ /**
+ * Sets the center label of the setting.
+ */
+ public Setting setCenterLabel(String label) {
+ this.centerLabel = label;
+ return this;
+ }
+
+ /**
+ * Sets the setting's icons.
+ */
+ public Setting setIcons(String leftIcon, String rightIcon) {
+ this.leftIcon = leftIcon;
+ this.rightIcon = rightIcon;
+ return this;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/SettingType.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/SettingType.java
new file mode 100644
index 0000000..5346033
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/data/SettingType.java
@@ -0,0 +1,16 @@
+package com.cheatbreaker.client.module.data;
+
+/**
+ * Defines the data types a CheatBreaker setting can be.
+ */
+public enum SettingType {
+ STRING,
+ STRING_ARRAY,
+ FLOAT,
+ INTEGER,
+ DOUBLE,
+ BOOLEAN,
+ ARRAYLIST,
+ SHORT,
+ FILE // Will be used later for custom image choosing.
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/disallowed/DisallowedModManager.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/disallowed/DisallowedModManager.java
new file mode 100644
index 0000000..2e52115
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/disallowed/DisallowedModManager.java
@@ -0,0 +1,34 @@
+package com.cheatbreaker.client.module.impl.disallowed;
+
+import lombok.Getter;
+
+import java.util.*;
+
+@Getter
+public class DisallowedModManager {
+
+ public final Map> moduleBlockedServers = new HashMap<>();
+
+ public boolean disallows(String serverIp, String module) {
+ for (Map.Entry> entries : moduleBlockedServers.entrySet())
+ {
+ if (serverIp.contains(entries.getKey())) {
+
+ return entries.getValue().stream()
+ .filter(m -> m.contains(module))
+ .findFirst()
+ .orElse(null) != null;
+ }
+ }
+
+ return false;
+ }
+
+ /*
+ Pretty bad way of doing this but until we have a websocket function to pull from
+ I'm doing it like this cry about it
+ */
+ public void startup() {
+ moduleBlockedServers.put("hypixel", Arrays.asList("freelook", "auto text"));
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/fixes/ModuleKeyBindFix.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/fixes/ModuleKeyBindFix.java
new file mode 100644
index 0000000..e3ca661
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/fixes/ModuleKeyBindFix.java
@@ -0,0 +1,61 @@
+package com.cheatbreaker.client.module.impl.fixes;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.config.GlobalSettings;
+import com.cheatbreaker.client.event.impl.tick.TickEvent;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.GameSettings;
+import net.minecraft.client.settings.KeyBinding;
+import org.lwjgl.input.Keyboard;
+
+import java.lang.reflect.Field;
+
+/**
+ * @Module - Keybind Fix
+ * This module allows for keybind persistence in containers, and chat menus.
+ *
+ * This fix can be seen in Vanilla Minecraft 1.12+.
+ */
+public class ModuleKeyBindFix {
+ private boolean hadAScreen;
+ private final Minecraft mc = Minecraft.getMinecraft();
+
+ public ModuleKeyBindFix() {
+ CheatBreaker.getInstance().getEventBus().addEvent(TickEvent.class, this::handleTick);
+ }
+
+ public void handleTick(TickEvent event) {
+ boolean hasScreen = mc.currentScreen != null;
+ GlobalSettings globalSettings = CheatBreaker.getInstance().getGlobalSettings();
+ if (!hasScreen && hadAScreen && globalSettings.keybindFix.getBooleanValue()) {
+ Class> gameSettingsClass = GameSettings.class;
+ Field[] fields = gameSettingsClass.getDeclaredFields();
+ for (Field field : fields) {
+ if (field.getType().equals(KeyBinding.class)) {
+ field.setAccessible(true);
+
+ try {
+ KeyBinding keyBinding = (KeyBinding) field.get(mc.gameSettings);
+ boolean excludeSneak = !globalSettings.excludeSneakKeybind.getBooleanValue() || !keyBinding.getKeyDescription().equalsIgnoreCase("key.sneak");
+ boolean excludeThrow = !globalSettings.excludeThrowKeybind.getBooleanValue() || !keyBinding.getKeyDescription().equalsIgnoreCase("key.use");
+
+ if (!keyBinding.getKeyDescription().equalsIgnoreCase("key.inventory")
+ && !keyBinding.getKeyDescription().equalsIgnoreCase("key.chat")
+ && !keyBinding.getKeyDescription().equalsIgnoreCase("key.command")
+ && excludeSneak
+ && excludeThrow
+ && keyBinding.getKeyCode() > 0
+ && Keyboard.isKeyDown(keyBinding.getKeyCode())
+ ) {
+ KeyBinding.setKeyBindState(keyBinding.getKeyCode(), true);
+ KeyBinding.onTick(keyBinding.getKeyCode());
+ }
+ } catch (Exception var9) {
+ var9.printStackTrace();
+ }
+ }
+ }
+ }
+ this.hadAScreen = hasScreen;
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/ModuleOneSevenVisuals.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/ModuleOneSevenVisuals.java
new file mode 100644
index 0000000..821f81a
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/ModuleOneSevenVisuals.java
@@ -0,0 +1,58 @@
+package com.cheatbreaker.client.module.impl.normal.animation;
+
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.module.data.Setting;
+
+/**
+ * @Module - ModuleOneSevenVisuals
+ * @see AbstractModule
+ *
+ * This mod reverts all changed visuals to their 1.7 counterparts.
+ */
+public class ModuleOneSevenVisuals extends AbstractModule {
+ public static Setting oldModel;
+ public static Setting oldBow;
+ public static Setting oldSwordBlock;
+ public static Setting oldRod;
+ public static Setting oldSwordBlock3;
+ public static Setting oldEating;
+ public static Setting oldBlockHitting;
+ public static Setting smoothSneaking;
+ public static Setting longSneaking;
+ public static Setting redArmor;
+ public static Setting punching;
+ public static Setting itemSwitch;
+ public static Setting oldHealth;
+ public static Setting oldDebugScreen;
+ public static Setting oldTab;
+ public static Setting oldDebugHitbox;
+
+ public ModuleOneSevenVisuals() {
+ super("1.7 Animations");
+ this.setDescription("Revert certain visuals to appear like their 1.7 counterpart.");
+ this.setPreviewLabel("1.7 <-> 1.8", 1.0f);
+ this.setCreators("OrangeMarshall");
+ this.setAliases("1.7 Visuals", "Old Animations");
+ this.setDefaultState(true);
+
+ new Setting(this, "label").setValue("Position Settings");
+ oldModel = new Setting(this, "1.7 Item Positions", "Change all item models to be in the same position as 1.7.").setValue(true);
+ oldBow = new Setting(this, "1.7 Bow Pullback", "Change the bow pullback animation to be like 1.7.").setValue(true);
+ oldSwordBlock = new Setting(this, "1.7 Block Animation", "Change the sword block animation to be like 1.7.").setValue(true);
+ oldRod = new Setting(this, "1.7 Rod Position", "Change all item models to be in the same position as 1.7.").setValue(true);
+ oldSwordBlock3 = new Setting(this, "1.7 3rd Person Block Animation", "Change the 3rd person blocking animation to be like 1.7.").setValue(true);
+
+ new Setting(this, "label").setValue("Interaction Settings");
+ oldEating = new Setting(this, "Consume Animation", "Change the eating and drinking animation to look like 1.7.").setValue(true);
+ oldBlockHitting = new Setting(this, "Block-Hitting Animation", "Makes block hitting look much smoother, like it did in 1.7.").setValue(true);
+ smoothSneaking = new Setting(this, "Smooth Sneaking", "Makes the transition between sneaking/not sneaking smooth.\\n§eCombine with longer unsneak to match 1.7.").setValue(true);
+ longSneaking = new Setting(this, "Longer Unsneak", "Makes moving up take longer than moving down\\n§eCombine with smooth sneaking to match 1.7.").setValue(true).setCondition(() -> smoothSneaking.getBooleanValue());
+ punching = new Setting(this, "Punching During Usage", "Allows you to punch blocks whilst using an item.\\n§eVisual only.").setValue(true);
+ itemSwitch = new Setting(this, "Item Switching Animation", "Stop held items from playing the switching animation when right clicking on blocks.").setValue(true);
+ redArmor = new Setting(this, "1.7 Hit Color Brightness", "Set the hit color to use 1.7's brightness system, darkening the hit color.").setValue(true);
+
+ new Setting(this, "label").setValue("HUD Settings");
+ oldHealth = new Setting(this, "Remove Health Bar Flashing", "Stops your health bar flashing when you take damage.").setValue(true);
+// oldDebugScreen = new Setting(this, "1.7 Debug Screen (Not implemented)", "Remove the boxes in the debug screen.").setValue(true);
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/AnimationHandler.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/AnimationHandler.java
new file mode 100644
index 0000000..b32afc2
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/AnimationHandler.java
@@ -0,0 +1,364 @@
+package com.cheatbreaker.client.module.impl.normal.animation.util;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.event.impl.tick.TickEvent;
+import com.cheatbreaker.client.module.impl.normal.animation.ModuleOneSevenVisuals;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
+import net.minecraft.init.Items;
+import net.minecraft.item.*;
+import net.minecraft.potion.Potion;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
+
+/**
+ * @ModuleUtility - AnimationHandler
+ * @see ModuleOneSevenVisuals
+ *
+ * This class handles animations, sword blocking, etc.
+ */
+public class AnimationHandler {
+ public static final AnimationHandler INSTANCE = new AnimationHandler();
+ private final Minecraft mc = Minecraft.getMinecraft();
+ public float prevSwingProgress;
+ public float swingProgress;
+ private int swingProgressInt;
+ private boolean isSwingInProgress;
+
+ public AnimationHandler() {
+ CheatBreaker.getInstance().getEventBus().addEvent(TickEvent.class, this::onTick);
+ }
+
+ public float getSwingProgress(float partialTickTime) {
+ float currentProgress = this.swingProgress - this.prevSwingProgress;
+
+ if (!this.isSwingInProgress) {
+ return this.mc.thePlayer.getSwingProgress(partialTickTime);
+ }
+
+ if (currentProgress < 0.0f) {
+ currentProgress += 1.0f;
+ }
+
+ return this.prevSwingProgress + currentProgress * partialTickTime;
+ }
+
+ private int getArmSwingAnimationEnd(EntityPlayerSP player) {
+ return player.isPotionActive(Potion.digSpeed) ? 5 - player.getActivePotionEffect(Potion.digSpeed).getAmplifier() : (player.isPotionActive(Potion.digSlowdown) ? 8 + player.getActivePotionEffect(Potion.digSlowdown).getAmplifier() * 2 : 6);
+ }
+
+ private void updateSwingProgress() {
+ EntityPlayerSP player = this.mc.thePlayer;
+
+ if (player == null) {
+ return;
+ }
+
+ this.prevSwingProgress = this.swingProgress;
+ int max = this.getArmSwingAnimationEnd(player);
+
+ if (ModuleOneSevenVisuals.punching.getBooleanValue() && this.mc.gameSettings.keyBindAttack.isKeyDown() && this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && (!this.isSwingInProgress || this.swingProgressInt >= max >> 1 || this.swingProgressInt < 0)) {
+ this.isSwingInProgress = true;
+ this.swingProgressInt = -1;
+ }
+
+ if (this.isSwingInProgress) {
+ ++this.swingProgressInt;
+
+ if (this.swingProgressInt >= max) {
+ this.swingProgressInt = 0;
+ this.isSwingInProgress = false;
+ }
+
+ } else {
+ this.swingProgressInt = 0;
+ }
+
+ this.swingProgress = (float) this.swingProgressInt / (float) max;
+ }
+
+ public void onTick(TickEvent event) {
+ this.updateSwingProgress();
+ }
+
+ public boolean renderItemInFirstPerson(ItemRenderer renderer, ItemStack stack, float equipProgress, float partialTicks) {
+ if (stack == null) {
+ return false;
+ }
+
+ Item item = stack.getItem();
+ if (item == Items.filled_map || this.mc.getRenderItem().shouldRenderItemIn3D(stack)) {
+ return false;
+ }
+
+ EnumAction action = stack.getItemUseAction();
+ if (item == Items.fishing_rod && !ModuleOneSevenVisuals.oldRod.getBooleanValue() || action == EnumAction.NONE && !ModuleOneSevenVisuals.oldModel.getBooleanValue() || action == EnumAction.BLOCK && !ModuleOneSevenVisuals.oldSwordBlock.getBooleanValue() || action == EnumAction.BOW && !ModuleOneSevenVisuals.oldBow.getBooleanValue()) {
+ return false;
+ }
+
+ EntityPlayerSP player = this.mc.thePlayer;
+ float var4 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
+
+ GlStateManager.pushMatrix();
+ GlStateManager.rotate(var4, 1.0f, 0.0f, 0.0f);
+ GlStateManager.rotate(player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * partialTicks, 0.0f, 1.0f, 0.0f);
+ RenderHelper.enableStandardItemLighting();
+ GlStateManager.popMatrix();
+
+ float pitch = player.prevRenderArmPitch + (player.renderArmPitch - player.prevRenderArmPitch) * partialTicks;
+ float yaw = player.prevRenderArmYaw + (player.renderArmYaw - player.prevRenderArmYaw) * partialTicks;
+ GlStateManager.rotate((player.rotationPitch - pitch) * 0.1f, 1.0f, 0.0f, 0.0f);
+ GlStateManager.rotate((player.rotationYaw - yaw) * 0.1f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.enableRescaleNormal();
+
+ if (item instanceof ItemCloth) {
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ }
+
+ int i = this.mc.theWorld.getCombinedLight(new BlockPos(player.posX, player.posY + (double) player.getEyeHeight(), player.posZ), 0);
+ float brightnessX = i & 0xFFFF;
+ float brightnessY = i >> 16;
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightnessX, brightnessY);
+
+ int rgb = item.getColorFromItemStack(stack, 0);
+ float red = (float) (rgb >> 16 & 0xFF) / 255.0f;
+ float green = (float) (rgb >> 8 & 0xFF) / 255.0f;
+ float blue = (float) (rgb & 0xFF) / 255.0f;
+ GlStateManager.color(red, green, blue, 1.0f);
+
+ GlStateManager.pushMatrix();
+ int useCount = player.getItemInUseCount();
+ float swingProgress = this.getSwingProgress(partialTicks);
+ boolean blockHitOverride = false;
+
+ if (ModuleOneSevenVisuals.punching.getBooleanValue() && useCount <= 0 && this.mc.gameSettings.keyBindUseItem.isKeyDown()) {
+ if (Minecraft.getMinecraft().getCurrentServerData() != null) {
+ if (!Minecraft.getMinecraft().getCurrentServerData().serverIP.contains("minemen.club") && !Minecraft.getMinecraft().getCurrentServerData().serverIP.contains("icantjoinlmfao.club") && !Minecraft.getMinecraft().getCurrentServerData().serverIP.contains("mineman.club")) {
+ boolean block = action == EnumAction.BLOCK;
+ boolean consume = false;
+
+ if (item instanceof ItemFood && player.canEat(((ItemFood) item).isAlwaysEdible())) {
+ consume = action == EnumAction.EAT || action == EnumAction.DRINK;
+ }
+
+ if (block || consume) {
+ blockHitOverride = true;
+ }
+ }
+ } else {
+ boolean block = action == EnumAction.BLOCK;
+ boolean consume = false;
+
+ if (item instanceof ItemFood && player.canEat(((ItemFood) item).isAlwaysEdible())) {
+ consume = action == EnumAction.EAT || action == EnumAction.DRINK;
+ }
+
+ if (block || consume) {
+ blockHitOverride = true;
+ }
+ }
+
+ }
+
+ if ((useCount > 0 || blockHitOverride) && action != EnumAction.NONE && this.mc.thePlayer.isUsingItem()) {
+ switch (action) {
+ case EAT:
+ case DRINK:
+ this.doConsumeAnimation(stack, useCount, partialTicks);
+ this.doEquipAndSwingTransform(equipProgress, ModuleOneSevenVisuals.oldBlockHitting.getBooleanValue() ? swingProgress : 0.0f);
+ break;
+ case BLOCK:
+ this.doEquipAndSwingTransform(equipProgress, ModuleOneSevenVisuals.oldBlockHitting.getBooleanValue() ? swingProgress : 0.0f);
+ this.doSwordBlockAnimation();
+ break;
+ case BOW:
+ this.doEquipAndSwingTransform(equipProgress, ModuleOneSevenVisuals.oldBlockHitting.getBooleanValue() ? swingProgress : 0.0f);
+ this.doBowAnimation(stack, useCount, partialTicks);
+ }
+ } else {
+ this.doSwingTranslation(swingProgress);
+ this.doEquipAndSwingTransform(equipProgress, swingProgress);
+ }
+
+ if (item.shouldRotateAroundWhenRendering()) {
+ GlStateManager.rotate(180.0f, 0.0f, 1.0f, 0.0f);
+ }
+
+ if (this.doFirstPersonTransform(stack)) {
+ renderer.renderItem(player, stack, ItemCameraTransforms.TransformType.FIRST_PERSON);
+ } else {
+ renderer.renderItem(player, stack, ItemCameraTransforms.TransformType.NONE);
+ }
+
+ GlStateManager.popMatrix();
+
+ if (item instanceof ItemCloth) {
+ GlStateManager.disableBlend();
+ }
+
+ GlStateManager.disableRescaleNormal();
+ RenderHelper.disableStandardItemLighting();
+ return true;
+ }
+
+ public void doSwordBlock3rdPersonTransform() {
+ if (ModuleOneSevenVisuals.oldSwordBlock3.getBooleanValue()) {
+ GlStateManager.translate(-0.15f, -0.2f, 0.0f);
+ GlStateManager.rotate(70.0f, 1.0f, 0.0f, 0.0f);
+ GlStateManager.translate(0.119f, 0.2f, -0.024f);
+ }
+ }
+
+ private boolean doFirstPersonTransform(ItemStack stack) {
+
+ switch (stack.getItemUseAction()) {
+ case BOW: {
+ if (ModuleOneSevenVisuals.oldBow.getBooleanValue()) break;
+ return true;
+ }
+ case EAT:
+ case DRINK: {
+ if (ModuleOneSevenVisuals.oldEating.getBooleanValue()) break;
+ return true;
+ }
+ case BLOCK: {
+ if (ModuleOneSevenVisuals.oldSwordBlock.getBooleanValue()) break;
+ return true;
+ }
+ case NONE: {
+ if (ModuleOneSevenVisuals.oldModel.getBooleanValue()) break;
+ return true;
+ }
+ }
+
+ GlStateManager.translate(0.58800083f, 0.36999986f, -0.77000016f);
+ GlStateManager.translate(0.0f, -0.3f, 0.0f);
+ GlStateManager.scale(1.5f, 1.5f, 1.5f);
+ GlStateManager.rotate(50.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.rotate(335.0f, 0.0f, 0.0f, 1.0f);
+ GlStateManager.translate(-0.9375f, -0.0625f, 0.0f);
+ GlStateManager.scale(-2.0f, 2.0f, -2.0f);
+
+ if (this.mc.getRenderItem().shouldRenderItemIn3D(stack)) {
+ GlStateManager.scale(0.58823526f, 0.58823526f, 0.58823526f);
+ GlStateManager.rotate(-25.0f, 0.0f, 0.0f, 1.0f);
+ GlStateManager.rotate(0.0f, 1.0f, 0.0f, 0.0f);
+ GlStateManager.rotate(135.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.translate(0.0f, -0.25f, -0.125f);
+ GlStateManager.scale(0.5f, 0.5f, 0.5f);
+ return true;
+ }
+
+ GlStateManager.scale(0.5f, 0.5f, 0.5f);
+ return false;
+ }
+
+ private void doConsumeAnimation(ItemStack stack, int useCount, float partialTicks) {
+
+ if (ModuleOneSevenVisuals.oldEating.getBooleanValue()) {
+ float useAmount = (float) useCount - partialTicks + 1.0f;
+ float useAmountNorm = 1.0f - useAmount / (float) stack.getMaxItemUseDuration();
+ float useAmountPow = 1.0f - useAmountNorm;
+
+ useAmountPow = useAmountPow * useAmountPow * useAmountPow;
+ useAmountPow = useAmountPow * useAmountPow * useAmountPow;
+ useAmountPow = useAmountPow * useAmountPow * useAmountPow;
+
+ float useAmountFinal = 1.0f - useAmountPow;
+
+ GlStateManager.translate(0.0f, MathHelper.abs(MathHelper.cos(useAmount / 4.0f * (float) Math.PI) * 0.1f) * (float) ((double) useAmountNorm > 0.2 ? 1 : 0), 0.0f);
+ GlStateManager.translate(useAmountFinal * 0.6f, -useAmountFinal * 0.5f, 0.0f);
+ GlStateManager.rotate(useAmountFinal * 90.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.rotate(useAmountFinal * 10.0f, 1.0f, 0.0f, 0.0f);
+ GlStateManager.rotate(useAmountFinal * 30.0f, 0.0f, 0.0f, 1.0f);
+ } else {
+ float f = (float) useCount - partialTicks + 1.0f;
+ float f1 = f / (float) stack.getMaxItemUseDuration();
+ float f2 = MathHelper.abs(MathHelper.cos(f / 4.0f * (float) Math.PI) * 0.1f);
+
+ if (f1 >= 0.8f) {
+ f2 = 0.0f;
+ }
+
+ GlStateManager.translate(0.0f, f2, 0.0f);
+ float f3 = 1.0f - (float) Math.pow(f1, 27.0);
+
+ GlStateManager.translate(f3 * 0.6f, f3 * -0.5f, f3 * 0.0f);
+ GlStateManager.rotate(f3 * 90.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.rotate(f3 * 10.0f, 1.0f, 0.0f, 0.0f);
+ GlStateManager.rotate(f3 * 30.0f, 0.0f, 0.0f, 1.0f);
+ }
+
+ }
+
+ private void doSwingTranslation(float swingProgress) {
+ float swingProgress2 = MathHelper.sin(swingProgress * (float) Math.PI);
+ float swingProgress3 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float) Math.PI);
+
+ GlStateManager.translate(-swingProgress3 * 0.4f, MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float) Math.PI * 2.0f) * 0.2f, -swingProgress2 * 0.2f);
+ }
+
+ private void doEquipAndSwingTransform(float equipProgress, float swingProgress) {
+ GlStateManager.translate(0.56f, -0.52f - (1.0f - equipProgress) * 0.6f, -0.72f);
+ GlStateManager.rotate(45.0f, 0.0f, 1.0f, 0.0f);
+
+ float swingProgress2 = MathHelper.sin(swingProgress * swingProgress * (float) Math.PI);
+ float swingProgress3 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float) Math.PI);
+
+ GlStateManager.rotate(-swingProgress2 * 20.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.rotate(-swingProgress3 * 20.0f, 0.0f, 0.0f, 1.0f);
+ GlStateManager.rotate(-swingProgress3 * 80.0f, 1.0f, 0.0f, 0.0f);
+ GlStateManager.scale(0.4f, 0.4f, 0.4f);
+ }
+
+ private void doSwordBlockAnimation() {
+ GlStateManager.translate(-0.5f, 0.2f, 0.0f);
+ GlStateManager.rotate(30.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.rotate(-80.0f, 1.0f, 0.0f, 0.0f);
+ GlStateManager.rotate(60.0f, 0.0f, 1.0f, 0.0f);
+ }
+
+ private void doBowAnimation(ItemStack stack, int useCount, float partialTicks) {
+ GlStateManager.rotate(-18.0f, 0.0f, 0.0f, 1.0f);
+ GlStateManager.rotate(-12.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.rotate(-8.0f, 1.0f, 0.0f, 0.0f);
+ GlStateManager.translate(-0.9f, 0.2f, 0.0f);
+
+ float totalPullback = (float) stack.getMaxItemUseDuration() - ((float) useCount - partialTicks + 1.0f);
+ float pullbackNorm = totalPullback / 20.0f;
+ pullbackNorm = (pullbackNorm * pullbackNorm + pullbackNorm * 2.0f) / 3.0f;
+
+ if (pullbackNorm > 1.0f) {
+ pullbackNorm = 1.0f;
+ }
+
+ if (pullbackNorm > 0.1f) {
+ GlStateManager.translate(0.0f, MathHelper.sin((totalPullback - 0.1f) * 1.3f) * 0.01f * (pullbackNorm - 0.1f), 0.0f);
+ }
+
+ GlStateManager.translate(0.0f, 0.0f, pullbackNorm * 0.1f);
+
+ if (ModuleOneSevenVisuals.oldBow.getBooleanValue()) {
+ GlStateManager.rotate(-335.0f, 0.0f, 0.0f, 1.0f);
+ GlStateManager.rotate(-50.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.translate(0.0f, 0.5f, 0.0f);
+ }
+
+ float zScale = 1.0f + pullbackNorm * 0.2f;
+ GlStateManager.scale(1.0f, 1.0f, zScale);
+
+ if (ModuleOneSevenVisuals.oldBow.getBooleanValue()) {
+ GlStateManager.translate(0.0f, -0.5f, 0.0f);
+ GlStateManager.rotate(50.0f, 0.0f, 1.0f, 0.0f);
+ GlStateManager.rotate(335.0f, 0.0f, 0.0f, 1.0f);
+ }
+ }
+}
+
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/FishingLineHandler.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/FishingLineHandler.java
new file mode 100644
index 0000000..8c1323b
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/FishingLineHandler.java
@@ -0,0 +1,21 @@
+package com.cheatbreaker.client.module.impl.normal.animation.util;
+
+import com.cheatbreaker.client.module.impl.normal.animation.ModuleOneSevenVisuals;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.Vec3;
+
+/**
+ * @ModuleUtility - FishingLineHandler
+ * @see ModuleOneSevenVisuals
+ *
+ * This class handles fishing rod visuals.
+ */
+public class FishingLineHandler {
+ public static final FishingLineHandler INSTANCE = new FishingLineHandler();
+
+ public Vec3 getOffset() {
+ double fov = Minecraft.getMinecraft().gameSettings.fovSetting;
+ double decimalFov = fov / 110.0;
+ return new Vec3(-decimalFov + decimalFov / 2.5 - decimalFov / 8.0 + 0.16, 0.0, 0.4);
+ }
+}
\ No newline at end of file
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/SneakHandler.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/SneakHandler.java
new file mode 100644
index 0000000..635fe19
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/animation/util/SneakHandler.java
@@ -0,0 +1,55 @@
+package com.cheatbreaker.client.module.impl.normal.animation.util;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.event.impl.tick.TickEvent;
+import com.cheatbreaker.client.module.impl.normal.animation.ModuleOneSevenVisuals;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+
+/**
+ * @ModuleUtility - SneakHandler
+ * @see ModuleOneSevenVisuals
+ * @see net.minecraft.entity.player.EntityPlayer
+ *
+ * This class handles player sneaking visuals.
+ */
+public class SneakHandler {
+ private static final float START_HEIGHT = 1.62f;
+ private static final float END_HEIGHT = 1.54f;
+ private static final SneakHandler INSTANCE = new SneakHandler();
+ private float eyeHeight;
+ private float lastEyeHeight;
+
+ public SneakHandler() {
+ CheatBreaker.getInstance().getEventBus().addEvent(TickEvent.class, this::onTick);
+ }
+
+ public static SneakHandler getInstance() {
+ return INSTANCE;
+ }
+
+ public float getEyeHeight(float partialTicks) {
+ if (!ModuleOneSevenVisuals.smoothSneaking.getBooleanValue()) {
+ return this.eyeHeight;
+ }
+ return this.lastEyeHeight + (this.eyeHeight - this.lastEyeHeight) * partialTicks;
+ }
+
+ public void onTick(TickEvent event) {
+ this.lastEyeHeight = this.eyeHeight;
+ EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
+ if (player == null) {
+ this.eyeHeight = 1.62f;
+ return;
+ }
+ if (player.isSneaking()) {
+ this.eyeHeight = 1.54f;
+ } else if (!ModuleOneSevenVisuals.longSneaking.getBooleanValue()) {
+ this.eyeHeight = 1.62f;
+ } else if (this.eyeHeight < 1.62f) {
+ float delta = 1.62f - this.eyeHeight;
+ delta = (float) ((double) delta * 0.4);
+ this.eyeHeight = 1.62f - delta;
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/FPS.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/FPS.java
new file mode 100644
index 0000000..cb05367
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/FPS.java
@@ -0,0 +1,53 @@
+package com.cheatbreaker.client.module.impl.normal.hud;
+
+import com.cheatbreaker.client.event.impl.render.GuiDrawEvent;
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.ui.module.GuiAnchor;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * @Module - FPS
+ * @see AbstractModule
+ *
+ * This mod is the Vanilla CheatBreaker FPS Module, likely will be used for reference later on.
+ * NOTE: This will be removed towards the end of the Recode Branch.
+ */
+@Deprecated
+public class FPS extends AbstractModule {
+ private final Setting background;
+ private final Setting textColor;
+ private final Setting backgroundColor;
+
+ public FPS() {
+ super("FPS");
+ this.setDefaultAnchor(GuiAnchor.RIGHT_TOP);
+ this.setDefaultTranslations(0.0f, 0.0f);
+ this.setState(false);
+ this.background = new Setting(this, "Show Background").setValue(true);
+ this.textColor = new Setting(this, "Text Color").setValue(-1).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.backgroundColor = new Setting(this, "Background Color").setValue(0x6F000000).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.setPreviewLabel("[144 FPS]", 1.4f);
+ this.addEvent(GuiDrawEvent.class, this::onGuiDraw);
+ }
+
+ private void onGuiDraw(GuiDrawEvent event) {
+ if (!this.isRenderHud()) {
+ return;
+ }
+ GL11.glPushMatrix();
+ this.scaleAndTranslate(event.getScaledResolution());
+ if ((Boolean) this.background.getValue()) {
+ this.setDimensions(56, 18);
+ Gui.drawRect(0.0f, 0.0f, 56, 13, this.backgroundColor.getColorValue());
+ String string = Minecraft.debugFPS + " FPS";
+ this.mc.fontRendererObj.drawString(string, (int) (this.width / 2.0f - (float) (this.mc.fontRendererObj.getStringWidth(string) / 2)), 3, this.textColor.getColorValue());
+ } else {
+ String string = "[" + Minecraft.debugFPS + " FPS]";
+ this.setDimensions(this.mc.fontRendererObj.drawString(string, this.width / 2.0f - (float) (this.mc.fontRendererObj.getStringWidth(string) / 2), 0.0f, this.textColor.getColorValue(), true), 18);
+ }
+ GL11.glPopMatrix();
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleBossBar.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleBossBar.java
new file mode 100644
index 0000000..cf1f7c1
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleBossBar.java
@@ -0,0 +1,127 @@
+package com.cheatbreaker.client.module.impl.normal.hud;
+
+
+import com.cheatbreaker.client.event.impl.render.GuiDrawEvent;
+import com.cheatbreaker.client.event.impl.render.PreviewDrawEvent;
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.module.data.CustomizationLevel;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.ui.module.GuiAnchor;
+import com.cheatbreaker.client.ui.module.HudLayoutEditorGui;
+import com.cheatbreaker.client.ui.util.RenderUtil;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.boss.BossStatus;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+
+/**
+ * @Module - ModuleBossBar
+ * @see AbstractModule
+ *
+ * This module displays the current Minecraft Boss' health.
+ */
+public class ModuleBossBar extends AbstractModule {
+ private final Setting textColor;
+ private final Setting renderHealth;
+ private final Setting renderText;
+ private final Setting textShadow;
+ private final Setting textPosition;
+ private final Setting barWidth;
+ private final Setting barHeight;
+ private final Setting bossTexture;
+ private final Setting bossBarColor;
+ private final Setting topBossBarColor;
+ private final Setting bottomBossBarColor;
+ private final Setting outlineBossBarColor;
+
+ public ModuleBossBar() {
+ super("Boss Bar");
+ this.setDefaultAnchor(GuiAnchor.MIDDLE_TOP);
+ this.notRenderHUD = false;
+ this.renderText = new Setting(this, "Render Text").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.renderHealth = new Setting(this, "Render Health").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.textShadow = new Setting(this, "Text Shadow").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.renderText.getValue());
+ this.bossTexture = new Setting(this, "Boss Bar Texture").setValue("Texture Pack").acceptedStringValues("Texture Pack", "Default", "Blurred", "Custom").setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderHealth.getValue());
+ this.textPosition = new Setting(this, "Text Position").setValue(50.0f).setMinMax(0.0f, 100.0f).setUnit("%").setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderHealth.getValue() && (Boolean) this.renderText.getValue());
+ this.barWidth = new Setting(this, "Boss Bar Width").setValue(182.0F).setMinMax(100.0F, 200.0F).setUnit("px").setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderHealth.getValue() && this.bossTexture.getValue().equals("Custom"));
+ this.barHeight = new Setting(this, "Boss Bar Height").setValue(5.0F).setMinMax(3.0f, 24.0f).setUnit("px").setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderHealth.getValue() && this.bossTexture.getValue().equals("Custom"));
+ this.textColor = new Setting(this, "Text Color").setValue(-1).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderText.getValue());
+ this.bossBarColor = new Setting(this, "Boss Bar Color").setValue(-65337).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderHealth.getValue() && !this.bossTexture.getValue().equals("Texture Pack") && !this.bossTexture.getValue().equals("Custom"));
+ this.topBossBarColor = new Setting(this, "Top Boss Bar Color").setValue(0xFFEC00B8).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderHealth.getValue() && this.bossTexture.getValue().equals("Custom"));
+ this.bottomBossBarColor = new Setting(this, "Bottom Boss Bar Color").setValue(0xFF8C006D).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderHealth.getValue() && this.bossTexture.getValue().equals("Custom"));
+ this.outlineBossBarColor = new Setting(this, "Outline Boss Bar Color").setValue(0xFF4A003A).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.renderHealth.getValue() && this.bossTexture.getValue().equals("Custom"));
+ this.setPreviewIcon(new ResourceLocation("client/icons/mods/bossbar.png"), 106, 5);
+ this.setDescription("Displays the current boss and health.");
+ this.addEvent(GuiDrawEvent.class, this::onGuiDraw);
+ this.addEvent(PreviewDrawEvent.class, this::onPreviewDraw);
+ this.setDefaultState(true);
+ }
+
+ public void onPreviewDraw(PreviewDrawEvent event) {
+ if (!this.isRenderHud() || (this.hiddenFromHud && !(this.mc.currentScreen instanceof HudLayoutEditorGui))) return;
+ GL11.glPushMatrix();
+ this.scaleAndTranslate(event.getScaledResolution());
+ if (BossStatus.bossName == null || BossStatus.statusBarTime <= 0) {
+ this.render("Wither", 1.0F, 0, (Boolean) renderText.getValue() ? 10 : 0);
+ }
+ GL11.glPopMatrix();
+ }
+
+ public void onGuiDraw(GuiDrawEvent event) {
+ if (!this.isRenderHud()) return;
+ GL11.glPushMatrix();
+ this.scaleAndTranslate(event.getScaledResolution());
+ if (BossStatus.bossName != null && BossStatus.statusBarTime > 0) {
+ --BossStatus.statusBarTime;
+ this.render(BossStatus.bossName, BossStatus.healthScale, 0, (Boolean) renderText.getValue() ? 10 : 0);
+ }
+ GL11.glPopMatrix();
+ }
+
+ public void render(String bossName, float healthScale, int x, int y) {
+ GlStateManager.enableBlend();
+ int barColor = this.bossBarColor.getColorValue();
+ if (this.bossTexture.getValue().equals("Texture Pack")) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.getTextureManager().bindTexture(Gui.icons);
+ } else {
+ GL11.glColor4f((barColor >> 16 & 255) / 255.0F, (barColor >> 8 & 255) / 255.0F, (barColor & 255) / 255.0F, (barColor >> 24 & 255) / 255.0F);
+ this.mc.getTextureManager().bindTexture(new ResourceLocation("client/icons/bossbar/" + this.bossTexture.getValue().toString().toLowerCase() + ".png"));
+ }
+
+ FontRenderer font = this.mc.fontRendererObj;
+ float width = this.bossTexture.getValue().equals("Custom") ? this.barWidth.getFloatValue() : 182;
+ float x2 = !(Boolean) renderText.getValue() || font.getStringWidth(bossName) < width ? x : x + (font.getStringWidth(bossName) - width) * this.textPosition.getFloatValue() / 100.0F;
+ int y2 = y;
+ float remainingHealth = healthScale * width;
+ if ((Boolean) renderHealth.getValue()) {
+ if (this.bossTexture.getValue().equals("Custom")) {
+ int top = new Color((this.topBossBarColor.getColorValue() >> 16 & 255) / 4, (this.topBossBarColor.getColorValue() >> 8 & 255) / 4, (this.topBossBarColor.getColorValue() & 255) / 4, this.topBossBarColor.getColorValue() >> 24 & 255).getRGB();
+ int bottom = new Color((this.bottomBossBarColor.getColorValue() >> 16 & 255) / 4, (this.bottomBossBarColor.getColorValue() >> 8 & 255) / 4, (this.bottomBossBarColor.getColorValue() & 255) / 4, this.bottomBossBarColor.getColorValue() >> 24 & 255).getRGB();
+ RenderUtil.drawGradientRectWithOutline(x2, y2, x2 + width, y2 + this.barHeight.getFloatValue(), this.outlineBossBarColor.getColorValue(), top, bottom);
+ if (remainingHealth > 0) {
+ RenderUtil.drawGradientRectWithOutline(x2, y2, x2 + remainingHealth, y2 + this.barHeight.getFloatValue(), 0, this.topBossBarColor.getColorValue(), this.bottomBossBarColor.getColorValue());
+ }
+ RenderUtil.drawGradientRectWithOutline(x2, y2, x2 + width, y2 + this.barHeight.getFloatValue(), this.outlineBossBarColor.getColorValue(), 0, 0);
+ } else {
+ this.mc.ingameGUI.drawTexturedModalRect(x2, y2, 0, 74, (int) width, 5);
+ this.mc.ingameGUI.drawTexturedModalRect(x2, y2, 0, 74, (int) width, 5);
+ if (remainingHealth > 0) {
+ this.mc.ingameGUI.drawTexturedModalRect(x2, y2, 0, 79, (int) remainingHealth, 5);
+ }
+ }
+ }
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ if ((Boolean) renderText.getValue())
+ font.drawString(bossName, x + this.width / 2 - (float) (font.getStringWidth(bossName) / 2), y - 10, this.textColor.getColorValue(), (Boolean) this.textShadow.getValue());
+ float barHeight = (Boolean) renderHealth.getValue() ? this.bossTexture.getValue().equals("Custom") ? this.barHeight.getFloatValue() : 5.0F : 0.0F;
+ float textHeight = (Boolean) renderText.getValue() ? 9.0F : 0.0F;
+ float extraHeight = (Boolean) renderText.getValue() && (Boolean) renderHealth.getValue() ? 1.0F : 0.0F;
+ this.setDimensions((Boolean) renderHealth.getValue() ? (Boolean) renderText.getValue() ? Math.max(font.getStringWidth(bossName), width) : width : (float) (font.getStringWidth(bossName)), barHeight + textHeight + extraHeight);
+ GlStateManager.disableBlend();
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleCoordinates.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleCoordinates.java
new file mode 100644
index 0000000..30dc03e
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleCoordinates.java
@@ -0,0 +1,141 @@
+package com.cheatbreaker.client.module.impl.normal.hud;
+
+import com.cheatbreaker.client.event.impl.mouse.ClickEvent;
+import com.cheatbreaker.client.event.impl.render.GuiDrawEvent;
+import com.cheatbreaker.client.event.impl.tick.TickEvent;
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.module.data.CustomizationLevel;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.ui.module.GuiAnchor;
+import com.cheatbreaker.client.ui.module.HudLayoutEditorGui;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.MathHelper;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ModuleCoordinates extends AbstractModule {
+ private final Setting generalOptions;
+ private final Setting showWhileTyping;
+ private final Setting mode;
+ private final Setting coords;
+ private final Setting hideYCoord;
+ private final Setting direction;
+
+ public Setting customLine;
+
+ private final Setting colorSettings;
+ private final Setting coordsColor;
+ private final Setting directionColor;
+ private final List clicks = new ArrayList<>();
+
+ public ModuleCoordinates() {
+ super("Coordinates");
+
+ this.setDefaultAnchor(GuiAnchor.LEFT_TOP);
+ this.setDefaultTranslations(-1, 0.0f);
+ this.setDefaultState(false);
+
+ this.generalOptions = new Setting(this, "label").setValue("General Options");
+ this.showWhileTyping = new Setting(this, "Show While Typing", "Show the mod when opening chat.").setValue(true).setCustomizationLevel(CustomizationLevel.ADVANCED);
+ this.mode = new Setting(this, "Mode", "Layout the mod should display.").setValue("Horizontal").acceptedStringValues("Horizontal", "Vertical").setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.coords = new Setting(this, "Coordinates", "Show the coordiantes.").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.hideYCoord = new Setting(this, "Hide Y Coordinate", "Hide the Y coordinate.").setValue(false).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.coords.getValue());
+ this.direction = new Setting(this, "Direction", "Show the direction the player is facing.").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.customLine = new Setting(this, "Custom Line").setValue("").setCustomizationLevel(CustomizationLevel.ADVANCED);
+ this.colorSettings = new Setting(this, "label").setValue("Color Options").setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.coords.getValue() || (Boolean) this.direction.getValue());
+ this.coordsColor = new Setting(this, "Coordinates Color", "Change the coordinates text color.").setValue(-1).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.coords.getValue());
+ this.directionColor = new Setting(this, "Direction Color", "Change the direction text color.").setValue(-1).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.direction.getValue());
+
+ this.setPreviewLabel("(16, 65, 120) NW", 1.0f);
+ this.setDescription("Shows your X, Y, and Z coordinates as well as your direction.");
+
+ this.addEvent(GuiDrawEvent.class, this::onGuiDraw);
+ this.addEvent(TickEvent.class, this::onTick);
+ this.addEvent(ClickEvent.class, this::onOldClickEvent);
+ }
+
+ private void onGuiDraw(GuiDrawEvent event) {
+ if (!this.isRenderHud() || (this.hiddenFromHud && !(this.mc.currentScreen instanceof HudLayoutEditorGui))) {
+ return;
+ }
+ GL11.glPushMatrix();
+ GlStateManager.enableBlend();
+ this.scaleAndTranslate(event.getScaledResolution());
+ int n = MathHelper.floor_double(this.mc.thePlayer.posX);
+ int n2 = (int) this.mc.thePlayer.boundingBox.minY;
+ int n3 = MathHelper.floor_double(this.mc.thePlayer.posZ);
+ if (!this.mc.ingameGUI.getChatGUI().getChatOpen() || (Boolean) this.showWhileTyping.getValue()) {
+ if (this.customLine.getValue().equals("")) {
+ int n4 = 0;
+ float f = 4;
+ if ((Boolean) this.coords.getValue()) {
+ if (this.mode.getValue().equals("Horizontal")) {
+ String horizontalString = ((Boolean) this.hideYCoord.getValue() ? String.format("(%1$d, %2$d)", n, n3) : String.format("(%1$d, %2$d, %3$d)", n, n2, n3)) + ((Boolean) this.direction.getValue() ? " " : "");
+ n4 = this.mc.fontRendererObj.drawStringWithShadow(horizontalString, 0.0f, 0.0f, this.coordsColor.getColorValue());
+ } else {
+ n4 = 50;
+ f = (Boolean) this.hideYCoord.getValue() ? 9.5F : 16.0F;
+ this.mc.fontRendererObj.drawStringWithShadow("X: " + n, 0.0f, 0.0f, this.coordsColor.getColorValue());
+ if (!(Boolean) this.hideYCoord.getValue()) {
+ this.mc.fontRendererObj.drawStringWithShadow("Y: " + n2, 0.0f, 12.0F, this.coordsColor.getColorValue());
+ }
+ this.mc.fontRendererObj.drawStringWithShadow("Z: " + n3, 0.0f, (Boolean) this.hideYCoord.getValue() ? 12.0F : 24.0F, this.coordsColor.getColorValue());
+ }
+ }
+ if ((Boolean) this.direction.getValue()) {
+ String[] directions = new String[]{"N", "NE", "E", "SE", "S", "SW", "W", "NW"};
+ double d = (double) MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw) + 180.0;
+ d += 22.5D;
+ d %= 360.0;
+ String string = directions[MathHelper.floor_double(d / 45)];
+ this.mc.fontRendererObj.drawStringWithShadow(string, (float) n4, f - (float) 4, this.directionColor.getColorValue());
+ n4 += this.mc.fontRendererObj.getStringWidth(string);
+ }
+ this.setDimensions(n4, Math.max(f + (!this.mode.getValue().equals("Horizontal") && (Boolean) this.coords.getValue() ? 18.0F : 0.0F), this.mc.fontRendererObj.FONT_HEIGHT));
+ } else {
+ String[] arrstring = ((String) this.customLine.getValue()).split("%NL%");
+ float f = -1;
+ float f2 = arrstring.length * (this.mc.fontRendererObj.FONT_HEIGHT + 1);
+ int n5 = 0;
+ for (String string : arrstring) {
+ float f3 = this.mc.fontRendererObj.drawStringWithShadow(string = this.customText(string), 0.0f, (float) ((this.mc.fontRendererObj.FONT_HEIGHT + 1) * n5), -1);
+ if (f3 > f) {
+ f = f3;
+ }
+ this.setDimensions((int) f, (int) (Math.max(f2, this.mc.fontRendererObj.FONT_HEIGHT)));
+ ++n5;
+ }
+ }
+ }
+ GlStateManager.disableBlend();
+ GL11.glPopMatrix();
+ }
+
+ private String customText(String string) {
+ String[] arrstring = new String[]{"N", "NE", "E", "SE", "S", "SW", "W", "NW"};
+ double d = (double) MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw) + 180.0;
+ d += 22.5D;
+ d %= 360.0;
+ String string2 = arrstring[MathHelper.floor_double(d /= 45.0)];
+ int n = MathHelper.floor_double(this.mc.thePlayer.posX);
+ int n2 = (int) this.mc.thePlayer.boundingBox.minY;
+ int n3 = MathHelper.floor_double(this.mc.thePlayer.posZ);
+ string = !this.mc.isIntegratedServerRunning() && this.mc.theWorld != null ? string.replaceAll("%IP%", this.mc.currentServerData.serverIP) : string.replaceAll("%IP%", "?");
+ return string.replaceAll("%FPS%", Minecraft.debugFPS + "").replaceAll("%DIR%", string2).replaceAll("%CPS%", this.clicks.size() + "").replaceAll("%COORDS%", String.format("%1$d, %2$d, %3$d", n, n2, n3)).replaceAll("%X%", n + "").replaceAll("%Y%", n2 + "").replaceAll("%Z%", n3 + "");
+ }
+
+ private void onTick(TickEvent event) {
+ if (((String) this.customLine.getValue()).contains("%CPS%")) {
+ this.clicks.removeIf(l -> l < System.currentTimeMillis() - 1000L);
+ }
+ }
+
+ private void onOldClickEvent(ClickEvent event) {
+ if (event.getMouseButton() == 0 && ((String) this.customLine.getValue()).contains("%CPS%")) {
+ this.clicks.add(System.currentTimeMillis());
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleDirectionHUD.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleDirectionHUD.java
new file mode 100644
index 0000000..4488971
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleDirectionHUD.java
@@ -0,0 +1,114 @@
+package com.cheatbreaker.client.module.impl.normal.hud;
+
+
+import com.cheatbreaker.client.event.impl.render.GuiDrawEvent;
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.module.data.CustomizationLevel;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.ui.module.GuiAnchor;
+import com.cheatbreaker.client.ui.module.HudLayoutEditorGui;
+import com.cheatbreaker.client.ui.util.HudUtil;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+public class ModuleDirectionHUD extends AbstractModule {
+ private final Setting markerColor;
+ private final Setting directionColor;
+ private final Setting highlightColor;
+ private final Setting backgroundColor;
+ private final Setting borderColor;
+ private final Setting showWhileTyping;
+ private final Setting background;
+ private final Setting border;
+ private final Setting borderThickness;
+ private final Setting highlightNorth;
+ private final ResourceLocation texture = new ResourceLocation("textures/gui/compass.png");
+
+ public ModuleDirectionHUD() {
+ super("Direction HUD");
+ this.setDefaultAnchor(GuiAnchor.MIDDLE_TOP);
+ this.setState(false);
+ this.showWhileTyping = new Setting(this, "Show While Typing", "Show the mod when opening chat.").setValue(true).setCustomizationLevel(CustomizationLevel.ADVANCED);
+ this.highlightNorth = new Setting(this, "Highlight North", "Make North highlight a different color.").setValue(false).setCustomizationLevel(CustomizationLevel.MEDIUM);
+ this.background = new Setting(this, "Show Background", "Draw a background.").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.border = new Setting(this, "Show Border", "Draw a border around the background.").setValue(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.borderThickness = new Setting(this, "Border Thickness", "Change the thickness of the border.").setValue(1.0F).setMinMax(0.25F, 3.0F).setUnit("px").setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.border.getValue());
+ this.markerColor = new Setting(this, "Marker Color", "Change the marker color.").setValue(-43691).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.directionColor = new Setting(this, "Direction Color", "Change the direction color.").setValue(-1).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.highlightColor = new Setting(this, "Highlight Color", "Change the highlight color.").setValue(-43691).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.highlightNorth.getValue());
+ this.backgroundColor = new Setting(this, "Background Color", "Change the background color.").setValue(0xFF212121).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.background.getValue());
+ this.borderColor = new Setting(this, "Border Color", "Sets the color for the border.").setValue(-1627389952).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.border.getValue());
+ this.setPreviewIcon(new ResourceLocation("client/icons/mods/dirhud.png"), 65, 12);
+ this.setDescription("Displays your cardinal direction.");
+ this.setCreators("bspkrs", "jadedcat");
+ this.addEvent(GuiDrawEvent.class, this::onGuiDraw);
+ }
+
+ private void onGuiDraw(GuiDrawEvent event) {
+ if (!this.isRenderHud() || (this.hiddenFromHud && !(this.mc.currentScreen instanceof HudLayoutEditorGui))) {
+ return;
+ }
+ GL11.glPushMatrix();
+ GlStateManager.enableBlend();
+ this.scaleAndTranslate(event.getScaledResolution());
+ this.setDimensions(66, 12);
+ if (!this.mc.ingameGUI.getChatGUI().getChatOpen() || (Boolean) this.showWhileTyping.getValue()) {
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ this.drawCompass();
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ }
+ GlStateManager.disableBlend();
+ GL11.glPopMatrix();
+ }
+
+ private void drawCompass() {
+ int n = MathHelper.floor_double((double) (this.mc.thePlayer.rotationYaw * (float) 256 / (float) 360) + 0.3450704167414649 * 1.4489796161651611) & 0xFF;
+ int n2 = 0;
+ int n3 = 0;
+ if ((Integer) this.directionColor.getValue() != 4095) {
+ int directionColor = this.directionColor.getColorValue();
+ int backgroundColor = this.backgroundColor.getColorValue();
+ int highlightColor = this.highlightColor.getColorValue();
+ this.mc.getTextureManager().bindTexture(this.texture);
+ if ((Boolean) this.background.getValue()) {
+ GL11.glColor4f((float) (backgroundColor >> 16 & 0xFF) / (float) 255, (float) (backgroundColor >> 8 & 0xFF) / (float) 255, (float) (backgroundColor & 0xFF) / (float) 255, (float) (backgroundColor >> 24 & 255) / (float) 255);
+ if (n < 128) {
+ HudUtil.drawTexturedModalRect(n3, n2, n, 0, 66, 12, -100);
+ } else {
+ HudUtil.drawTexturedModalRect(n3, n2, n - 128, 12, 66, 12, -100);
+ }
+ }
+
+ GL11.glColor4f((float) (directionColor >> 16 & 0xFF) / (float) 255, (float) (directionColor >> 8 & 0xFF) / (float) 255, (float) (directionColor & 0xFF) / (float) 255, (float) (directionColor >> 24 & 255) / (float) 255);
+ if (n < 128) {
+ HudUtil.drawTexturedModalRect(n3, n2, n, 24, 66, 12, -100);
+ } else {
+ HudUtil.drawTexturedModalRect(n3, n2, n - 128, 36, 66, 12, -100);
+ }
+ if ((Boolean) this.highlightNorth.getValue()) {
+ GL11.glColor4f((float) (highlightColor >> 16 & 255) / (float) 255, (float) (highlightColor >> 8 & 255) / (float) 255, (float) (highlightColor & 255) / (float) 255, (float) (highlightColor >> 24 & 255) / (float) 255);
+ if (n < 128) {
+ HudUtil.drawTexturedModalRect(n3, n2, n, 72, 66, 12, -100);
+ } else {
+ HudUtil.drawTexturedModalRect(n3, n2, n - 128, 84, 66, 12, -100);
+ }
+ }
+ } else {
+ this.mc.getTextureManager().bindTexture(this.texture);
+ if (n < 128) {
+ HudUtil.drawTexturedModalRect(n3, n2, n, 0, 66, 12, -100);
+ } else {
+ HudUtil.drawTexturedModalRect(n3, n2, n - 128, 12, 66, 12, -100);
+ }
+ }
+ this.mc.fontRendererObj.drawString("|", n3 + 32, n2 + 1, this.markerColor.getColorValue());
+ this.mc.fontRendererObj.drawString("|§r", n3 + 32, n2 + 5, this.markerColor.getColorValue());
+ if ((Boolean) this.border.getValue()) {
+ float borderThickness = (Float) this.borderThickness.getValue();
+ Gui.drawOutline(-borderThickness, -borderThickness, 66 + borderThickness, 12 + borderThickness, borderThickness, this.borderColor.getColorValue());
+ }
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleNotifications.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleNotifications.java
new file mode 100644
index 0000000..45bd127
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModuleNotifications.java
@@ -0,0 +1,182 @@
+package com.cheatbreaker.client.module.impl.normal.hud;
+
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.event.impl.render.GuiDrawEvent;
+import com.cheatbreaker.client.event.impl.tick.KeepAliveEvent;
+import com.cheatbreaker.client.event.impl.tick.TickEvent;
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.ui.util.RenderUtil;
+import com.cheatbreaker.client.ui.util.font.CBFontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @Module - ModuleNotifications
+ * @see AbstractModule
+ *
+ * This module displays custom Notifications for the CheatBreaker Client.
+ */
+public class ModuleNotifications extends AbstractModule {
+ public long time = System.currentTimeMillis();
+ private final List notifications = new ArrayList<>();
+
+ public ModuleNotifications() {
+ super("Notifications");
+ this.addEvent(KeepAliveEvent.class, this::onKeepAlive);
+ this.addEvent(TickEvent.class, this::onTick);
+ this.addEvent(GuiDrawEvent.class, this::onGuiDraw);
+ this.setDefaultState(true);
+ }
+
+ private void onKeepAlive(KeepAliveEvent event) {
+ this.time = System.currentTimeMillis();
+ }
+
+ private void onTick(TickEvent event) {
+ Iterator iterator = this.notifications.iterator();
+ while (iterator.hasNext()) {
+ Notification notification = iterator.next();
+ notification.onTick();
+ long l = notification.ticks + notification.duration - System.currentTimeMillis();
+ if (l > 0L) continue;
+ int n = notification.scaledWidth;
+ for (Notification notification2 : this.notifications) {
+ if (notification2.scaledWidth >= notification.scaledWidth) continue;
+ notification2.activeTicks = 0;
+ notification2.scaledHeight = n;
+ n = notification2.scaledWidth;
+ }
+ iterator.remove();
+ }
+ }
+
+ private void onGuiDraw(GuiDrawEvent event) {
+ for (Notification notification : this.notifications) {
+ notification.render(event.getScaledResolution().getScaledWidth());
+ }
+ }
+
+ public void send(String notificationType, String message, long duration) {
+ ScaledResolution scaledResolution = new ScaledResolution(this.mc);
+ if (duration < 2000L) {
+ duration = 2000L;
+ }
+
+ message = message.replaceAll("&([abcdefghijklmrABCDEFGHIJKLMNR0-9])|(&$)", "§$1");
+ Type type;
+ switch (notificationType.toLowerCase()) {
+ case "info":
+ type = Type.INFO;
+ break;
+ case "error":
+ type = Type.ERROR;
+ break;
+ default:
+ type = Type.NEUTRAL;
+ }
+
+ Notification var11 = new Notification(this, scaledResolution, type, message, duration);
+ int var12 = var11.scaledHeight - var11.height - 2;
+
+ for (int var9 = this.notifications.size() - 1; var9 >= 0; --var9) {
+ Notification var10 = this.notifications.get(var9);
+ var10.activeTicks = 0;
+ var10.scaledHeight = var12;
+ var12 -= 2 + var10.height;
+ }
+
+ this.notifications.add(var11);
+ }
+
+ class Notification {
+ public Type type;
+ public String message;
+ public long duration;
+ public long ticks = System.currentTimeMillis();
+ public int scaledWidth;
+ public int scaledHeight;
+ public int height;
+ public int activeTicks = 0;
+ final ModuleNotifications notificationsMod;
+
+ Notification(ModuleNotifications notificationsMod, ScaledResolution scaledResolution, Type type, String message, long duration) {
+ this.notificationsMod = notificationsMod;
+ this.type = type;
+ this.message = message;
+ this.duration = duration;
+ this.height = type == Type.NEUTRAL ? 16 : 20;
+ this.scaledHeight = scaledResolution.getScaledHeight() - 14 - this.height;
+ this.scaledWidth = scaledResolution.getScaledHeight() + this.height;
+ }
+
+ public void onTick() {
+ if (this.scaledHeight != -1) {
+ ++this.activeTicks;
+ float f = (float) this.activeTicks * ((float) this.activeTicks / (float) 5) / (float) 7;
+ if (this.scaledWidth > this.scaledHeight) {
+ if ((float) this.scaledWidth - f < (float) this.scaledHeight) {
+ this.scaledWidth = this.scaledHeight;
+ this.scaledHeight = -1;
+ } else {
+ this.scaledWidth = (int) ((float) this.scaledWidth - f);
+ }
+ } else if (this.scaledWidth < this.scaledHeight) {
+ if ((float) this.scaledWidth + f > (float) this.scaledHeight) {
+ this.scaledWidth = this.scaledHeight;
+ this.scaledHeight = -1;
+ } else {
+ this.scaledWidth = (int) ((float) this.scaledWidth + f);
+ }
+ } else if (this.scaledWidth == this.scaledHeight) {
+ this.scaledHeight = -1;
+ }
+ }
+ }
+
+ public void render(int n) {
+ CBFontRenderer cBFontRenderer = CheatBreaker.getInstance().playRegular16px;
+ int n2 = this.scaledWidth;
+ float f = cBFontRenderer.getStringWidth(this.message);
+ int n3 = (int) (this.type == Type.NEUTRAL ? f + (float) 10 : f + (float) 30);
+ Gui.drawRect(n - 5 - n3, n2, n - 5, n2 + this.height, -1358954496);
+ switch (this.type) {
+
+ case ERROR:
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ RenderUtil.renderIcon(new ResourceLocation("client/icons/error-64.png"), (float) 6, (float) (n - 10 - n3 + 9), (float) (n2 + 4));
+ Gui.drawRect((float) (n - 10) - f - 4.5f, n2 + 4, (float) (n - 10) - f - 4.0F, n2 + this.height - 4, -1342177281);
+ break;
+
+ case INFO:
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.65F);
+ RenderUtil.renderIcon(new ResourceLocation("client/icons/info-64.png"), (float) 6, (float) (n - 10 - n3 + 9), (float) (n2 + 4));
+ Gui.drawRect((float) (n - 10) - f - 4.5f, n2 + 4, (float) (n - 10) - f - 4.0F, n2 + this.height - 4, -1342177281);
+ }
+
+ long l = this.duration - (this.ticks + this.duration - System.currentTimeMillis());
+ if (l > this.duration) {
+ l = this.duration;
+ }
+ if (l < 0L) {
+ l = 0L;
+ }
+ float f2 = f * ((float) l / (float) this.duration * (float) 100 / (float) 100);
+ Gui.drawRect((float) (n - 10) - f, (float) (n2 + this.height) - 56.46667f * 0.077922076f, (float) (n - 10) - f + f, n2 + this.height - 4, 0x30666666);
+ Gui.drawRect((float) (n - 10) - f, (float) (n2 + this.height) - 2.2f * 2.0f, (float) (n - 10) - f + f2, n2 + this.height - 4, -1878982912);
+ cBFontRenderer.drawString(this.message, (float) (n - 10) - f, (float) (n2 + (this.type == Type.NEUTRAL ? 2 : 4)), -1);
+ }
+ }
+
+ enum Type {
+ INFO,
+ ERROR,
+ NEUTRAL
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModulePlayerList.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModulePlayerList.java
new file mode 100644
index 0000000..89174f1
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModulePlayerList.java
@@ -0,0 +1,300 @@
+package com.cheatbreaker.client.module.impl.normal.hud;
+
+import com.cheatbreaker.client.CheatBreaker;
+import com.cheatbreaker.client.cosmetic.profile.ClientProfile;
+import com.cheatbreaker.client.event.impl.render.GuiDrawEvent;
+import com.cheatbreaker.client.event.impl.render.PreviewDrawEvent;
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.module.data.CustomizationLevel;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.ui.module.GuiAnchor;
+import com.cheatbreaker.client.ui.module.HudLayoutEditorGui;
+import com.mojang.authlib.GameProfile;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiPlayerTabOverlay;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.network.NetHandlerPlayClient;
+import net.minecraft.client.network.NetworkPlayerInfo;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EnumPlayerModelParts;
+import net.minecraft.scoreboard.IScoreObjectiveCriteria;
+import net.minecraft.scoreboard.ScoreObjective;
+import net.minecraft.scoreboard.Scoreboard;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.WorldSettings;
+import org.apache.commons.lang3.ObjectUtils;
+import org.lwjgl.opengl.GL11;
+
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * @Module - ModulePlayerList
+ * @see AbstractModule
+ *
+ * This module allows you to edit the default Minecraft player list.
+ */
+public class ModulePlayerList extends AbstractModule {
+ public Setting background;
+ public Setting rowBackground;
+ public Setting highlightSelfRow;
+ public Setting highlightCBRows;
+ public Setting backgroundColor;
+ public Setting pingRowColor;
+ public Setting rowColor;
+ public Setting highlightedSelfRowColor;
+ public Setting highlightedCBRowColor;
+
+ public Setting nameTextShadow;
+ public Setting showLogo;
+ public Setting highlightSelfNameInTab;
+ public Setting highlightCBPlayersNamesInTab;
+ public Setting highlightedSelfNameColor;
+ public Setting highlightedCBNameColor;
+
+ public Setting ping;
+ public Setting pingAsNumber;
+ public Setting pingTextShadow;
+ public Setting dynamicPingNumberColor;
+ public Setting staticPingColor;
+ public Setting lowPingColor;
+ public Setting mediumPingColor;
+ public Setting highPingColor;
+ public Setting extremelyHighPingColor;
+ public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png");
+
+ private final Pattern STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + '§' + "[0-689A-E]");
+
+ public ModulePlayerList() {
+ super("Player List");
+ this.setDefaultAnchor(GuiAnchor.MIDDLE_TOP);
+ this.setDefaultTranslations(0.0F, 12.0F);
+ this.notRenderHUD = false;
+
+ new Setting(this, "label").setValue("General Options").setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.background = new Setting(this, "Show Background").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.rowBackground = new Setting(this, "Show Row Background").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.highlightSelfRow = new Setting(this, "Highlight Own Row").setValue(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.highlightCBRows = new Setting(this, "Highlight CheatBreaker Players' Row").setValue(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.pingRowColor = new Setting(this, "Use Ping Color for Row Background").setValue(false).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.rowBackground.getValue());
+ this.rowColor = new Setting(this, "Row Background Color").setValue(0x20FFFFFF).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.rowBackground.getValue());
+ this.highlightedSelfRowColor = new Setting(this, "Self Row Color").setValue(0x40AA0000).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.rowBackground.getValue() && (Boolean) this.highlightSelfRow.getValue());
+ this.highlightedCBRowColor = new Setting(this, "CheatBreaker Row Color").setValue(0x40DA4253).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.rowBackground.getValue() && (Boolean) this.highlightCBRows.getValue());
+ this.backgroundColor = new Setting(this, "Background Color").setValue(0x80000000).setMinMax(Integer.MIN_VALUE, Integer.MAX_VALUE).setCustomizationLevel(CustomizationLevel.SIMPLE);
+
+ new Setting(this, "label").setValue("Name Options").setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.nameTextShadow = new Setting(this, "Name Text Shadow").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.showLogo = new Setting(this, "Show CheatBreaker Logo").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.highlightSelfNameInTab = new Setting(this, "Highlight Own Name").setValue(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.highlightCBPlayersNamesInTab = new Setting(this, "Highlight CheatBreaker Players' Name").setValue(false).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.highlightedSelfNameColor = new Setting(this, "Self Text Color").setValue(0xFFCC2222).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.highlightSelfNameInTab.getValue());
+ this.highlightedCBNameColor = new Setting(this, "CheatBreaker Text Color").setValue(0xFFFB6576).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.highlightCBPlayersNamesInTab.getValue());
+
+ new Setting(this, "label").setValue("Ping Options").setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.ping = new Setting(this, "Show Ping").setValue(true).setCustomizationLevel(CustomizationLevel.SIMPLE);
+ this.pingAsNumber = new Setting(this, "Show Ping as Number").setValue(false).setCustomizationLevel(CustomizationLevel.SIMPLE).setCondition(() -> (Boolean) this.ping.getValue());
+ this.pingTextShadow = new Setting(this, "Ping Text Shadow").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.ping.getValue() && (Boolean) this.pingAsNumber.getValue());
+ this.dynamicPingNumberColor = new Setting(this, "Dynamic Ping Number Color").setValue(true).setCustomizationLevel(CustomizationLevel.MEDIUM).setCondition(() -> (Boolean) this.ping.getValue() && (Boolean) this.pingAsNumber.getValue());
+ this.staticPingColor = new Setting(this, "Static Ping Color").setValue(0xFFFFFF55).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.ADVANCED).setCondition(() -> (Boolean) this.ping.getValue() && (Boolean) this.pingAsNumber.getValue() && !(Boolean) this.dynamicPingNumberColor.getValue());
+ this.lowPingColor = new Setting(this, "Low Ping Color").setValue(0xFF55FF55).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.ADVANCED).setCondition(() -> (Boolean) this.ping.getValue() && (Boolean) this.pingAsNumber.getValue() && (Boolean) this.dynamicPingNumberColor.getValue());
+ this.mediumPingColor = new Setting(this, "Medium Ping Color").setValue(0xFFFFFF55).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.ADVANCED).setCondition(() -> (Boolean) this.ping.getValue() && (Boolean) this.pingAsNumber.getValue() && (Boolean) this.dynamicPingNumberColor.getValue());
+ this.highPingColor = new Setting(this, "High Ping Color").setValue(0xFFFF5555).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.ADVANCED).setCondition(() -> (Boolean) this.ping.getValue() && (Boolean) this.pingAsNumber.getValue() && (Boolean) this.dynamicPingNumberColor.getValue());
+ this.extremelyHighPingColor = new Setting(this, "Extremely High Ping Color").setValue(0xFFAA0000).setMinMax(-2147483648, 2147483647).setCustomizationLevel(CustomizationLevel.ADVANCED).setCondition(() -> (Boolean) this.ping.getValue() && (Boolean) this.pingAsNumber.getValue() && (Boolean) this.dynamicPingNumberColor.getValue());
+ this.setDescription("Customize the player list tab.");
+ this.setAliases("Tab");
+ this.addEvent(PreviewDrawEvent.class, this::onPreviewDraw);
+ this.addEvent(GuiDrawEvent.class, this::onGuiDraw);
+ }
+
+ public String valueString() {
+ return null;
+ }
+
+ private void onPreviewDraw(PreviewDrawEvent event) {
+ if (!this.isRenderHud()) {
+ return;
+ }
+ GL11.glPushMatrix();
+ scaleAndTranslate(event.getScaledResolution());
+ ScaledResolution scaledresolution = new ScaledResolution(this.mc);
+ int i = scaledresolution.getScaledWidth();
+ Scoreboard scoreboard = this.mc.theWorld.getScoreboard();
+ ScoreObjective scoreobjective = null;
+ ScoreObjective scoreobjective1 = scoreobjective != null ? scoreobjective : scoreboard.getObjectiveInDisplaySlot(1);
+ render(0, scoreboard, scoreobjective1, 0, 0);
+ GL11.glPopMatrix();
+ }
+
+ private void onGuiDraw(GuiDrawEvent event) {
+ if (this.isRenderHud() || (this.hiddenFromHud && !(this.mc.currentScreen instanceof HudLayoutEditorGui))) {
+ ScoreObjective var48 = this.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(0);
+ GL11.glPushMatrix();
+ this.scaleAndTranslate(event.getScaledResolution());
+ ScaledResolution scaledresolution = new ScaledResolution(this.mc);
+ int i = scaledresolution.getScaledWidth();
+ Scoreboard scoreboard = this.mc.theWorld.getScoreboard();
+ ScoreObjective scoreobjective1;
+ scoreobjective1 = scoreboard.getObjectiveInDisplaySlot(0);
+ if (this.mc.gameSettings.keyBindPlayerList.isKeyDown() && (!this.mc.isIntegratedServerRunning() || this.mc.thePlayer.sendQueue.getPlayerInfoMap().size() > 1 || var48 != null)) {
+ render(0, scoreboard, scoreobjective1, 0, 0);
+ }
+ GL11.glPopMatrix();
+ }
+ }
+
+ public void render(int width, Scoreboard scoreboardIn, ScoreObjective scoreObjectiveIn, int x, int y) {
+ NetHandlerPlayClient nethandlerplayclient = this.mc.thePlayer.sendQueue;
+ List list = GuiPlayerTabOverlay.field_175252_a.sortedCopy(nethandlerplayclient.getPlayerInfoMap());
+ int i = 0;
+ int j = 0;
+
+ for (NetworkPlayerInfo networkplayerinfo : list) {
+ int k = this.mc.fontRendererObj.getStringWidth(this.mc.ingameGUI.overlayPlayerList.getPlayerName(networkplayerinfo));
+ i = Math.max(i, k);
+
+ if (scoreObjectiveIn != null && scoreObjectiveIn.getRenderType() != IScoreObjectiveCriteria.EnumRenderType.HEARTS) {
+ k = this.mc.fontRendererObj.getStringWidth(" " + scoreboardIn.getValueFromObjective(networkplayerinfo.getGameProfile().getName(), scoreObjectiveIn).getScorePoints());
+ j = Math.max(j, k);
+ }
+ }
+
+ list = list.subList(0, Math.min(list.size(), 80));
+ int l3 = list.size();
+ int i4 = l3;
+ int j4;
+
+ for (j4 = 1; i4 > 20; i4 = (l3 + j4 - 1) / j4) {
+ ++j4;
+ }
+
+ boolean flag = this.mc.isIntegratedServerRunning() || this.mc.getNetHandler().getNetworkManager().getIsencrypted();
+ int l;
+
+ if (scoreObjectiveIn != null) {
+ if (scoreObjectiveIn.getRenderType() == IScoreObjectiveCriteria.EnumRenderType.HEARTS) {
+ l = 90;
+ } else {
+ l = j;
+ }
+ } else {
+ l = 0;
+ }
+
+ int i1 = Math.min(j4 * ((flag ? 9 : 0) + i + l + 13), width - 50) / j4;
+ int j1 = 0/*width / 2 - (i1 * j4 + (j4 - 1) * 5) / 2*/;
+ int k1 = 10;
+ int l1 = i1 * j4 + (j4 - 1) * 5;
+ List list1 = null;
+ List list2 = null;
+
+ if (this.mc.ingameGUI.overlayPlayerList.header != null) {
+ list1 = this.mc.fontRendererObj.listFormattedStringToWidth(this.mc.ingameGUI.overlayPlayerList.header.getFormattedText(), width - 50);
+
+ for (String s : list1) {
+ l1 = Math.max(l1, this.mc.fontRendererObj.getStringWidth(s));
+ }
+ }
+
+ if (this.mc.ingameGUI.overlayPlayerList.footer != null) {
+ list2 = this.mc.fontRendererObj.listFormattedStringToWidth(this.mc.ingameGUI.overlayPlayerList.footer.getFormattedText(), width - 50);
+
+ for (String s2 : list2) {
+ l1 = Math.max(l1, this.mc.fontRendererObj.getStringWidth(s2));
+ }
+ }
+
+ if (list1 != null) {
+ Gui.drawRect(width / 2 - l1 / 2 - 1, k1 - 1, width / 2 + l1 / 2 + 1, k1 + list1.size() * this.mc.fontRendererObj.FONT_HEIGHT, Integer.MIN_VALUE);
+
+ for (String s3 : list1) {
+ int i2 = this.mc.fontRendererObj.getStringWidth(s3);
+ this.mc.fontRendererObj.drawStringWithShadow(s3, (float) (width / 2 - i2 / 2), (float) k1, -1);
+ k1 += this.mc.fontRendererObj.FONT_HEIGHT;
+ }
+
+ ++k1;
+ }
+
+ Gui.drawRect(width / 2 - l1 / 2 - 1, k1 - 1, width / 2 + l1 / 2 + 1, k1 + i4 * 9, Integer.MIN_VALUE);
+
+ for (int k4 = 0; k4 < l3; ++k4) {
+ int l4 = k4 / i4;
+ int i5 = k4 % i4;
+ int j2 = 0/*j1 + l4 * i1 + l4 * 5*/;
+ int k2 = k1 + i5 * 9;
+ Gui.drawRect(j2, k2, j2 + i1, k2 + 8, 553648127);
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ GlStateManager.enableAlpha();
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+
+ if (k4 < list.size()) {
+ NetworkPlayerInfo networkplayerinfo1 = list.get(k4);
+ String s1 = this.mc.ingameGUI.overlayPlayerList.getPlayerName(networkplayerinfo1);
+ GameProfile gameprofile = networkplayerinfo1.getGameProfile();
+
+ if (flag) {
+ EntityPlayer entityplayer = this.mc.theWorld.getPlayerEntityByUUID(gameprofile.getId());
+ boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE) && (gameprofile.getName().equals("Dinnerbone") || gameprofile.getName().equals("Grumm"));
+ this.mc.getTextureManager().bindTexture(networkplayerinfo1.getLocationSkin());
+ int l2 = 8 + (flag1 ? 8 : 0);
+ int i3 = 8 * (flag1 ? -1 : 1);
+ Gui.drawScaledCustomSizeModalRect(j2, k2, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F);
+
+ if (entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.HAT)) {
+ int j3 = 8 + (flag1 ? 8 : 0);
+ int k3 = 8 * (flag1 ? -1 : 1);
+ Gui.drawScaledCustomSizeModalRect(j2, k2, 40.0F, (float) j3, 8, k3, 8, 8, 64.0F, 64.0F);
+ }
+
+ j2 += 9;
+ }
+
+ if (networkplayerinfo1.getGameType() == WorldSettings.GameType.SPECTATOR) {
+ s1 = EnumChatFormatting.ITALIC + s1;
+ this.mc.fontRendererObj.drawStringWithShadow(s1, (float) j2, (float) k2, -1862270977);
+ } else {
+ this.mc.fontRendererObj.drawStringWithShadow(s1, (float) j2, (float) k2, -1);
+ }
+
+ if (scoreObjectiveIn != null && networkplayerinfo1.getGameType() != WorldSettings.GameType.SPECTATOR) {
+ int k5 = j2 + i + 1;
+ int l5 = k5 + l;
+
+ if (l5 - k5 > 5) {
+ this.mc.ingameGUI.overlayPlayerList.drawScoreboardValues(scoreObjectiveIn, k2, gameprofile.getName(), k5, l5, networkplayerinfo1);
+ }
+ }
+
+ this.mc.ingameGUI.overlayPlayerList.drawPing(i1, j2 - (flag ? 9 : 0), k2, networkplayerinfo1);
+ }
+ }
+
+ if (list2 != null) {
+ k1 = k1 + i4 * 9 + 1;
+ Gui.drawRect(width / 2 - l1 / 2 - 1, k1 - 1, width / 2 + l1 / 2 + 1, k1 + list2.size() * this.mc.fontRendererObj.FONT_HEIGHT, Integer.MIN_VALUE);
+
+ for (String s4 : list2) {
+ int j5 = this.mc.fontRendererObj.getStringWidth(s4);
+ this.mc.fontRendererObj.drawStringWithShadow(s4, (float) (width / 2 - j5 / 2), (float) k1, -1);
+ k1 += this.mc.fontRendererObj.FONT_HEIGHT;
+ }
+ }
+ this.setDimensions(10, 10);
+ }
+
+ private boolean isInPlayerList(String username) {
+ for (ClientProfile profile : CheatBreaker.getInstance().getProfileHandler().getWsOnlineUsers().values()) {
+ if (profile.getUsername().equalsIgnoreCase(username)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String stripColor(String input) {
+ return input == null ? null : this.STRIP_COLOR_PATTERN.matcher(input).replaceAll("§r");
+ }
+}
diff --git a/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModulePotionEffects.java b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModulePotionEffects.java
new file mode 100644
index 0000000..072ddae
--- /dev/null
+++ b/Client-1.8.9/src/main/java/com/cheatbreaker/client/module/impl/normal/hud/ModulePotionEffects.java
@@ -0,0 +1,383 @@
+package com.cheatbreaker.client.module.impl.normal.hud;
+
+import com.cheatbreaker.client.event.impl.render.GuiDrawEvent;
+import com.cheatbreaker.client.event.impl.render.PreviewDrawEvent;
+import com.cheatbreaker.client.event.impl.tick.TickEvent;
+import com.cheatbreaker.client.module.AbstractModule;
+import com.cheatbreaker.client.module.data.CustomizationLevel;
+import com.cheatbreaker.client.module.data.Setting;
+import com.cheatbreaker.client.ui.module.*;
+import com.cheatbreaker.client.ui.util.RenderUtil;
+import com.google.common.collect.ImmutableMap;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
+
+import java.util.*;
+import java.util.regex.Pattern;
+
+public class ModulePotionEffects extends AbstractModule {
+ private final Setting componentOptionsLabel;
+ private final Setting showIcon;
+ private final Setting effectName;
+ private final Setting effectNameText;
+ private final Setting effectAmplifierText;
+ private final Setting romanNumerals;
+ private final Setting showLevelOne;
+ private final Setting maximumRomanNumeral;
+ private final Setting duration;
+
+ private final Setting generalOptionsLabel;
+ private final Setting showWhileTyping;
+ public Setting potionInfoInInventory;
+ private final Setting textShadow;
+ private final Setting effectSpacing;
+
+ private final Setting sortingOptionsLabel;
+ private final Setting sorting;
+ private final Setting reverseSorting;
+
+ private final Setting colorOptionsLabel;
+ private final Setting nameColor;
+ private final Setting durationColor;
+
+ private final Setting blinkOptionsLabel;
+ private final Setting effectNameBlink;
+ private final Setting effectIconBlink;
+ private final Setting durationBlink;
+ private final Setting blink;
+ private final Setting blinkDuration;
+ private final Setting blinkSpeed;
+
+ private final Setting colorNameBasedOnEffect;
+ private final Setting colorDurationBasedOnEffect;
+ private final Setting texturePackOverrideColors;
+ private final Setting colorType;
+
+ private final Setting excludingOptionsLabel;
+ private final Setting excludeSetDuration;
+ private final Setting excludedDuration;
+ private final Setting excludePerm;
+ private final Setting excludeSetAmplifier;
+ private final Setting excludedAmplifier;
+ private final Setting excludeHelpfulHarmfulEffects;
+ private final Setting excludeSpecificEffects;
+
+ private final ResourceLocation inventoryBackground = new ResourceLocation("textures/gui/container/inventory.png");
+ private int ticks = 0;
+ public static Map potionColorDefault = new ImmutableMap.Builder().put(1, -11141121).put(2, -10851199)
+ .put(3, -2506685).put(4, -11910633).put(5, -7134173).put(6, 0xFFF82423).put(7, 0xFF430A09).put(8, -1).put(9, -11199158).put(10, -3318613).put(11, 0xFF53C653).put(12, -1795526)
+ .put(13, -13741415).put(14, -8420462).put(15, -14737629).put(16, -14737503).put(17, -10979757)
+ .put(18, -12038840).put(19, -11627727).put(20, -13293017).put(21, 0xFFDE170A).put(22, -14331227).put(23, 0xFFF8C123).build();
+ public static Map potionColorPotionColors = new ImmutableMap.Builder().put(1, 0xFF7CAFC6).put(2, -10851199)
+ .put(3, -2506685).put(4, -11910633).put(5, -7134173).put(6, 0xFFF82423).put(7, 0xFF430A09).put(8, 0xFF786297).put(9, -11199158).put(10, -3318613).put(11, 0xFF99453A).put(12, -1795526)
+ .put(13, -13741415).put(14, -8420462).put(15, -14737629).put(16, -14737503).put(17, -10979757)
+ .put(18, -12038840).put(19, -11627727).put(20, -13293017).put(21, 0xFFF87D23).put(22, -14331227).put(23, 0xFFF82423).build();
+ public static Map potionColorColorCodes = new ImmutableMap.Builder().put(1, -11141121).put(2, 0xFF555555)
+ .put(3, 0xFFFFFF55).put(4, 0xFF555555).put(5, 0xFFAA0000).put(6, 0xFFFF5555).put(7, 0xFFAA0000).put(8, -1).put(9, 0xFFAA00AA).put(10, 0xFFFF55FF).put(11, 0xFFAAAAAA).put(12, 0xFFFFAA00)
+ .put(13, 0xFF5555FF).put(14, 0xFFAAAAAA).put(15, 0xFF000000).put(16, 0xFF0000AA).put(17, 0xFF00AA00)
+ .put(18, 0xFF555555).put(19, 0xFF55FF55).put(20, 0xFF000000).put(21, 0xFF5555).put(22, 0xFFFFFF55).put(23, 0xFFFFFF55).build();
+ public static Map