More code optimizations, remove chat event
This commit is contained in:
parent
2c573bdca0
commit
77ee59589f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
145407
javascript/classes.js
145407
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,17 +0,0 @@
|
||||||
package dev.resent.event.impl;
|
|
||||||
|
|
||||||
import net.kyori.event.Cancellable;
|
|
||||||
|
|
||||||
public class ClientChatEvent extends Event implements Cancellable{
|
|
||||||
public String message;
|
|
||||||
public boolean canceled;
|
|
||||||
|
|
||||||
public ClientChatEvent(String message) { this.message = message; }
|
|
||||||
public String getMessage() { return message; }
|
|
||||||
public void setMessage(String message) { this.message = message; }
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() { return canceled; }
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean canceled) { this.canceled = canceled; }
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,10 +1,11 @@
|
||||||
package dev.resent.setting;
|
package dev.resent.setting;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ModeSetting extends Setting{
|
public class ModeSetting extends Setting{
|
||||||
public List<String> modes = new ArrayList<String>();
|
public List<String> modes = new ArrayList<>();
|
||||||
|
|
||||||
public String current;
|
public String current;
|
||||||
|
|
||||||
|
@ -12,20 +13,13 @@ public class ModeSetting extends Setting{
|
||||||
|
|
||||||
public ModeSetting(String name, String description, String... modes) {
|
public ModeSetting(String name, String description, String... modes) {
|
||||||
super(name, description);
|
super(name, description);
|
||||||
for (String s : modes) {
|
Collections.addAll(this.modes, modes);
|
||||||
this.modes.add(s);
|
if (curr == this.modes.size()) {
|
||||||
}
|
|
||||||
if (curr >= this.modes.size()) {
|
|
||||||
curr = 0;
|
curr = 0;
|
||||||
}
|
}
|
||||||
current = this.modes.get(curr);
|
current = this.modes.get(curr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModeSetting FireChange() {
|
|
||||||
onChange();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onChange() { }
|
public void onChange() { }
|
||||||
|
|
||||||
public void setValue(String val) {
|
public void setValue(String val) {
|
||||||
|
|
|
@ -24,7 +24,6 @@ public class ClickGUI extends GuiScreen {
|
||||||
public ScaledResolution sr;
|
public ScaledResolution sr;
|
||||||
public int x, y, width, height;
|
public int x, y, width, height;
|
||||||
public int offset = 0;
|
public int offset = 0;
|
||||||
public float offsety = 20;
|
|
||||||
public FontRenderer fr;
|
public FontRenderer fr;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,7 +37,7 @@ public class ClickGUI extends GuiScreen {
|
||||||
width = GuiScreen.width - x;
|
width = GuiScreen.width - x;
|
||||||
height = GuiScreen.height - y;
|
height = GuiScreen.height - y;
|
||||||
x = sr.getScaledWidth() / 8 + xo;
|
x = sr.getScaledWidth() / 8 + xo;
|
||||||
y = sr.getScaledHeight() / (int) 1.1 - 10 + xy;
|
y = sr.getScaledHeight() - 10 + xy;
|
||||||
int off = 0;
|
int off = 0;
|
||||||
|
|
||||||
for (Mod m: Resent.INSTANCE.modManager.modules) {
|
for (Mod m: Resent.INSTANCE.modManager.modules) {
|
||||||
|
@ -74,8 +73,8 @@ public class ClickGUI extends GuiScreen {
|
||||||
fr.drawString("<", x - fr.FONT_HEIGHT + 4, height + 29 + fr.FONT_HEIGHT + 2, -1);
|
fr.drawString("<", x - fr.FONT_HEIGHT + 4, height + 29 + fr.FONT_HEIGHT + 2, -1);
|
||||||
for (int asdf = 0; asdf < this.modWatching.settings.size(); asdf++) {
|
for (int asdf = 0; asdf < this.modWatching.settings.size(); asdf++) {
|
||||||
|
|
||||||
BooleanSetting b = null;
|
BooleanSetting b;
|
||||||
ModeSetting m = null;
|
ModeSetting m;
|
||||||
Setting s = this.modWatching.settings.get(asdf);
|
Setting s = this.modWatching.settings.get(asdf);
|
||||||
|
|
||||||
if (s instanceof BooleanSetting) {
|
if (s instanceof BooleanSetting) {
|
||||||
|
@ -88,7 +87,7 @@ public class ClickGUI extends GuiScreen {
|
||||||
if (s instanceof ModeSetting) {
|
if (s instanceof ModeSetting) {
|
||||||
m = (ModeSetting) s;
|
m = (ModeSetting) s;
|
||||||
if(isMouseInside(mouseX, mouseY, this.x+24, height-fr.FONT_HEIGHT+50+var, this.x+24+fr.getStringWidth(s.name+": "+m.getValue()), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT) && mouseButton == 0)
|
if(isMouseInside(mouseX, mouseY, this.x+24, height-fr.FONT_HEIGHT+50+var, this.x+24+fr.getStringWidth(s.name+": "+m.getValue()), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT) && mouseButton == 0)
|
||||||
m.next();
|
m.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +108,7 @@ public class ClickGUI extends GuiScreen {
|
||||||
width = GuiScreen.width - x;
|
width = GuiScreen.width - x;
|
||||||
height = GuiScreen.height - y;
|
height = GuiScreen.height - y;
|
||||||
x = sr.getScaledWidth() / 8 + xo;
|
x = sr.getScaledWidth() / 8 + xo;
|
||||||
y = sr.getScaledHeight() / (int) 1.1 - 10 + xy;
|
y = sr.getScaledHeight() - 10 + xy;
|
||||||
int off = 0;
|
int off = 0;
|
||||||
|
|
||||||
// background
|
// background
|
||||||
|
@ -164,7 +163,7 @@ public class ClickGUI extends GuiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
fr.drawStringWithShadow(m.name,
|
fr.drawStringWithShadow(m.name,
|
||||||
this.x + 15 + 7 + xo * (int) 1.5, height - fh * -(off) + 50 - offset, -1);
|
this.x + 15 + 7 + xo, height - fh * -(off) + 50 - offset, -1);
|
||||||
}
|
}
|
||||||
} else if (this.modWatching != null) {
|
} else if (this.modWatching != null) {
|
||||||
|
|
||||||
|
@ -175,7 +174,7 @@ public class ClickGUI extends GuiScreen {
|
||||||
height + 29 - fr.FONT_HEIGHT - 2, -1);
|
height + 29 - fr.FONT_HEIGHT - 2, -1);
|
||||||
|
|
||||||
for (int amogus = 0; amogus < this.modWatching.settings.size(); amogus++) {
|
for (int amogus = 0; amogus < this.modWatching.settings.size(); amogus++) {
|
||||||
BooleanSetting b = null;
|
BooleanSetting b;
|
||||||
ModeSetting mo = null;
|
ModeSetting mo = null;
|
||||||
Setting s = this.modWatching.settings.get(amogus);
|
Setting s = this.modWatching.settings.get(amogus);
|
||||||
if (s instanceof BooleanSetting) {
|
if (s instanceof BooleanSetting) {
|
||||||
|
@ -241,31 +240,27 @@ public class ClickGUI extends GuiScreen {
|
||||||
if (getListMaxScroll() + this.height >= this.height) {
|
if (getListMaxScroll() + this.height >= this.height) {
|
||||||
int wheel = Mouse.getEventDWheel();
|
int wheel = Mouse.getEventDWheel();
|
||||||
if (wheel < 0) {
|
if (wheel < 0) {
|
||||||
new Thread(){
|
new Thread(() -> {
|
||||||
public void run(){
|
for (int i = 0; i < 20; i++) {
|
||||||
for (int i = 0; i < 20; i++) {
|
offset = MathHelper.clamp_int(offset + 1, 0, getListMaxScroll());
|
||||||
offset = MathHelper.clamp_int(offset + 1, 0, getListMaxScroll());
|
try {
|
||||||
|
Thread.sleep(1);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
} else if (wheel > 0) {
|
||||||
|
new Thread(() -> {
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
offset = MathHelper.clamp_int(offset - 1, 0, getListMaxScroll());
|
||||||
try {
|
try {
|
||||||
sleep(1);
|
Thread.sleep(1);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}.start();
|
}).start();
|
||||||
} else if (wheel > 0) {
|
|
||||||
new Thread(){
|
|
||||||
public void run(){
|
|
||||||
for (int i = 0; i < 20; i++) {
|
|
||||||
offset = MathHelper.clamp_int(offset - 1, 0, getListMaxScroll());
|
|
||||||
try {
|
|
||||||
sleep(1);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
super.handleMouseInput();
|
super.handleMouseInput();
|
||||||
|
|
|
@ -11,7 +11,6 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import dev.resent.Resent;
|
import dev.resent.Resent;
|
||||||
import dev.resent.event.impl.ClientChatEvent;
|
|
||||||
import dev.resent.event.impl.EntityStatusEvent;
|
import dev.resent.event.impl.EntityStatusEvent;
|
||||||
import dev.resent.module.impl.misc.AutoGG;
|
import dev.resent.module.impl.misc.AutoGG;
|
||||||
import dev.resent.util.misc.W;
|
import dev.resent.util.misc.W;
|
||||||
|
@ -760,13 +759,10 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
|
||||||
if (packetIn.getType() == 2) {
|
if (packetIn.getType() == 2) {
|
||||||
this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false);
|
this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ClientChatEvent event = new ClientChatEvent(packetIn.getChatComponent().getUnformattedText());
|
|
||||||
Resent.INSTANCE.events().post(event);
|
|
||||||
|
|
||||||
if (event.message.toLowerCase().contains("you won the match") && AutoGG.onWin.getValue()
|
if (packetIn.getChatComponent().getUnformattedText().toLowerCase().contains("you won the match") && AutoGG.onWin.getValue()
|
||||||
|| event.message.toLowerCase().contains("was killed by")
|
|| packetIn.getChatComponent().getUnformattedText().toLowerCase().contains("was killed by")
|
||||||
&& event.message.contains(Minecraft.getMinecraft().thePlayer.getName()) || event.message.toLowerCase().contains("you lost the") && AutoGG.onLose.getValue()) {
|
&& packetIn.getChatComponent().getUnformattedText().contains(Minecraft.getMinecraft().thePlayer.getName()) || packetIn.getChatComponent().getUnformattedText().toLowerCase().contains("you lost the") && AutoGG.onLose.getValue()) {
|
||||||
if (W.autoGG().isEnabled()) {
|
if (W.autoGG().isEnabled()) {
|
||||||
switch (hasSaid) {
|
switch (hasSaid) {
|
||||||
case "hasSaid1":
|
case "hasSaid1":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user