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

Method put

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

Source from the content-addressed store, hash-verified

82 }
83
84 public static Switcher put(String name, String ip, boolean admin) {
85 name = name.replace('_', ' ').strip();
86 String stripedName = Strings.stripGlyphs(Strings.stripColors(name)).strip().toLowerCase();
87 Switcher new_ = new Switcher(name, ip, admin);
88
89 if (new_.error) return null;
90
91 else if (stripedName.equals("lobby")) {
92 if (lobby != null) new_.changed = true;
93 lobby = new_;
94 lobby.name = stripedName;
95
96 } else {
97 new_.changed = list.put(stripedName, new_) != null;
98 if (new_.changed) ordonedList.remove(s -> s.name.equals(new_.name));
99 ordonedList.add(new_);
100 }
101
102 return new_;
103 }
104
105 public static Switcher remove(String name) {
106 name = Strings.stripGlyphs(Strings.stripColors(name.replace('_', ' '))).strip().toLowerCase();

Callers 2

loadMethod · 0.95

Calls 3

stripGlyphsMethod · 0.95
removeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected