This repository has been archived by the owner on Jul 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTMEssential.js
5629 lines (5517 loc) · 234 KB
/
TMEssential.js
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
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*--------------------------------
_______ __ __ ______ _ _ _
|__ __| \/ | ____| | | (_) | |
| | | \ / | |__ ___ ___ ___ _ __ | |_ _ __ _| |
| | | |\/| | __| / __/ __|/ _ \ '_ \| __| |/ _` | |
| | | | | | |____\__ \__ \ __/ | | | |_| | (_| | |
|_| |_| |_|______|___/___/\___|_| |_|\__|_|\__,_|_|
Produced by Timiya
TMEssential is distributed under the GPLv3 License
该插件由提米吖创作
未经允许禁止擅自修改或者发售
该插件仅在[github,MineBBS,MCWeBBS]仓库发布
禁止二次发布!
----------------------------------*/
//LiteLoaderScript Dev Helper
//TMETHelper
/// <reference path="TMETHelper.js" />
let version = 2.850,
OnlinePlayer = {},//已在线玩家
fs = {},//文件
tmp = {},//临时数据
oldscore = "",//防抖
configExample = {//预释放配置文件(勿改)
"Enable": true,
"AutoUpdate": true,
"SelectForm": {
"Subsection": 40
},
"LANGUAGE": {
"Default": "zh_CN",
"Cmd": "language"
},
"TPA": {
"Enable": true,
"ExpirationTime": 40,
"ConsumeMoney": 0
},
"WARP": {
"Enable": true,
"ConsumeMoney": 0
},
"BACK": {
"Enable": true,
"MaxSave": 5,
"SaveToFile": true,
"InvincibleTime": 5,
"ConsumeMoney": 0
},
"HOME": {
"Enable": true,
"MaxHome": 3,
"SaveRequiredMoney": 0,
"GoHomeRequiredMoney": 0,
"DelHomeBackOffMoney": 0
},
"Money": {
"Enable": true,
"MoneyType": "score",
"MoneyName": "money",
"PayTaxRate": 0.0,
"MoneyChangeMsg": true,
"PlayerInitialMoney": 0
},
"NOTICE": {
"Enable": true,
"JoinOpenNotice": true,
"NoticeTitle": "hello",
"NoticeText": "test"
},
"SHOP": {
"Enable": true
},
"DYNAMICMOTD": {
"Enable": true,
"Time": 5,
"Motds": [
"test",
"test2"
]
},
"TPR": {
"Enable": true,
"MaxXZCoordinate": 10000,
"MinXZCoordinate": -10000,
"ConsumeMoney": 0
},
"ReloadChuck": {
"Enable": true,
"ConsumeMoney": 0
},
"FarmLandProtect": {
"Enable": true,
"Type": 0
},
"UseLog": {
"Enable": true,
"Conf": {
"API": false,
"LANGUAGE": true,
"TPA": true,
"WARP": true,
"BACK": true,
"HOME": true,
"Money": true,
"NOTICE": true,
"SHOP": true,
"DYNAMICMOTD": false,
"TPR": true,
"ReloadChuck": true,
"FarmLandProtect": false
}
}
},
defaultLangPack = {//预释放语言文件(勿改)
"ErrorMsg": [
"捕获到异常:",
"文件:\" %s \" 无法从字符串正常转换为JSON格式",
"请检查格式是否正确或编码是否为UTF8",
"错误堆栈信息已输出至\" %s \",请将此文件发送至此插件开发者"
],
"sendSelectForm": [
"§l§a请输入关键词进行搜索",
"§l§b我选好了(开启之后提交可选择完成)",
"§l§e请选择页码",
"§l§b已选择: %s"
],
"Moneyload": [
"经济系统",
"经济GUI",
"/money pay <input:playername> <input:Num> 向某人转账(从总金额扣除%s/100税率)",
"/money add <input:playername> <input:Num> 给某人添加经济",
"/money set <input:playername> <input:Num> 设置某人的经济",
"/money reduce <input:playername> <input:Num> 扣除某人的经济",
"/money query [input:playername] 查询自己的经济或者别人的经济",
"检测到记分板不存在,已自动创建",
"未知经济类型!"
],
"moneygui": [
"§c命令异常,请检测后重试",
"[\"§l§a转账\", \"§l§e查看排行榜\", \"§l§dOP快捷管理\"]",
"[\"§l§a转账\", \"§l§e查看排行榜\"]",
"§l§b请选择...",
"§b表单已放弃",
"§l§b请选择转账类型",
"§l§a请划动",
"[\"§l§a在线转账\", \"§l§b离线转账\"]",
"§b表单已放弃",
"§l§b请选择一位玩家进行转账",
"§b表单已放弃",
"§c只能选择一个玩家进行转账!",
"§c无法正确操作数据缺失玩家的经济",
"§l§b被转账人:%s,\n§aTA的余额:%s\n§a你的余额:%s,\n§b货币名称:%s,\n§e转账税率:%s",
"§l§a请输入正整数(不含零)",
"§b表单已放弃",
"§c请输入正整数",
"§c你的余额不足!",
"§b转账完成,剩余余额:%s",
"§c转账失败,原因未知",
"§l§b请选择从哪里获取玩家对象",
"§l§a请划动",
"[\"§l§a在线玩家\", \"§l§b离线玩家\"]",
"§b表单已放弃",
"§l§b请选择一个玩家进行管理",
"§b表单已放弃",
"§c只能选择一个玩家进行操作!",
"§c无法正确操作数据缺失玩家的经济",
"§l§b当前选择玩家:§e %s,\n§bTA的§f %s为: §e %s",
"§l§a开启为添加(减少)模式,关闭为设置模式",
"§l§b请务必输入数字",
"§b表单已放弃",
"§c请输入数字哦亲",
"§a操作成功",
"§c操作失败,原因未知",
"§c请输入数字哦亲",
"§a操作成功",
"§c操作失败,原因未知"
],
"setmoney": [
"§b经济变动:您现在拥有: §e%s §f%s,§b变动值: %s",
"§b初始经济: %s 已发放",
"§b经济变动:您现在拥有: §e%s §f%s,§b变动值: %s",
"§b初始经济: %s 已发放",
"§b经济变动:您现在拥有: §e%s §f%s,§b变动值: %s"
],
"tranmoney": [
"§b经济变动:您现在拥有: §e%s §f%s,§b变动值: %s",
"§b经济变动:您现在拥有: §e%s §f%s,§b变动值: %s"
],
"moneyset": [
"§a操作成功!TA现在拥有 §f%s §b为 §e%s",
"§c操作失败!原因未知!",
"§c操作失败,原因:玩家对象不存在或者设置的参数为负数",
"§c命令输入错误,请检查后重试"
],
"moneyquery": [
"§b你还剩余: §e%s §f%s",
"§a玩家: §e%s §b还剩余: §e%s §f%s",
"§c该玩家对象不存在"
],
"moneypay": [
"§c请输入正整数!",
"§b转账成功!剩余余额: §e%s §f%s",
"§c余额不足!剩余: §e%s §f%s",
"§c对方的数据不存在!",
"§c命令输入错误,请检查后重试"
],
"moneyadd": [
"§a操作成功!TA现在拥有 §f%s §b为 §e%s",
"§c操作失败!原因未知!",
"§c操作失败,原因:玩家对象不存在或者得出货币为负数",
"§c命令异常,请检查后重试"
],
"moneyreduce": [
"§c命令异常,请检查后重试"
],
"TPAload": [
"/tpa <input:playername> 向某人发起tpa请求(消耗%s经济)",
"打开TPA总GUI",
"/tpahere <input:playername> 向某人发起TPAHERE请求(消耗%s经济)",
"同意某玩家的TPA(HERE)请求(消耗对方%s经济)",
"拒绝某玩家的TPA(HERE)请求/取消自己的TPA(HERE)请求",
"开启或者关闭别人向你发tpa(here)所弹出的ui"
],
"DELTPA": [
"§c你发给玩家 §e%s §c的TPA请求已过期",
"§c玩家 §e%s §c发给你的TPA请求已过期",
"§c你发给玩家 §e%s §c的TPAHERE请求已过期",
"§c玩家 §e%s §c发给你的TPAHERE请求已过期"
],
"tpaui": [
"§b请求UI已关闭",
"§b请求UI已开启"
],
"tpagui": [
"§l§b请选择一个玩家",
"§l§a请选择TPA类型",
"[\"我传送过去\", \"TA传送过来\"]",
"§l§b成功后消耗%s经济",
"§l§c表单已放弃",
"§c您输入的命令异常,请检查后再重试!"
],
"tpa": [
"§c没有找到玩家对象",
"§b玩家 §e%s §b向你发送了一个TPA请求,/tpaaccept同意请求,/tpadeny拒绝请求",
"§b你成功的向玩家 §e%s §b发起了TPA请求,/tpadeny取消请求",
"§l§b玩家 §e%s §b向你发送了一个TPA请求\n(消耗对方%s经济)\n请选择:",
"§l§dTPA请求",
"同意请求",
"拒绝请求",
"§l§d请求未处理",
"§l§b你已经发起了一个TPA(HERE)请求,但是对方没有回应,请选择:",
"放弃上一次请求并发起这一次请求",
"继续等待并放弃这次请求",
"§b正在等待...",
"§b已放弃表单",
"§c对方有一个未处理的TPA(HERE)请求,无法发起请求",
"§c您输入的命令异常,请检查后重试"
],
"tpahere": [
"§c没有找到玩家对象",
"§b玩家 §e%s §b向你发送了一个TPAHERE请求,/tpaaccept同意请求,/tpadeny拒绝请求",
"§b你成功的向玩家 §e%s §b发起了TPAHERE请求,/tpadeny取消请求",
"§l§b玩家 §e%s §b向你发送了一个TPAHERE请求\n(消耗对方%s经济)\n请选择:",
"§l§dTPAHERE请求",
"同意请求",
"拒绝请求",
"§l§d请求未处理",
"§l§b你已经发起了一个TPA(HERE)请求,但是对方没有回应,请选择:",
"放弃上一次请求并发起这一次请求",
"继续等待并放弃这次请求",
"§b正在等待...",
"§b已放弃表单",
"§c对方有一个未处理的TPA(HERE)请求,无法发起请求",
"§c您输入的命令异常,请检查后重试"
],
"tpac": [
"§b玩家 §e%s §b接受了你的TPA请求",
"§b你接受了玩家 §e%s §b的TPA请求",
"§cTPA失败,原因:对方经济不足",
"§cTPA失败,请检查经济",
"§c玩家对象丢失",
"§b玩家 §e%s §b接受了你的TPAHERE请求",
"§b你接受了玩家 §e%s §b的TPAHERE请求",
"§cTPAHERE失败,原因:对方经济不足",
"§cTPAHERE失败,请检查经济",
"§c玩家对象丢失",
"§c您还没有待处理的TPA(HERE)请求",
"§c您输入的命令异常,请检查后重试"
],
"tpad": [
"§c玩家 §e%s §c拒绝了你的TPA请求",
"§c你拒绝了玩家 §e%s §c的TPA请求",
"§c玩家 §e%s §c拒绝了你的TPAHERE请求",
"§c你拒绝了玩家 §e%s §c的TPAHERE请求",
"§b对方取消了发给你的TPA(HERE)请求",
"§b你已取消你发起的TPA(HERE)请求",
"§c你没有待处理的TPA(HERE)请求",
"§c您输入的命令异常,请检查后重试"
],
"tpaleft": [
"§b你发给玩家 §e%s §b的TPA(HERE)请求因为对方退出游戏而被强制取消",
"§b你发给玩家 §e%s §b的TPA(HERE)请求因为对方退出游戏而被强制取消",
"§b玩家 §e%s §b发给你的TPA(HERE)请求因为TA退出游戏而被强制取消"
],
"HOMEload": [
"HOME命令",
"打开HOME总GUI",
"/home go <input:homename> 前往某个家(需要%s经济)",
"/home del <input:homename> 删除某个家(回退%s经济)",
"/home add <input:homename> 添加一个家(需要%s经济)",
"列出自己的所有家",
"/homeas <input:playername> <add:del:go:ls> <homename:homename:homename:> 管理某个人的家",
"打开HOMEAS总GUI"
],
"HOMEtp": [
"§b传送到家(\"%s\")成功"
],
"homegui": [
"§l§b表单选项如下,请选择一个",
"[\"§l§b添加家\", \"§l§a前往家\", \"§l§c删除家\"]",
"§l§b输入你要创建家的名字\n§a此过程需要消耗 §e%s §f%s §a您还剩余: §e%s §f%s",
"§b表单已放弃",
"§c您当前没有添加任何家",
"§l§b表单选项如下,请选择一个\n§a此过程需要消耗 §e%s §f%s §a您还剩余 §e%s §f%s",
"§b表单已放弃",
"§l§c选择一个家进行删除\n§a此过程可以回退 §e%s §f%s §a您还剩余: §e%s §f%s",
"§b表单已放弃",
"§b您还没有添加任何家",
"§b表单已放弃"
],
"homego": [
"§b请输入至少一个字符",
"§b你目前还没有这个名字的家",
"§c传送失败,请检查经济",
"§c命令输入有误,请检查后重试"
],
"homeadd": [
"§b请输入至少一个字符",
"§c你已经有这个家了,不能重复添加相同名字的家",
"§b添加家(\"%s\")成功",
"§c添加失败,请检查经济",
"§c添加失败,您的家数量满 %s 个了!",
"§c命令输入有误,请检查后重试"
],
"homedel": [
"§b请输入至少一个字符",
"§b已成功删除家(\"%s\")",
"§c删除家失败,原因未知",
"§c家(\"%s\")不存在",
"§c命令输入有误,请检查后重试"
],
"homels": [
"§c您还没有添加任何家",
"§a你现在拥有家: %s",
"§c您输入的命令有误,请检查后重新输入"
],
"homeasgui": [
"§l§c选择一个玩家进行管理",
"§c只能选择一个玩家进行管理",
"§l§b表单选项如下,请选择一个",
"[\"§l§b添加TA的家\", \"§l§a前往TA的家\", \"§l§c删除TA的家\"]",
"§l§b输入你要创建的家名字:",
"§b表单已放弃",
"§cTA当前没有添加任何家",
"§l§b表单选项如下,请选择一个",
"§b表单已放弃",
"§l§c选择一个TA的家进行删除",
"§b表单已放弃",
"§bTA还没有添加任何家",
"§b表单已放弃",
"§b表单已放弃",
"§c命令错误,请检查后重试"
],
"homeas": [
"§cTA的家数量已经满 %s 个了,请删除一些后再试",
"§a修改成功",
"§cTA已经有这个家了,不能重复添加,请尝试换一个名字",
"§cTA的这个家不存在",
"§b删除TA家(\"%s\")成功",
"§cTA的这个家不存在",
"§cTA还没添加任何家",
"§aTA现在拥有家: %s",
"§c您输入的命令有误,请检查后再重试",
"§c您输入的命令有误,请检查后再重试"
],
"WARPload": [
"WARP命令",
"打开WARP总表单",
"/warp go <input:warpname>前往某传送点(需要%s经济)",
"/warp add <input:warpname>增加某传送点",
"/warp del <input:warpname>删除某传送点",
"列出所有传送点"
],
"WARPtp": [
"§b传送到传送点(\"%s\")成功"
],
"warpgui": [
"§l§b表单选项如下,请选择一个\n§a此过程需要消耗 §e%s §f%s §a您还剩余 §e%s §f%s",
"§b表单已放弃",
"§b传送点列表为空",
"§l§b表单选项如下,请选择一个:",
"[\"§l§b添加传送点\", \"§l§a前往传送点\", \"§l§c删除传送点\"]",
"§l§a输入你想创建的WARP名字",
"§b表单已放弃",
"§l§b表单选项如下,请选择一个\n§a此过程需要消耗 §e%s §f%s §a您还剩余 §e%s §f%s",
"§b表单已放弃",
"§b传送点列表为空",
"§l§c选择一个WARP名字进行删除",
"§b表单已放弃",
"§b传送点列表为空",
"§b表单已放弃"
],
"warpgo": [
"§b请输入至少一个字符",
"§c传送点(\"%s\")不存在",
"§c传送失败,请检查经济!",
"§c您输入的指令有误,请检查后重试"
],
"warpadd": [
"§b请输入至少一个字符",
"§b传送点(\"%s\")创建成功",
"§c添加失败,已经有这个传送点了",
"§c您输入的指令有误,请检查后重试"
],
"warpdel": [
"§b请输入至少一个字符",
"§c删除失败,该传送点不存在",
"§b传送点(\"%s\")删除成功",
"§c您输入的指令有误,请检查后重试"
],
"warpls": [
"§b当前没有可用传送点",
"§b当前传送点有:%s",
"§c您输入的指令有误,请检查后重试"
],
"BACKload": [
"回到上一次暴毙点(消耗%s经济)",
"查询死亡记录"
],
"BACKtp": [
"§b传送到暴毙点成功"
],
"backto": [
"主世界",
"地狱",
"末地",
"§l§b你最近的暴毙信息:%s %s %s %s,时间:%s\n§a返回死亡点需要§a %s §f%s,§a你还拥有 §e%s §f%s §b确定要继续吗?",
"前往暴毙点",
"退出界面",
"§c暴毙点传送失败,请检查余额",
"§b已关闭表单",
"§b已放弃表单",
"§c无死亡记录"
],
"BACKPlDie": [
"主世界",
"地狱",
"末地",
"§b你暴毙了,你的暴毙点:%s %s %s %s,时间:%s 使用/back可返回死亡地点"
],
"death": [
"主世界",
"地狱",
"末地",
"%s/%s: 地点:%s 时间:%s",
"§b你没有死亡记录"
],
"NOTICEload": [
"查看公告",
"设置公告"
],
"doneform": [
"继续设置",
"退出设置",
"§b已关闭公告设置",
"§b已放弃表单"
],
"setNotice": [
"§l§a请选择一项:",
"[\"§l§a设置标题\", \"§l§b设置内容\"]",
"§b表单已放弃"
],
"settitle": [
"§l§b请输入公告标题",
"§l§a设置完成\n§b请选择:",
"§l§b表单已放弃"
],
"setcontent": [
"§l§b增加一行",
"§l§c删除一行",
"§l§b请选择要编辑的行数",
"请修改成你想要的样子",
"§l§a操作完成\n§b请选择:",
"§b表单已放弃",
"无内容",
"§l§a操作完成\n§b请选择:",
"§l§c选择一行进行删除",
"§l§a操作完成\n§b请选择:",
"§b表单已放弃",
"§b表单已放弃"
],
"Shopload": [
"打开总商店GUI",
"打开购入商店GUI",
"打开回收商店GUI"
],
"shopgui": [
"[\"买入\", \"卖出\"]",
"§l§b请做出选择",
"§b表单已放弃"
],
"shopBuy": [
"§l§b选择一个项目",
"§l§b详情信息:\n物品:§a%s§b,\n特殊值:§a%s§b,\n花费经济:§a%s/一个§b,\n拥有经济:§a%s§b,\n备注:%s,\nTips:请输入正数",
"请输入需要购买的个数",
"§b购买成功",
"§c购买失败,无法给予不存在的物品",
"§c购买失败,请检查经济",
"§c请输入大于零的数字",
"§c请输入数字",
"§b表单已放弃",
"§c商店类型越界",
"§b表单已放弃",
"§c商店配置错误"
],
"shopSell": [
"§l§b选择一个项目",
"§l§b详情信息:\n物品:§a%s§b,\n特殊值:§a%s§b,\n获得经济:§a%s/一个§b,\n拥有经济:§a%s§b,\n备注:%s\nTips:请输入正数",
"请输入需要回收的个数",
"§b回收成功",
"§c回收失败,无法回收不存在于物品栏的物品",
"§c回收失败,您的物品数量不足",
"§c请输入大于零的数字",
"§c请输入数字",
"§b表单已放弃",
"§c商店类型越界",
"§b表单已放弃",
"§c商店配置错误"
],
"TPRload": [
"随机传送置世界某处(消耗%s经济)"
],
"tpr": [
"§b请等待区块加载...",
"§b正在寻找安全坐标...",
"§c未能tpr成功!未能找到安全坐标!请重试!",
"§a已将您传送置§e(%s,%s,%s,%s)",
"§c随机传送失败,请检查经济"
],
"RELOADCHUCKload": [
"重新载入已加载区块(消耗%s经济)"
],
"rc": [
"§b已成功加载区块",
"§c刷新区块失败,请检查经济"
],
"WriteUseLog": [
"时间,维度,主体,XYZ,事件,数据"
],
"load": [
"重新从文件加载数据"
]
},
defaultShopdata = {//预释放商店实例文件(勿改)
"Buy": [
{
"name": "xx分类",
"type": "group",
"image": "textures/items/book_portfolio.png",
"data": [
{
"name": "空气",
"type": "exam",
"image": "",
"data": {
"type": "minecraft:air",
"aux": 0,
"remark": "test",
"money": 11
}
},
{
"name": "bread",
"type": "exam",
"image": "textures/items/bread.png",
"data": {
"type": "minecraft:bread",
"aux": 0,
"remark": "a bread",
"money": 2
}
}
]
},
{
"name": "air",
"type": "exam",
"data": {
"type": "minecraft:air",
"aux": 0,
"remark": "air",
"money": 11
}
}
],
"Sell": [
{
"name": "xx分类",
"type": "group",
"image": "textures/items/book_portfolio.png",
"data": [
{
"name": "空气",
"type": "exam",
"image": "",
"data": {
"type": "minecraft:air",
"aux": 0,
"remark": "111",
"money": 11
}
},
{
"name": "bread",
"type": "exam",
"image": "textures/items/bread.png",
"data": {
"type": "minecraft:bread",
"aux": 0,
"remark": "bread",
"money": 1
}
}
]
},
{
"name": "redstone",
"type": "exam",
"image": "textures/items/redstone_dust.png",
"data": {
"type": "minecraft:redstone",
"aux": 0,
"remark": "readstone",
"money": 11
}
}
]
},
TickTask = new function () {//重要操作应发送至下个Tick运行
this.tasks = [];
this.add = (code) => {
this.tasks.push(code);
};
}(),
TMdata = new function () {//配置文件系统重写版
this.openConfig = function (path, none, defaultt = "{}") {
if (typeof (path) !== "string") {
throw new Error("Path should be a string!!!");
} else if (typeof (defaultt) != "string") {
throw new Error("Default should be a string!!!");
} else {
let jsontmp = JSON.parse(defaultt), Tpath = path.replace(/[/]/g, '\\'), newData = file.readFrom(path), TMParr = Tpath.split('\\');
TMParr.pop();
let dir = TMParr.join('\\');
if (newData == null) {
file.mkdir(dir);
newData = JSON.stringify(jsontmp, null, 2);
file.writeTo(path, newData);
}
return new function (data, path, dir) {
let time = Date.now(),
nowOBJ = null, saveTask = false;//使用缓存
function getOBJ() {
let Time = Date.now();
if ((Time - time) >= 1000 || nowOBJ == null) {
nowOBJ = JSON.parse(data);
time = Time;
}
return nowOBJ;/*删除 DeepCopy*/
}
function setOBJ(da) {
nowOBJ = da;
asyncSave();
return true;
}
function asyncSave() {
if (!saveTask) {
saveTask = true;
let Tpath = path.replace(/[/]/g, '\\'),
Path = path;
TickTask.add(() => {
try {
data = JSON.stringify(nowOBJ, null, 2);
let TMParr = Tpath.split('\\');
TMParr.pop();
let dir = TMParr.join('\\');
file.mkdir(dir);
file.writeTo(Path, data);
saveTask = false;
} catch (e) {
ErrorMsg(e);
}
});
}
}
this.asyncSave = asyncSave;
this.isSafe = function () {
try { JSON.parse(data); return true; }
catch (_) { return false; };
};
this.init = function (name, defaul) {
try {
let Data = getOBJ();
if (Data[name] == null) {
Data[name] = defaul;
setOBJ(Data);
return defaul;
} else {
return Data[name];
}
} catch (e) {
ErrorMsg(e);
return null;
}
};
this.set = function (name, aata) {
try {
let Data = getOBJ();
Data[name] = aata;
setOBJ(Data);
return true;
} catch (e) {
ErrorMsg(e);
return false;
}
};
this.get = function (name, defaul = null) {
try {
let Data = getOBJ();
if (Data[name] == null) {
return defaul;
} else {
return Data[name];
}
} catch (e) {
ErrorMsg(e);
return null;
}
};
this.delete = function (name) {
try {
let Data = getOBJ();
delete Data[name];
setOBJ(Data);
return true;
} catch (e) {
ErrorMsg(e);
return false;
}
};
this.reload = function () {
try {
file.mkdir(dir);
let newData = file.readFrom(path);
data = newData;
time -= 8000;
return true;
} catch (e) {
ErrorMsg(e);
return false;
}
};
this.close = function () {
try {
let ks = Object.keys(this),
i = 0,
l = ks.length;
while (i < l) {
delete this[ks[i]];
i++;
}
return true;
} catch (e) {
ErrorMsg(e);
return false;
}
};
this.getPath = function () {
return path;
};
this.read = function () {
return JSON.stringify(getOBJ(), null, 2);
};
this.write = function (content) {
try {
if (typeof (content) == "string") {
file.mkdir(dir);
file.writeTo(path, content);
data = content;
time -= 8000;
return true;
} else {
throw new Error("content should be a string!!!");
}
} catch (e) {
ErrorMsg(e);
return false;
}
};
}(newData, path, dir);
}
}
}(),
TMLS = new function () {//TMET虚拟监听
this.listenList = {};
this.listen = function (key, func) {
try {
let id = system.randomGuid();
if (TMLS.listenList[key] == null) {
TMLS.listenList[key] = {};
}
TMLS.listenList[key][id] = func;
logger.debug("虚拟监听", '"' + key + '"', "创建:", id);
return id;
} catch (err) {
ErrorMsg(err);
}
};
this.listenDel = function (id) {
try {
let i = 0,
k = Object.keys(TMLS.listenList),
l = k.length;
while (i < l) {
let ii = 0,
kk = Object.keys(TMLS.listenList[k[i]]),
ll = kk.length;
while (ii < ll) {
if (ii == id) {
delete TMLS.listenList[k[i]][kk[ii]];
logger.debug("虚拟监听", '"' + i + '"', "删除:", id);
return true;
}
ii++;
}
i++;
}
return false;
} catch (err) {
ErrorMsg(err);
}
};
}(),
TMCmd = new function () {
this.PlCmds = {};
this.CoCmds = {};
this.regPlayerCmd = (cmd, de, func, perm) => {
if (TMCmd.PlCmds[cmd] != null) {
throw new Error("Player command repeat registration!");
}
TMCmd.PlCmds[cmd] = {
"func": func,
"perm": perm
};
if (mc.setCmdDescribe != null) {
mc.setCmdDescribe(cmd, de, perm);
} else {
mc.regPlayerCmd(cmd, de, (_) => { return false; }, perm);
}
};
this.regConsoleCmd = (cmd, de, func) => {
if (TMCmd.CoCmds[cmd] != null) {
throw new Error("Console command repeated registration!");
}
TMCmd.CoCmds[cmd] = {
"func": func,
};
if (mc.setCmdDescribe != null) {
mc.setCmdDescribe(cmd, de, 4);
} else {
mc.regConsoleCmd(cmd, de, (_) => { return false; });
}
};
}(),
ISNJS = false;
//错误信息处理
function ErrorMsg(err) {
try {
file.mkdir('.\\logs\\Error');
logger.error("\033[1;31m" + GL("default", "ErrorMsg", 0) + (!IsPFLoader() ? err.stack : err) + "\033[0m\033[1m");
let Errmsg = {
"time": system.getTimeStr(),
"version": version,
"stack": (!IsPFLoader() ? err.stack : err),
"fs": {},
"langPacks": {},
"TMET": file.readFrom(`${getLoadPath()}\\TMEssential.js`)
},
isError = true;
try {
let i = 0,
k = Object.keys(fs),
l = k.length;
while (i < l) {
if (!fs[k[i]].isSafe()) {
throw fs[k[i]].getPath();
}
Errmsg.fs[k[i]] = JSON.parse(fs[k[i]].read());
i++;
}
if (isObject(tmp.language)) {
i = 0, k = Object.keys(tmp.language), l = k.length;
while (i < l) {
if (!tmp.language[k[i]].isSafe()) {
throw tmp.language[k[i]].getPath();
}
Errmsg.langPacks[k[i]] = JSON.parse(tmp.language[k[i]].read());
i++;
}
}
} catch (err) {
if (typeof (err.message) != "string") {
isError = false;
logger.error("\033[1;31m" + GL("default", "ErrorMsg", 1, err) + "\033[0m\033[1m");
logger.error("\033[1;31m" + GL("default", "ErrorMsg", 2) + "\033[0m\033[1m");
}
}
if (err.message.search("SystemCmd") != -1) {
isError = false;
}
if (isError) {
let TO = system.getTimeObj(),
fiid = `${TO.Y}-${TO.M}-${TO.D}-${TO.h}-${TO.m}-${TO.s}-${TO.ms}.TMETERROR`,
ErPath = `.\\logs\\Error\\${fiid}`;
file.writeTo(ErPath, JSON.stringify(Errmsg, null, 2));
logger.info("\033[1;32m" + GL("default", "ErrorMsg", 3, ErPath) + "\033[0m\033[1m");
}
} catch (e) {
let log_ = (typeof (log) != "function" ? console.log : log);
log_('\033[1;31m[Error]TMET不支持此加载器!!!\033[0m\033[1m');
}
}
function listenExample(key, a, b, c, d, e, f, g, h) {
try {
if (TMLS.listenList[key] != null) {
let retu = true,
i = 0,
k = Object.keys(TMLS.listenList[key]),
l = k.length;
while (i < l) {
let jie = null;
try {
jie = TMLS.listenList[key][k[i]](a, b, c, d, e, f, g, h);
} catch (e) {
ErrorMsg(e);
}
if (jie != null && !jie && retu) {
retu = false;
}
i++;
}
return retu;
}
} catch (err) {
ErrorMsg(err);
}
}
//异步RunCmdAs
function plRunCmdAs(xuid, cmd) {
TickTask.add(() => {
let pl = mc.getPlayer(xuid);
if (pl != null) {
pl.runcmd(cmd);
}
});
return true;
}
//引号过滤!!!!!!!!
function cmdFH(str = "") {
let re = /[#]*"([^"]+)"|([^#]+)/g;
let match;
str = str.replace(/[ ]/g, '#');
let arr = [];
while (match = re.exec(str)) {
let val = (match[1] || match[2]).replace(/[#]/g, ' '),
index = (val.indexOf("\"")),
lastIndex = (val.lastIndexOf("\"") + 1);
if (index == -1 || (index == (lastIndex - 1))) {
arr.push(val);
continue;
}
let value = val.slice(index, lastIndex).replace(/"/g, '\\\"');
value = value.replace("\\", "");