fix cofl messages didnt get sent
This commit is contained in:
parent
7e5616266a
commit
3f45e8b26d
1 changed files with 27 additions and 28 deletions
|
@ -42,39 +42,38 @@ public class Cofl {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleMessage(String str) {
|
Pattern pattern = Pattern.compile("type[\":]*flip");
|
||||||
if (AHConfig.SNIPER_MODE != 2) return;
|
Pattern commandPattern = Pattern.compile("/viewauction \\w+");
|
||||||
if (!str.startsWith("Received:")) return;
|
Pattern pricePattern = Pattern.compile("§7Med: §b(\\d{1,3}(?:,\\d{3})*)");
|
||||||
Pattern pattern = Pattern.compile("type[\":]*flip");
|
|
||||||
Matcher matcher = pattern.matcher(str);
|
|
||||||
if (matcher.find()) {
|
|
||||||
Pattern commandPattern = Pattern.compile("/viewauction \\w+");
|
|
||||||
Matcher commandMacther = commandPattern.matcher(str);
|
|
||||||
Pattern pricePattern = Pattern.compile("§7Med: §b(\\d{1,3}(?:,\\d{3})*)");
|
|
||||||
Matcher priceMatcher = pricePattern.matcher(str);
|
|
||||||
String[] split = str.split("Received: ");
|
|
||||||
JsonObject strJson = new JsonParser().parse(split[1]).getAsJsonObject();
|
|
||||||
String data = strJson.get("data").getAsString();
|
|
||||||
String itemName = new JsonParser().parse(data).getAsJsonObject().get("itemName").getAsString();
|
|
||||||
System.out.println(itemName);
|
|
||||||
Pattern namePattern = Pattern.compile("\"itemName\":\"([^\"]+)\"");//Pattern.compile("\"itemName\":\"([^\"]+)\"", Pattern.MULTILINE);
|
|
||||||
Matcher nameMatcher = namePattern.matcher(str);
|
|
||||||
System.out.println("Command: " + commandMacther.find());
|
|
||||||
System.out.println("Price: " + priceMatcher.find());
|
|
||||||
System.out.println("Name: " + nameMatcher.find());
|
|
||||||
if (commandMacther.find() && priceMatcher.find() && nameMatcher.find()) {
|
|
||||||
String command = commandMacther.group();
|
|
||||||
Utils.debugLog("Adding auction to queue: " + command);
|
|
||||||
Utils.debugLog("Price: " + Integer.parseInt(priceMatcher.group(1).replaceAll(",", "")));
|
|
||||||
Utils.debugLog("Name: " + nameMatcher.group(1));
|
|
||||||
price = Integer.parseInt(priceMatcher.group(1).replaceAll(",", ""));
|
|
||||||
getQueue().add(new QueueItem(command, nameMatcher.group(1), price));
|
|
||||||
getQueue().scheduleClear();
|
|
||||||
|
|
||||||
|
public void handleMessage(String str) {
|
||||||
|
try {
|
||||||
|
if (AHConfig.SNIPER_MODE != 2) return;
|
||||||
|
if (!getOpen()) return;
|
||||||
|
if (!str.startsWith("Received:")) return;
|
||||||
|
Matcher matcher = pattern.matcher(str);
|
||||||
|
if (matcher.find()) {
|
||||||
|
Matcher commandMacther = commandPattern.matcher(str);
|
||||||
|
Matcher priceMatcher = pricePattern.matcher(str);
|
||||||
|
String[] split = str.split("Received: ");
|
||||||
|
JsonObject strJson = new JsonParser().parse(split[1]).getAsJsonObject();
|
||||||
|
String itemName = new JsonParser().parse(strJson.get("data").getAsString()).getAsJsonObject().get("auction").getAsJsonObject().get("itemName").getAsString();
|
||||||
|
if (commandMacther.find() && priceMatcher.find() && itemName != null) {
|
||||||
|
String command = commandMacther.group();
|
||||||
|
Utils.debugLog("Adding auction to queue: " + command);
|
||||||
|
Utils.debugLog("Price: " + Integer.parseInt(priceMatcher.group(1).replaceAll(",", "")));
|
||||||
|
Utils.debugLog("Name: " + itemName);
|
||||||
|
price = Integer.parseInt(priceMatcher.group(1).replaceAll(",", ""));
|
||||||
|
getQueue().add(new QueueItem(command, itemName, price));
|
||||||
|
getQueue().scheduleClear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void toggleAuction() {
|
public void toggleAuction() {
|
||||||
if (getOpen()) {
|
if (getOpen()) {
|
||||||
Utils.sendMessage("Stopped COFL Sniper");
|
Utils.sendMessage("Stopped COFL Sniper");
|
||||||
|
|
Loading…
Reference in a new issue