use of dev.hypnotic.config.friends.Friend in project Hypnotic-Client by Hypnotic-Development.
the class SaveLoad method save.
public void save() {
ArrayList<String> toSave = new ArrayList<String>();
if (ModuleManager.INSTANCE == null || HudManager.INSTANCE == null)
return;
for (Mod mod : ModuleManager.INSTANCE.modules) {
toSave.add("MOD:" + mod.getName() + ":" + mod.isEnabled() + ":" + mod.getKey());
}
for (HudModule element : HudManager.INSTANCE.hudModules) {
toSave.add("HUD:" + element.getName() + ":" + element.getX() + ":" + element.getY());
}
for (Friend friend : FriendManager.INSTANCE.friends) {
toSave.add("FRIEND:" + friend.name);
}
for (Frame frame : ClickGUI.INSTANCE.frames) {
toSave.add("FRAME:" + frame.name + ":" + frame.getX() + ":" + frame.getY() + ":" + frame.isExtended());
}
toSave.add("FRAME:" + HudEditorScreen.INSTANCE.frame.name + ":" + HudEditorScreen.INSTANCE.frame.getX() + ":" + HudEditorScreen.INSTANCE.frame.getY() + ":" + HudEditorScreen.INSTANCE.frame.isExtended());
toSave.add("CLICKGUI:X:" + dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.x + ":Y:" + dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.y);
for (Waypoint waypoint : WaypointManager.INSTANCE.waypoints) {
toSave.add("WAYPOINT:NAME:" + waypoint.getName() + ":X:" + waypoint.getX() + ":Y:" + waypoint.getY() + ":Z:" + waypoint.getZ());
}
try {
PrintWriter pw = new PrintWriter(this.dataFile);
for (String str : toSave) {
pw.println(str);
}
pw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
use of dev.hypnotic.config.friends.Friend in project Hypnotic-Client by Hypnotic-Development.
the class FriendCmd method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("add").then(argument("friend", FriendArgumentType.friend()).executes(context -> {
Friend friend = FriendArgumentType.getFriend(context, "friend");
if (!FriendManager.INSTANCE.isFriend(friend.name)) {
FriendManager.INSTANCE.add(friend);
info("Added (highlight)" + friend.name + " (default)to your friends list.");
} else
info("That person is already your friend.");
SaveLoad.INSTANCE.save();
return SINGLE_SUCCESS;
})));
builder.then(literal("remove").then(argument("friend", FriendArgumentType.friend()).executes(context -> {
Friend friend = FriendManager.INSTANCE.getFriendByName(FriendArgumentType.getFriend(context, "friend").name);
if (friend != null && FriendManager.INSTANCE.isFriend(friend.name)) {
FriendManager.INSTANCE.friends.remove(friend);
info("Removed (highlight)" + friend.name + " (default)from your friends list.");
} else
info("That person is not your friend.");
return SINGLE_SUCCESS;
})));
builder.then(literal("list").executes(context -> {
info("--- Friends ((highlight)" + FriendManager.INSTANCE.friends.size() + "(default)) ---");
for (Friend friend : FriendManager.INSTANCE.friends) {
ChatUtils.info("(highlight)" + friend.name);
}
return SINGLE_SUCCESS;
}));
}
use of dev.hypnotic.config.friends.Friend in project Hypnotic-Client by Hypnotic-Development.
the class SaveLoad method load.
public void load() {
ArrayList<String> lines = new ArrayList<String>();
try {
BufferedReader reader = new BufferedReader(new FileReader(this.dataFile));
String line = reader.readLine();
while (line != null) {
lines.add(line);
line = reader.readLine();
}
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
for (String s : lines) {
String[] args = s.split(":");
if (s.toLowerCase().startsWith("mod:")) {
Mod m = ModuleManager.INSTANCE.getModuleByName(args[1]);
if (m != null) {
m.setKey(Integer.parseInt(args[3]));
}
} else if (s.toLowerCase().startsWith("friend:")) {
FriendManager.INSTANCE.add(new Friend(args[1]));
} else if (s.toLowerCase().startsWith("frame:")) {
for (Frame frame : ClickGUI.INSTANCE.frames) {
if (frame.name.equalsIgnoreCase(args[1])) {
frame.setX(Integer.parseInt(args[2]));
frame.setY(Integer.parseInt(args[3]));
frame.setExtended(Boolean.parseBoolean(args[4]));
}
}
HudEditorScreen.INSTANCE.frame.setX(Integer.parseInt(args[2]));
HudEditorScreen.INSTANCE.frame.setY(Integer.parseInt(args[3]));
HudEditorScreen.INSTANCE.frame.setExtended(Boolean.parseBoolean(args[4]));
} else if (s.toLowerCase().startsWith("waypoint:")) {
for (Waypoint waypoint : WaypointManager.INSTANCE.waypoints) {
if (waypoint.getName().equalsIgnoreCase(args[1])) {
int x = Integer.parseInt(args[2]);
int y = Integer.parseInt(args[3]);
int z = Integer.parseInt(args[4]);
waypoint.setX(x);
waypoint.setY(y);
waypoint.setZ(z);
waypoint.setPos(new BlockPos(x, y, z));
}
}
} else if (s.toLowerCase().startsWith("clickgui:")) {
dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.x = Integer.parseInt(args[2]);
dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.y = Integer.parseInt(args[4]);
} else if (s.toLowerCase().startsWith("settingpos:")) {
for (ModuleButton mb : dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.buttons) {
if (mb.mod.name.equalsIgnoreCase(args[1])) {
mb.settingsWindow.x = Integer.parseInt(args[3]);
mb.settingsWindow.y = Integer.parseInt(args[5]);
}
}
}
/*else if (s.toLowerCase().startsWith("message:")) {
ModuleManager.INSTANCE.chatSpammer.custom.add(args[1]);
}*/
}
}
use of dev.hypnotic.config.friends.Friend in project Hypnotic-Client by Hypnotic-Development.
the class MiddleClickFriend method mouseClicked.
@EventTarget
public void mouseClicked(EventMouseButton event) {
if (event.getButton() == GLFW.GLFW_MOUSE_BUTTON_MIDDLE && event.getClickType() == EventMouseButton.ClickType.IN_GAME) {
HitResult hitResult = mc.crosshairTarget;
if (hitResult != null && hitResult.getType() == HitResult.Type.ENTITY) {
PlayerEntity player = (PlayerEntity) ((EntityHitResult) hitResult).getEntity();
if (!FriendManager.INSTANCE.isFriend(player) && !mc.options.sneakKey.isPressed()) {
FriendManager.INSTANCE.add(new Friend(player.getName().asString()));
ChatUtils.tellPlayer("Added " + ColorUtils.green + player.getName().asString() + ColorUtils.white + " to your friends list");
}
if (mc.options.sneakKey.isPressed() && FriendManager.INSTANCE.isFriend(player)) {
for (Friend friend : FriendManager.INSTANCE.friends) {
if (friend.name == player.getName().asString()) {
FriendManager.INSTANCE.friends.remove(friend);
ChatUtils.tellPlayer("Removed " + ColorUtils.red + friend.name + ColorUtils.white + " from your friends list");
}
}
}
}
}
}
Aggregations