forked from RepoMirrors/kami-blue
Refactor redundant method
This commit is contained in:
parent
5880a9f326
commit
ce6748454d
|
@ -24,6 +24,7 @@ public abstract class Command {
|
|||
protected SyntaxChunk[] syntaxChunks;
|
||||
|
||||
public static Setting<String> commandPrefix = Settings.s("commandPrefix", ".");
|
||||
public static final char SECTION_SIGN = '\u00A7';
|
||||
|
||||
public Command(String label, SyntaxChunk[] syntaxChunks) {
|
||||
this.label = label;
|
||||
|
@ -124,8 +125,4 @@ public abstract class Command {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static char SECTIONSIGN() {
|
||||
return '\u00A7';
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -224,33 +224,33 @@ public class KamiGUI extends GUI {
|
|||
information.setText("");
|
||||
information.addLine("\u00A7b" + KamiMod.KAMI_KANJI + "\u00A73 " + KamiMod.MODVER);
|
||||
if (privateInfoNam) {
|
||||
information.addLine("\u00A7bWelcome" + Command.SECTIONSIGN() + "3 " + privateDisplayN + "!");
|
||||
information.addLine("\u00A7bWelcome" + Command.SECTION_SIGN + "3 " + privateDisplayN + "!");
|
||||
}
|
||||
if (privateInfoTps) {
|
||||
information.addLine("\u00A7b" + Math.round(LagCompensator.INSTANCE.getTickRate()) + Command.SECTIONSIGN() + "3 tps");
|
||||
information.addLine("\u00A7b" + Math.round(LagCompensator.INSTANCE.getTickRate()) + Command.SECTION_SIGN + "3 tps");
|
||||
}
|
||||
if (privateInfoFps) {
|
||||
information.addLine("\u00A7b" + Minecraft.debugFPS + Command.SECTIONSIGN() + "3 fps");
|
||||
information.addLine("\u00A7b" + Minecraft.debugFPS + Command.SECTION_SIGN + "3 fps");
|
||||
}
|
||||
if (privateInfoPin) {
|
||||
information.addLine("\u00A7b" + privatePingValue + Command.SECTIONSIGN() + "3 ms");
|
||||
information.addLine("\u00A7b" + privatePingValue + Command.SECTION_SIGN + "3 ms");
|
||||
}
|
||||
if (privateInfoMem) {
|
||||
information.addLine("\u00A7b" + (Runtime.getRuntime().freeMemory() / 1000000) + Command.SECTIONSIGN() + "3mB free");
|
||||
information.addLine("\u00A7b" + (Runtime.getRuntime().freeMemory() / 1000000) + Command.SECTION_SIGN + "3mB free");
|
||||
}
|
||||
} else {
|
||||
information.setText("");
|
||||
information.addLine("\u00A7b" + KamiMod.KAMI_KANJI + "\u00A73 " + KamiMod.MODVER);
|
||||
information.addLine(Command.SECTIONSIGN() + "EEnable InfoOverlay!");
|
||||
information.addLine(Command.SECTION_SIGN + "EEnable InfoOverlay!");
|
||||
}
|
||||
|
||||
|
||||
//information.addLine("\u00A7b" + Runtime.getRuntime().availableProcessors() + Command.SECTIONSIGN() + "3 cores");
|
||||
//information.addLine("\u00A7b" + Wrapper.getPlayer().getDistance() + Command.SECTIONSIGN() + "3 fps");
|
||||
//information.addLine("\u00A7b" + Runtime.getRuntime().availableProcessors() + Command.SECTION_SIGN + "3 cores");
|
||||
//information.addLine("\u00A7b" + Wrapper.getPlayer().getDistance() + Command.SECTION_SIGN + "3 fps");
|
||||
|
||||
//OperatingSystemMXBean.getSystemLoadAverage() / OperatingSystemMXBean.getAvailableProcessors()
|
||||
// information.addLine("\u00A7b" + (Wrapper.getMinecraft().getVersion()) + Command.SECTIONSIGN() + "3% used");
|
||||
// information.addLine("\u00A7b" + (Runtime.getRuntime().totalMemory() / 1000000) + Command.SECTIONSIGN() + "3MB used");
|
||||
// information.addLine("\u00A7b" + (Wrapper.getMinecraft().getVersion()) + Command.SECTION_SIGN + "3% used");
|
||||
// information.addLine("\u00A7b" + (Runtime.getRuntime().totalMemory() / 1000000) + Command.SECTION_SIGN + "3MB used");
|
||||
|
||||
// information.addLine("[&3" + Sprint.getSpeed() + "km/h&r]");
|
||||
|
||||
|
@ -279,7 +279,7 @@ public class KamiGUI extends GUI {
|
|||
String posString = (e.posY > mc.player.posY ? ChatFormatting.DARK_GREEN + "+" : (e.posY == mc.player.posY ? " " : ChatFormatting.DARK_RED + "-"));
|
||||
float hpRaw = ((EntityLivingBase) e).getHealth() + ((EntityLivingBase) e).getAbsorptionAmount();
|
||||
String hp = dfHealth.format(hpRaw);
|
||||
healthSB.append(Command.SECTIONSIGN());
|
||||
healthSB.append(Command.SECTION_SIGN);
|
||||
if (hpRaw >= 20) {
|
||||
healthSB.append("a");
|
||||
} else if (hpRaw >= 10) {
|
||||
|
@ -302,7 +302,7 @@ public class KamiGUI extends GUI {
|
|||
players = sortByValue(players);
|
||||
|
||||
for (Map.Entry<String, Integer> player : players.entrySet()) {
|
||||
list.addLine(Command.SECTIONSIGN() + "7" + player.getKey() + " " + Command.SECTIONSIGN() + "8" + player.getValue());
|
||||
list.addLine(Command.SECTION_SIGN + "7" + player.getKey() + " " + Command.SECTION_SIGN + "8" + player.getValue());
|
||||
}
|
||||
});
|
||||
frame.setCloseable(false);
|
||||
|
@ -374,24 +374,24 @@ public class KamiGUI extends GUI {
|
|||
int hposZ = (int) (mc.player.posZ * f);
|
||||
|
||||
coordsLabel.setText(String.format(" %sf%,d%s7, %sf%,d%s7, %sf%,d %s7(%sf%,d%s7, %sf%,d%s7, %sf%,d%s7)",
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTION_SIGN,
|
||||
posX,
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTION_SIGN,
|
||||
Command.SECTION_SIGN,
|
||||
posY,
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTION_SIGN,
|
||||
Command.SECTION_SIGN,
|
||||
posZ,
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTION_SIGN,
|
||||
Command.SECTION_SIGN,
|
||||
hposX,
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTION_SIGN,
|
||||
Command.SECTION_SIGN,
|
||||
posY,
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTIONSIGN(),
|
||||
Command.SECTION_SIGN,
|
||||
Command.SECTION_SIGN,
|
||||
hposZ,
|
||||
Command.SECTIONSIGN()
|
||||
Command.SECTION_SIGN
|
||||
));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -62,7 +62,7 @@ public class KamiActiveModulesUI extends AbstractComponentUI<ActiveModules> {
|
|||
if (module.getShowOnArray().equals(Module.ShowOnArray.ON)) {
|
||||
int rgb = Color.HSBtoRGB(hue[0], 1, 1);
|
||||
String s = module.getHudInfo();
|
||||
String text = module.getName() + (s == null ? "" : " " + Command.SECTIONSIGN() + "7" + s);
|
||||
String text = module.getName() + (s == null ? "" : " " + Command.SECTION_SIGN + "7" + s);
|
||||
int textwidth = renderer.getStringWidth(text);
|
||||
int textheight = renderer.getFontHeight() + 1;
|
||||
int red = (rgb >> 16) & 0xFF;
|
||||
|
|
|
@ -88,7 +88,7 @@ public class ChatEncryption extends Module {
|
|||
break;
|
||||
}
|
||||
|
||||
((SPacketChat) event.getPacket()).chatComponent = new TextComponentString(Command.SECTIONSIGN() + "b" + username + Command.SECTIONSIGN() + "r: " + builder.toString());
|
||||
((SPacketChat) event.getPacket()).chatComponent = new TextComponentString(Command.SECTION_SIGN + "b" + username + Command.SECTION_SIGN + "r: " + builder.toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ColourSign extends Module {
|
|||
// if (event.getPacket() instanceof CPacketUpdateSign) {
|
||||
// String[] lines = ((CPacketUpdateSign) event.getPacket()).lines;
|
||||
// for (int i = 0; i < 4; i++) {
|
||||
// lines[i] = lines[i].replace(Command.SECTIONSIGN() + "", Command.SECTIONSIGN() + Command.SECTIONSIGN() + "rr");
|
||||
// lines[i] = lines[i].replace(Command.SECTION_SIGN + "", Command.SECTION_SIGN + Command.SECTION_SIGN + "rr");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
@ -50,7 +50,7 @@ public class ColourSign extends Module {
|
|||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
if (button.id == 0) {
|
||||
this.tileSign.signText[this.editLine] = new TextComponentString(tileSign.signText[this.editLine].getFormattedText().replaceAll("(" + Command.SECTIONSIGN() + ")(.)", "$1$1$2$2"));
|
||||
this.tileSign.signText[this.editLine] = new TextComponentString(tileSign.signText[this.editLine].getFormattedText().replaceAll("(" + Command.SECTION_SIGN + ")(.)", "$1$1$2$2"));
|
||||
}
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class ColourSign extends Module {
|
|||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
String s = ((TextComponentString) tileSign.signText[this.editLine]).getText();
|
||||
s = s.replace("&", Command.SECTIONSIGN() + "");
|
||||
s = s.replace("&", Command.SECTION_SIGN + "");
|
||||
tileSign.signText[this.editLine] = new TextComponentString(s);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ExtraTab extends Module {
|
|||
|
||||
public static String getPlayerName(NetworkPlayerInfo networkPlayerInfoIn) {
|
||||
String dname = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName());
|
||||
if (Friends.isFriend(dname)) return String.format("%sa%s", Command.SECTIONSIGN(), dname);
|
||||
if (Friends.isFriend(dname)) return String.format("%sa%s", Command.SECTION_SIGN, dname);
|
||||
return dname;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class Nametags extends Module {
|
|||
FontRenderer fontRendererIn = mc.fontRenderer;
|
||||
GlStateManager.scale(-0.025F, -0.025F, 0.025F);
|
||||
|
||||
String str = entityIn.getName() + (health.getValue() ? " " + Command.SECTIONSIGN() + "a" + Math.round(((EntityLivingBase) entityIn).getHealth() + (entityIn instanceof EntityPlayer ? ((EntityPlayer) entityIn).getAbsorptionAmount() : 0)) : "");
|
||||
String str = entityIn.getName() + (health.getValue() ? " " + Command.SECTION_SIGN + "a" + Math.round(((EntityLivingBase) entityIn).getHealth() + (entityIn instanceof EntityPlayer ? ((EntityPlayer) entityIn).getAbsorptionAmount() : 0)) : "");
|
||||
int i = fontRendererIn.getStringWidth(str) / 2;
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
|
|
Loading…
Reference in New Issue