MCPcopy Create free account
hub / github.com/ZetaMap/MoreCommands / Switcher

Method Switcher

src/main/java/data/Switcher.java:23–44  ·  view source on GitHub ↗
(String name, String ip, boolean admin)

Source from the content-addressed store, hash-verified

21 public boolean forAdmin = false;
22
23 private Switcher(String name, String ip, boolean admin) {
24 if (name.isBlank()) this.error = true;
25 else this.name = name;
26
27 String[] temp;
28
29 if (ip.contains(":")) {
30 temp = ip.split("\\:");
31
32 if (temp.length == 2 && !temp[0].isBlank() && !temp[1].isBlank() && Strings.canParseInt(temp[1])) {
33 int port = Strings.parseInt(temp[1]);
34
35 if (port > 0 && port < 65535) {
36 this.ip = temp[0];
37 this.port = port;
38
39 } else this.error = true;
40 } else this.error = true;
41 } else this.ip = ip;
42
43 this.forAdmin = admin;
44 }
45
46 public String address() {
47 return this.ip + ":" + this.port;

Callers

nothing calls this directly

Calls 1

containsMethod · 0.80

Tested by

no test coverage detected