/
SubServer.java
909 lines (824 loc) · 25.1 KB
/
SubServer.java
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
package net.ME1312.SubServers.Sync.Network.API;
import net.ME1312.Galaxi.Library.Callback.Callback;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubData.Client.SubDataClient;
import net.ME1312.SubServers.Sync.Network.Packet.PacketCommandServer;
import net.ME1312.SubServers.Sync.Network.Packet.PacketEditServer;
import net.ME1312.SubServers.Sync.Network.Packet.PacketStartServer;
import net.ME1312.SubServers.Sync.Network.Packet.PacketStopServer;
import net.ME1312.SubServers.Sync.SubAPI;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
public class SubServer extends Server {
private List<SubServer> incompatibilities = null;
private Host host = null;
/**
* SubServer Stop Action Class
*/
public enum StopAction {
NONE,
RESTART,
REMOVE_SERVER,
RECYCLE_SERVER,
DELETE_SERVER;
@Override
public String toString() {
return super.toString().substring(0, 1).toUpperCase()+super.toString().substring(1).toLowerCase().replace('_', ' ');
}
}
/**
* Create an API representation of a Server
*
* @param raw JSON representation of the Server
*/
public SubServer(ObjectMap<String> raw) {
super(raw);
}
/**
* Create an API representation of a Server
*
* @param host Host
* @param raw JSON representation of the Server
*/
SubServer(Host host, ObjectMap<String> raw) {
super(raw);
this.host = host;
}
@Override
public boolean equals(Object obj) {
return obj instanceof SubServer && super.equals(obj);
}
@Override
public void refresh() {
host = null;
incompatibilities = null;
super.refresh();
}
/**
* Starts the Server
*
* @param player Player who Started
* @param response Response Code
*/
public void start(UUID player, Callback<Integer> response) {
if (Util.isNull(response)) throw new NullPointerException();
StackTraceElement[] origin = new Exception().getStackTrace();
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStartServer(player, getName(), data -> {
try {
response.run(data.getInt(0x0001));
} catch (Throwable e) {
Throwable ew = new InvocationTargetException(e);
ew.setStackTrace(origin);
ew.printStackTrace();
}
}));
}
/**
* Starts the Server
*
* @param response Response Code
*/
public void start(Callback<Integer> response) {
start(null, response);
}
/**
* Starts the Server
*
* @param player Player who Started
*/
public void start(UUID player) {
start(player, i -> {});
}
/**
* Starts the Server
*/
public void start() {
start(i -> {});
}
/**
* Stops the Server
*
* @param player Player who Stopped
* @param response Response Code
*/
public void stop(UUID player, Callback<Integer> response) {
if (Util.isNull(response)) throw new NullPointerException();
StackTraceElement[] origin = new Exception().getStackTrace();
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStopServer(player, getName(), false, data -> {
try {
response.run(data.getInt(0x0001));
} catch (Throwable e) {
Throwable ew = new InvocationTargetException(e);
ew.setStackTrace(origin);
ew.printStackTrace();
}
}));
}
/**
* Stops the Server
*
* @param response Response Code
*/
public void stop(Callback<Integer> response) {
stop(null, response);
}
/**
* Stops the Server
*
* @param player Player who Stopped
*/
public void stop(UUID player) {
stop(player, i -> {});
}
/**
* Stops the Server
*/
public void stop() {
stop(i -> {});
}
/**
* Terminates the Server
*
* @param player Player who Terminated
* @param response Response Code
*/
public void terminate(UUID player, Callback<Integer> response) {
if (Util.isNull(response)) throw new NullPointerException();
StackTraceElement[] origin = new Exception().getStackTrace();
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketStopServer(player, getName(), true, data -> {
try {
response.run(data.getInt(0x0001));
} catch (Throwable e) {
Throwable ew = new InvocationTargetException(e);
ew.setStackTrace(origin);
ew.printStackTrace();
}
}));
}
/**
* Terminates the Server
*
* @param response Response Code
*/
public void terminate(Callback<Integer> response) {
terminate(null, response);
}
/**
* Terminates the Server
*
* @param player Player who Terminated
*/
public void terminate(UUID player) {
terminate(player, i -> {});
}
/**
* Terminates the Server
*/
public void terminate() {
terminate(i -> {});
}
/**
* Commands the Server
*
* @param player Player who Commanded
* @param command Commmand to Send
* @param response Response Code
*/
public void command(UUID player, String command, Callback<Integer> response) {
if (Util.isNull(command, response)) throw new NullPointerException();
StackTraceElement[] origin = new Exception().getStackTrace();
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketCommandServer(player, getName(), command, data -> {
try {
response.run(data.getInt(0x0001));
} catch (Throwable e) {
Throwable ew = new InvocationTargetException(e);
ew.setStackTrace(origin);
ew.printStackTrace();
}
}));
}
/**
* Commands the Server
*
* @param command Commmand to Send
* @param response Response Code
*/
public void command(String command, Callback<Integer> response) {
command(null, command, response);
}
/**
* Commands the Server
*
* @param player Player who Commanded
* @param command Command to Send
*/
public void command(UUID player, String command) {
command(player, command, i -> {});
}
/**
* Commands the Server
*
* @param command Command to Send
*/
public void command(String command) {
command(command, i -> {});
}
/**
* Edits the Server
*
* @param player Player Editing
* @param edit Edits
* @param response Negative Response Code -or- Positive Success Status
*/
public void edit(UUID player, ObjectMap<String> edit, Callback<Integer> response) {
edit(player, edit, false, response);
}
/**
* Edits the Server
*
* @param edit Edits
* @param response Negative Response Code -or- Positive Success Status
*/
public void edit(ObjectMap<String> edit, Callback<Integer> response) {
edit(null, edit, response);
}
/**
* Edits the Server
*
* @param player Player Editing
* @param edit Edits
*/
public void edit(UUID player, ObjectMap<String> edit) {
edit(player, edit, i -> {});
}
/**
* Edits the Server
*
* @param edit Edits
*/
public void edit(ObjectMap<String> edit) {
edit(null, edit);
}
/**
* Edits the Server (& Saves Changes)
*
* @param player Player Editing
* @param edit Edits
* @param response Negative Response Code -or- Positive Success Status
*/
public void permaEdit(UUID player, ObjectMap<String> edit, Callback<Integer> response) {
edit(player, edit, true, response);
}
/**
* Edits the Server (& Saves Changes)
*
* @param edit Edits
* @param response Negative Response Code -or- Positive Success Status
*/
public void permaEdit(ObjectMap<String> edit, Callback<Integer> response) {
permaEdit(null, edit, response);
}
/**
* Edits the Server (& Saves Changes)
*
* @param player Player Editing
* @param edit Edits
*/
public void permaEdit(UUID player, ObjectMap<String> edit) {
permaEdit(player, edit, i -> {});
}
/**
* Edits the Server (& Saves Changes)
*
* @param edit Edits
*/
public void permaEdit(ObjectMap<String> edit) {
permaEdit(null, edit);
}
private void edit(UUID player, ObjectMap<String> edit, boolean perma, Callback<Integer> response) {
if (Util.isNull(response)) throw new NullPointerException();
StackTraceElement[] origin = new Exception().getStackTrace();
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketEditServer(player, getName(), edit, perma, data -> {
try {
if (data.getInt(0x0001) != 0) {
response.run(data.getInt(0x0001) * -1);
} else {
response.run(data.getInt(0x0002));
}
} catch (Throwable e) {
Throwable ew = new InvocationTargetException(e);
ew.setStackTrace(origin);
ew.printStackTrace();
}
}));
}
/**
* If the Server is Running
*
* @return Running Status
*/
public boolean isRunning() {
return raw.getBoolean("running");
}
/**
* Grabs the Host of the Server
*
* @return The Host Name
*/
public String getHost() {
return raw.getRawString("host");
}
/**
* Grabs the Host of the Server
*
* @param callback The Host
*/
public void getHost(Callback<Host> callback) {
if (Util.isNull(callback)) throw new NullPointerException();
StackTraceElement[] origin = new Exception().getStackTrace();
Runnable run = () -> {
try {
callback.run(host);
} catch (Throwable e) {
Throwable ew = new InvocationTargetException(e);
ew.setStackTrace(origin);
ew.printStackTrace();
}
};
if (host == null || !host.getName().equalsIgnoreCase(raw.getRawString("host"))) {
SubAPI.getInstance().getHost(raw.getRawString("host"), host -> {
this.host = host;
run.run();
});
} else {
run.run();
}
}
/**
* Grabs the Template this Server was created from
*
* @return The Template
*/
public String getTemplate() {
return raw.getRawString("template");
}
/**
* Is this Server Available?
*
* @return Availability Status
*/
public boolean isAvailable() {
return raw.getBoolean("available");
}
/**
* If the Server is Enabled
*
* @return Enabled Status
*/
public boolean isEnabled() {
return raw.getBoolean("enabled");
}
/**
* Set if the Server is Enabled
*
* @param value Value
*/
public void setEnabled(boolean value) {
setEnabled(value, b -> {});
}
/**
* Set if the Server is Enabled
*
* @param value Value
* @param response Success Status
*/
public void setEnabled(boolean value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("enabled", value);
edit(edit, r -> {
if (r > 0) raw.set("enabled", value);
response.run(r > 0);
});
}
/**
* If the Server is accepting requests to edit()
*
* @return Edit Status
*/
public boolean isEditable() {
return raw.getBoolean("editable");
}
/**
* If the Server is Logging
*
* @return Logging Status
*/
public boolean isLogging() {
return raw.getBoolean("log");
}
/**
* Set if the Server is Logging
*
* @param value Value
*/
public void setLogging(boolean value) {
setLogging(value, b -> {});
}
/**
* Set if the Server is Logging
*
* @param value Value
* @param response Success Status
*/
public void setLogging(boolean value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("log", value);
edit(edit, r -> {
if (r > 0) raw.set("log", value);
response.run(r > 0);
});
}
/**
* Get the Server Directory Path
*
* @return Server Directory Path
*/
public String getPath() {
return raw.getRawString("dir");
}
/**
* Get the Server's Executable String
*
* @return Executable String
*/
public String getExecutable() {
return raw.getRawString("exec");
}
/**
* Grab the Command to Stop the Server
*
* @return Stop Command
*/
public String getStopCommand() {
return raw.getRawString("stop-cmd");
}
/**
* Set the Command that Stops the Server
*
* @param value Value
*/
public void setStopCommand(String value) {
setStopCommand(value, b -> {});
}
/**
* Set the Command that Stops the Server
*
* @param value Value
* @param response Success Status
*/
public void setStopCommand(String value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("stop-cmd", value);
edit(edit, r -> {
if (r > 0) raw.set("stop-cmd", value);
response.run(r > 0);
});
}
/**
* Get the action the Server will take when it stops
*
* @return Stop Action
*/
public StopAction getStopAction() {
return Util.getDespiteException(() -> StopAction.valueOf(raw.getRawString("stop-action").toUpperCase().replace('-', '_').replace(' ', '_')), null);
}
/**
* Set the action the Server will take when it stops
*
* @param action Stop Action
*/
public void setStopAction(StopAction action) {
setStopAction(action, b -> {});
}
/**
* Set the action the Server will take when it stops
*
* @param action Stop Action
* @param response Success Status
*/
public void setStopAction(StopAction action, Callback<Boolean> response) {
if (Util.isNull(action, response)) throw new NullPointerException();
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("stop-action", action.toString());
edit(edit, r -> {
if (r > 0) raw.set("stop-action", action.toString());
response.run(r > 0);
});
}
/**
* Toggles compatibility with other Servers
*
* @param server SubServer to toggle
*/
public void toggleCompatibility(String server) {
toggleCompatibility(server, b -> {});
}
/**
* Toggles compatibility with other Servers
*
* @param server SubServer to toggle
*/
public void toggleCompatibility(String server, Callback<Boolean> response) {
if (Util.isNull(server, response)) throw new NullPointerException();
ArrayList<String> value = new ArrayList<String>();
value.addAll(getIncompatibilities());
if (!value.contains(server)) value.add(server);
else value.remove(server);
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("incompatible", value);
edit(edit, r -> {
if (r > 0) raw.set("incompatible", value);
response.run(r > 0);
});
}
/**
* Checks if a Server is compatible
*
* @param server Server name to check
* @return Compatible Status
*/
public boolean isCompatible(String server) {
LinkedList<String> lowercaseIncompatibilities = new LinkedList<String>();
for (String key : getIncompatibilities()) {
lowercaseIncompatibilities.add(key.toLowerCase());
}
return lowercaseIncompatibilities.contains(server.toLowerCase());
}
/**
* Get all listed incompatibilities for this Server
*
* @return Incompatibility List
*/
public List<String> getIncompatibilities() {
return new LinkedList<String>(raw.getRawStringList("incompatible-list"));
}
/**
* Get all listed incompatibilities for this Server
*
* @param callback Incompatibility List
*/
public void getIncompatibilities(Callback<List<SubServer>> callback) {
if (Util.isNull(callback)) throw new NullPointerException();
StackTraceElement[] origin = new Exception().getStackTrace();
Runnable run = () -> {
try {
callback.run(incompatibilities);
} catch (Throwable e) {
Throwable ew = new InvocationTargetException(e);
ew.setStackTrace(origin);
ew.printStackTrace();
}
};
if (incompatibilities == null) {
LinkedList<String> incompatableNames = new LinkedList<String>();
for (String subserver : raw.getRawStringList("incompatible-list")) incompatableNames.add(subserver.toLowerCase());
SubAPI.getInstance().getSubServers(subservers -> {
LinkedList<SubServer> incompatibilities = new LinkedList<SubServer>();
for (SubServer subserver : subservers.values())
if (incompatableNames.contains(subserver.getName().toLowerCase()))
incompatibilities.add(subserver);
this.incompatibilities = incompatibilities;
run.run();
});
} else {
run.run();
}
}
/**
* Get incompatibility issues this server currently has
*
* @return Current Incompatibility List
*/
public List<String> getCurrentIncompatibilities() {
return new LinkedList<String>(raw.getRawStringList("incompatible"));
}
/**
* Get incompatibility issues this server currently has
*
* @param callback Current Incompatibility List
*/
public void getCurrentIncompatibilities(Callback<List<SubServer>> callback) {
getIncompatibilities(incompatibilities -> {
LinkedList<String> incompatableNames = new LinkedList<String>();
for (String subserver : raw.getRawStringList("incompatible")) incompatableNames.add(subserver.toLowerCase());
LinkedList<SubServer> current = new LinkedList<SubServer>();
for (SubServer subserver : incompatibilities)
if (incompatableNames.contains(subserver.getName().toLowerCase()))
current.add(subserver);
callback.run(current);
});
}
/**
* Sets the Display Name for this Server
*
* @param value Value (or null to reset)
*/
public void setDisplayName(String value) {
setMotd(value, b -> {});
}
/**
* Sets the Display Name for this Server
*
* @param value Value (or null to reset)
* @param response Success Status
*/
public void setDisplayName(String value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("display", (value == null)?"":value);
edit(edit, r -> {
if (r > 0) raw.set("display", (value == null)?getName():value);
response.run(r > 0);
});
}
/**
* Add this Server to a Group
*
* @param value Group name
*/
public void addGroup(String value) {
addGroup(value, b -> {});
}
/**
* Add this Server to a Group
*
* @param value Group name
* @param response Success Status
*/
public void addGroup(String value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ArrayList<String> v = new ArrayList<String>();
v.addAll(getGroups());
if (!v.contains(value)) v.add(value);
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("group", v);
edit(edit, r -> {
if (r > 0) raw.set("group", v);
response.run(r > 0);
});
}
/**
* Remove this Server from a Group
*
* @param value value Group name
*/
public void removeGroup(String value) {
removeGroup(value, b -> {});
}
/**
* Remove this Server from a Group
*
* @param value value Group name
* @param response Success Status
*/
public void removeGroup(String value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ArrayList<UUID> v = new ArrayList<UUID>();
v.addAll(getWhitelist());
v.remove(value);
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("group", v);
edit(edit, r -> {
if (r > 0) raw.set("group", v);
response.run(r > 0);
});
}
/**
* Set if the server is hidden from players
*
* @param value Value
*/
public void setHidden(boolean value) {
setHidden(value, b -> {});
}
/**
* Set if the server is hidden from players
*
* @param value Value
* @param response Success Status
*/
public void setHidden(boolean value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("restricted", value);
edit(edit, r -> {
if (r > 0) raw.set("restricted", value);
response.run(r > 0);
});
}
/**
* Sets the MOTD of the Server
*
* @param value Value
*/
public void setMotd(String value) {
setMotd(value, b -> {});
}
/**
* Sets the MOTD of the Server
*
* @param value Value
* @param response Success Status
*/
public void setMotd(String value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("motd", value);
edit(edit, r -> {
if (r > 0) raw.set("motd", value);
response.run(r > 0);
});
}
/**
* Sets if the Server is Restricted
*
* @param value Value
*/
public void setRestricted(boolean value) {
setRestricted(value, b -> {});
}
/**
* Sets if the Server is Restricted
*
* @param value Value
* @param response Success Status
*/
public void setRestricted(boolean value, Callback<Boolean> response) {
if (Util.isNull(value, response)) throw new NullPointerException();
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("restricted", value);
edit(edit, r -> {
if (r > 0) raw.set("restricted", value);
response.run(r > 0);
});
}
/**
* Add a player to the whitelist (for use with restricted servers)
*
* @param player Player to add
*/
public void whitelist(UUID player) {
whitelist(player, b -> {});
}
/**
* Add a player to the whitelist (for use with restricted servers)
*
* @param player Player to add
* @param response Success Status
*/
public void whitelist(UUID player, Callback<Boolean> response) {
if (Util.isNull(player, response)) throw new NullPointerException();
ArrayList<UUID> value = new ArrayList<UUID>();
value.addAll(getWhitelist());
if (!value.contains(player)) value.add(player);
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("whitelist", value);
edit(edit, r -> {
if (r > 0) raw.set("whitelist", value);
response.run(r > 0);
});
}
/**
* Remove a player to the whitelist
*
* @param player Player to remove
*/
public void unwhitelist(UUID player) {
unwhitelist(player, b -> {});
}
/**
* Remove a player to the whitelist
*
* @param player Player to remove
* @param response Success Status
*/
public void unwhitelist(UUID player, Callback<Boolean> response) {
if (Util.isNull(player, response)) throw new NullPointerException();
ArrayList<UUID> value = new ArrayList<UUID>();
value.addAll(getWhitelist());
value.remove(player);
ObjectMap<String> edit = new ObjectMap<String>();
edit.set("whitelist", value);
edit(edit, r -> {
if (r > 0) raw.set("whitelist", value);
response.run(r > 0);
});
}
}