仓库地址就不放出来了,太耻辱了……
先来看看Main.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| package cn.yingyu5658.lbl;
public class Main { public static void main(String[] args) { LuBuLu cmd = new LuBuLu(); while(true) { cmd.command(); } } }
|
嗯还写了Author,生怕别人不知道这坨屎是谁拉的。
Main方法里面新建了一个LuBuLu对象,在主循环里调用了他的command()方法。
进入这个神秘的LuBuLu.java一探究竟。
1 2 3 4 5 6 7 8 9
| Scanner sc; String one; String two; public int times;
public LuBuLu() { this.sc = new Scanner(System.in); this.times = 0; }
|
在类的开头进行了一些初始化,有点不理解one和two是什么,为什么他们没有权限修饰符。。。
好的,接下来就到了主方法调用的command()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| public void command() { while (true) { if (this.times == 0) { System.out.println(" __ __ __ .______ __ __ __ __ __ \n| | | | | | | _ \\ | | | | | | | | | | \n| | | | | | | |_) | | | | | | | | | | | \n| | | | | | | _ < | | | | | | | | | | \n| `----.| `--' | | |_) | | `--' | | `----.| `--' | \n|_______| \\______/ |______/ \\______/ |_______| \\______/ \n \n.___ ___. ___ _______ _______ .______ ____ ____ ____ ____ __ .__ __. ___________ ____ __ __ _____ __ _____ ___ \n| \\/ | / \\ | \\ | ____| | _ \\ \\ \\ / / \\ \\ / / | | | \\ | | / _____\\ \\ / / | | | | | ____| / / | ____| / _ \\ \n| \\ / | / ^ \\ | .--. || |__ | |_) | \\ \\/ / \\ \\/ / | | | \\| | | | __ \\ \\/ / | | | | | |__ / /_ | |__ | (_) | \n| |\\/| | / /_\\ \\ | | | || __| | _ < \\_ _/ \\_ _/ | | | . ` | | | |_ | \\_ _/ | | | | |___ \\ | '_ \\ |___ \\ > _ < \n| | | | / _____ \\ | '--' || |____ | |_) | | | | | | | | |\\ | | |__| | | | | `--' | ___) | | (_) | ___) | | (_) | \n|__| |__| /__/ \\__\\ |_______/ |_______| |______/ |__| |__| |__| |__| \\__| \\______| |__| \\______/ |____/ \\___/ |____/ \\___/ \n "); }
System.out.println("卢布卢 v1.4"); LocalDate date = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); PrintStream var10000 = System.out; String var10001 = date.format(formatter); var10000.println("你在" + var10001 + "奇了星雨并打开本软件,来看看老天让不让你卢吧!"); System.out.println("========================================"); System.out.println("输入'/help'获取帮助"); switch (this.sc.nextLine()) { case "/help": this.help(); break; case "/lbl": this.luMa(); break; case "/exit": System.exit(0); break; case "/coott": if ("/coott".equals(sc.nextLine())) { Scanner sc1 = new Scanner(System.in); System.out.println("请输入您的第一个选项。"); String one = sc1.nextLine(); System.out.println("请输入您的第二个选项。"); String two = sc1.nextLine(); this.chooseOneOfTheTwo(one, two); } break; case "/cofm": chooseOneFromMany(); break; default: this.clear(); System.out.println("不存在该指令!将在1000ms后回到主页面。"); this.sleep(); return; } ++times; System.out.println("*调试信息* 运行轮数: " + this.times); } }
|
可以看到、个方法内部代码都是在无限循环内执行的,那么为什么要在main方法里又套一层循环呢???
这里的代码是反编译出来的,当时我还不会用git,idea也用不明白,误删了代码。找到以前的版本反编译再重新写。
命令解析部分则是用了switch,这种方法在命令不多的情况下还可以。但是要输入斜杠是什么鬼啊,玩mc呢?
那么再来看看伟大的case: "/coott"
,前面还在调用函数,这里直接实现???这是人能写出来的代码??
函数尾部的++times也没看懂,我甚至现在都不理解这个运行轮数存在的意义是什么。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
public void sleep() { long start = System.currentTimeMillis();
try { Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); }
long end = System.currentTimeMillis(); }
|
这个功能更令人费解,为什么敲错命令不直接return,还要sleep一下。。。
OK,下面就是人类有史以来最伟大的发明。
打印大量空字符串清屏。
1 2 3 4 5 6 7 8
|
public void clear() { for (int i = 0; i < 500; ++i) { System.out.println(""); } }
|
我真的好奇我到底是不是人类了,这么蠢的方法还好意思写在注释里,这么大的IO性能损失还好意思直接写在注释里。
多选一这个功能更是逆天了,选项和随机数范围严重错位。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| public void chooseOneFromMany() { ArrayList choicesList = new ArrayList(); Random r = new Random(); clear(); System.out.println("===多选一界面==="); System.out.println("请输入选项总数"); int choicesCount = sc.nextInt(); sc.nextLine(); for (int i = 1; i < choicesCount; ++i) { System.out.println("请输入您的第" + i + "个选项"); String chices = sc.nextLine(); choicesList.add(chices); } int randomIndex = r.nextInt((choicesCount)); System.out.println("老天帮你选了第" + (randomIndex + 1) + "个:" + choicesList.get(randomIndex)); }
|
逆天,,,,除了代码不规范以外,逻辑硬伤更是多的离谱。
总结,像一头蠢猪用带着粪的猪蹄乱敲键盘敲出来的代码。