-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.html
698 lines (651 loc) · 31.4 KB
/
setup.html
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
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>Setup | ViaVersion</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" sizes="128x128" href="https://avatars0.githubusercontent.com/u/47455182?s=128">
<link rel="alternate" href="https://viaversion.com/setup?lang=de" hreflang="de-DE">
<link rel="alternate" href="https://viaversion.com/setup?lang=fr" hreflang="fr-FR">
<link rel="alternate" href="https://viaversion.com/setup?lang=pt" hreflang="pt-PT">
<meta name="description"
content="This tool will guide you on installing & configuring ViaVersion and its addons depending on your paper/spigot/bungee/velocity server setup">
<meta name="keywords"
content="viaversion, viabackwards, viarewind, sponge, viabungee, velocity, setup, plugin, install, configuration, java-edition, protocol translator, addon, minecraft server, paper, velocity, waterfall, bungeecord, spigot, block-version, block-protocols, proxy">
<meta property="og:type" content="website"/>
<meta property="og:image" content="https://avatars0.githubusercontent.com/u/47455182?s=128&t=1">
<meta property="og:url" content="https://viaversion.com/setup"/>
<meta property="og:site_name" content="ViaVersion Setup"/>
<meta property="og:title" content="ViaSetup - Plugin Setup Generator for Via*"/>
<meta property="og:description"
content="This tool will guide you on installing and configuring ViaVersion and its addons depending on your server setup">
<link href="common.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<script async src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js"
integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy"
crossorigin="anonymous"></script>
<style>
body {
background-color: #585962;
color: whitesmoke;
text-align: center;
background-image: url('images/background.webp');
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
}
label {
display: inline;
padding-left: 10px;
}
#info_container {
text-align: left;
border: 2px solid #ffc300;
border-radius: 8px;
background: #484848;
display: inline-block;
padding-bottom: 10px;
}
.li_info {
padding: 10px;
}
.container {
text-align: left;
}
#output_container {
border: 2px solid green;
border-radius: 8px;
background: #484848;
display: none;
padding: 10px;
margin: 20px;
}
#warn {
display: none;
border: 2px solid darkred;
border-radius: 8px;
background: #ffb2b2;
padding: 10px;
margin: 20px;
color: darkred;
}
#check {
cursor: pointer;
text-decoration: underline;
}
#info_container {
display: block;
word-wrap: break-word;
}
a {
color: whitesmoke;
}
.ctooltip {
position: relative;
border-bottom: 1px dotted white;
cursor: copy;
}
.ctooltip .ctooltiptext {
visibility: hidden;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 50%;
left: 50%;
margin-left: -60px;
}
.ctooltip .ctooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.ctooltip:hover .ctooltiptext {
visibility: visible;
}
.help {
cursor: help;
}
#server_version, #proxy {
font-size: 15px;
}
#credits {
position: fixed;
left: 5px;
bottom: 10px;
}
@media screen and (max-width: 499px) {
body {
background-image: url('images/background-mobile.webp');
}
.container {
margin-left: auto;
margin-right: auto;
width: 110px;
}
}
@media screen and (min-width: 500px) {
.center {
margin-left: auto;
margin-right: auto;
max-width: 740px;
background-color: rgba(77, 77, 77, 0.84);
padding: 15px 15px 1px 15px;
margin-top: 60px;
font-size: x-large;
}
}
</style>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg bg-body-tertiary fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="index.html"><img
src="images/logotext-small.png"
alt="Via logo" height="32" width="63"> ViaVersion</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav me-auto mb-2 mb-lg-0 fw-bold">
<a class="nav-link" href="index.html">Home</a>
<a class="nav-link" href="downloads.html">Downloads</a>
<a class="nav-link active" href="#">Setup</a>
<a class="nav-link" href="team.html">Team</a>
</div>
<div class="btn-group">
<a class="nav-link fs-3 px-lg-4" href="https://github.com/viaversion"
target="_blank" aria-label="GitHub"><i class="bi bi-github"></i></a>
<a class="nav-link fs-3" href="https://discord.gg/viaversion"
target="_blank" aria-label="Discord"><i class="bi bi-discord"></i></a>
</div>
</div>
</div>
</nav>
</header>
<div class="center">
<h3>ViaSetup - Plugin Setup Generator for Via*</h3>
<label for="server_version" id="server_version_text">Select your server version</label>
<select id="server_version" onchange="getPlugins()">
<optgroup label="Latest">
<option value="769">🌼1.21.4</option>
</optgroup>
<optgroup label="1.21.x">
<option value="768">1.21.2 & 1.21.3</option>
<option value="767">1.21 & 1.21.1</option>
</optgroup>
<optgroup label="1.20.x">
<option value="766">1.20.5 & 1.20.6</option>
<option value="765">1.20.3 & 1.20.4</option>
<option value="764">1.20.2</option>
<option value="763">1.20 & 1.20.1</option>
</optgroup>
<optgroup label="1.19.x">
<option value="762">1.19.4</option>
<option value="761">1.19.3</option>
<option value="760">1.19.1 & 1.19.2</option>
<option value="759">1.19</option>
</optgroup>
<optgroup label="1.18.x">
<option value="758">1.18.2</option>
<option value="757">1.18 & 1.18.1</option>
</optgroup>
<optgroup label="1.17.x">
<option value="756">1.17.1</option>
<option value="755">1.17</option>
</optgroup>
<optgroup label="1.16.x">
<option value="754">1.16.4 & 1.16.5</option>
<option value="753">1.16.3</option>
<option value="751">1.16.2</option>
<option value="736">1.16.1</option>
<option value="735">1.16</option>
</optgroup>
<optgroup label="1.15.x">
<option value="578">1.15.2</option>
<option value="575">1.15.1</option>
<option value="573">1.15</option>
</optgroup>
<optgroup label="1.14.x">
<option value="498">1.14.4</option>
<option value="490">1.14.3</option>
<option value="485">1.14.2</option>
<option value="480">1.14.1</option>
<option value="477">1.14</option>
</optgroup>
<optgroup label="1.13.x">
<option value="404">1.13.2</option>
<option value="401">1.13.1</option>
<option value="393">1.13</option>
</optgroup>
<optgroup label="1.12.x">
<option value="340">1.12.2</option>
<option value="338">1.12.1</option>
<option value="335">1.12</option>
</optgroup>
<optgroup label="1.11.x">
<option value="316">1.11.1 & 1.11.2</option>
<option value="315">1.11</option>
</optgroup>
<optgroup label="1.10.x">
<option value="210">1.10.x</option>
</optgroup>
<optgroup label="1.9.x">
<option value="110">1.9.3 & 1.9.4</option>
<option value="109">1.9.2</option>
<option value="108">1.9.1</option>
<option value="107">1.9</option>
</optgroup>
<optgroup label="1.8.8 Legacy">
<option value="47">1.8.8</option>
</optgroup>
</select>
<br>
<label for="proxy" id="proxy_text">Do you want to install Via* on a proxy (Bungee, Velocity,...)?</label>
<select id="proxy" onchange="getPlugins()">
<option id="pNo" value="none">No</option>
<option value="velocity">Velocity</option>
<option value="bungeecord">BungeeCord/Waterfall</option>
<option value="sponge">Sponge</option>
<option value="other" id="pOther">Other</option>
</select>
<br>
<label id="versions">Check versions you want to support</label><br>
<div onchange="getPlugins()" class="container">
<div class="row">
<div class="col-sm-4">
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
</div>
</div>
</div>
<div style="clear: both">
<div id="output_container">
<span style="font-weight: bold" id="out_text">You need </span><code id="out"></code></div>
<div id="warn">Please select at least one additional version!</div>
<br>
<ul id="info_container">
<li id="tip" class="li_info" style="display: none"></li>
<li id="velocity" class="li_info" style="display: none">You need <a href="https://velocitypowered.com/"
target="_blank"
rel="noopener">Velocity</a>
as proxy for 1.7 support
</li>
<li id="note" class="li_info">Make sure you have Via* only on the <span class="ctooltip help">proxy<span
class="ctooltiptext">BungeeCord, Velocity, ...</span></span>
OR on all <span class="ctooltip help">backend servers<span
class="ctooltiptext">Paper, Spigot, ...</span></span>
(recommend
setup)
</li>
<li id="viabungee" class="li_info" style="display: none">
Put <code>ViaBungee</code> into your Bungeecord/Waterfall plugins folder and put ViaVersion (and its
addons) in <code>/plugins/ViaVersion/</code>
</li>
</ul>
</div>
</div>
<div id="credits">Made with ♥ by Jo0001</div>
<footer>
<div class="mt-5 pt-5 pb-3 bg-content text-white" style="background-color: #2b2b2b; overflow: hidden;">
<div class="row align-items-start text-center">
<div class="col">
<h4>Services</h4>
<a href="https://jd.viaversion.com/" target="_blank" class="footer-link text-white">Javadocs</a><br>
<a href="https://repo.viaversion.com/" target="_blank" class="footer-link text-white">Repository
Server</a><br>
<a href="https://ci.viaversion.com/" target="_blank" class="footer-link text-white">Jenkins (CI)</a>
</div>
<div class="col">
<h4>Community</h4>
<a href="https://discord.gg/viaversion" target="_blank" class="footer-link text-white">Discord</a><br>
<a href="https://github.com/ViaVersion" target="_blank" class="footer-link text-white">GitHub</a><br>
<a href="https://hangar.papermc.io/ViaVersion" target="_blank" class="footer-link text-white">Hangar</a><br>
<a href="https://modrinth.com/organization/viaversion" target="_blank" class="footer-link text-white">Modrinth</a>
</div>
<div class="col">
<h4>Organisation</h4>
<a href="team.html" class="footer-link text-white">Our Team</a><br>
<a href="https://github.com/ViaVersion/ViaVersion/pulls" target="_blank" class="footer-link text-white">Contribute</a><br>
<a href="https://viaversion.com/donate" target="_blank" class="footer-link text-white">Donate</a><br>
<a href="https://github.com/ViaVersionAddons" target="_blank" class="footer-link text-white">ViaVersion
Addon</a>
</div>
<div class="col">
<h4>Miscellaneous</h4>
<a href="setup.html" class="footer-link text-white">ViaSetup</a><br>
<a href="https://docs.viaversion.com/display/VIAVERSION/" target="_blank"
class="footer-link text-white">Documentation</a><br>
<a href="https://github.com/ViaVersion/ViaVersion/tree/master?tab=readme-ov-file#license"
target="_blank" class="footer-link text-white">Licensing</a><br>
</div>
</div>
<div class="text-center m-3">© 2016-2025 The ViaVersion Team.</div>
</div>
</footer>
<script>
let versions = Array.from([{protocol: 5, version: "1.7", display: "1.7.x"}, {
protocol: 47,
version: "1.8",
display: "1.8.x"
}, {protocol: 107, version: "1.9"}, {protocol: 108, version: "1.9.1"}, {
protocol: 109,
version: "1.9.2"
}, {protocol: 110, version: "1.9.3", display: "1.9.3/4"}, {protocol: 210, version: "1.10", display: "1.10.x"}, {
protocol: 315,
version: "1.11"
}, {protocol: 316, version: "1.11.1", display: "1.11.1/2"}, {protocol: 335, version: "1.12"}, {
protocol: 338,
version: "1.12.1"
}, {protocol: 340, version: "1.12.2"}, {protocol: 393, version: "1.13"}, {
protocol: 401,
version: "1.13.1"
}, {protocol: 404, version: "1.13.2"}, {protocol: 477, version: "1.14"}, {
protocol: 480,
version: "1.14.1"
}, {protocol: 485, version: "1.14.2"}, {protocol: 490, version: "1.14.3"}, {
protocol: 498,
version: "1.14.4"
}, {protocol: 573, version: "1.15"}, {protocol: 575, version: "1.15.1"}, {
protocol: 578,
version: "1.15.2"
}, {protocol: 735, version: "1.16"}, {protocol: 736, version: "1.16.1"}, {
protocol: 751,
version: "1.16.2"
}, {protocol: 753, version: "1.16.3"}, {protocol: 754, version: "1.16.4", display: "1.16.4/5"}, {
protocol: 755,
version: "1.17"
}, {protocol: 756, version: "1.17.1"}, {protocol: 757, version: "1.18", display: "1.18/1"}, {
protocol: 758,
version: "1.18.2"
}, {protocol: 759, version: "1.19"}, {protocol: 760, version: "1.19.1", display: "1.19.1/2"}, {
protocol: 761,
version: "1.19.3"
}, {protocol: 762, version: "1.19.4"}, {protocol: 763, version: "1.20", display: "1.20/.1"}, {
protocol: 764,
version: "1.20.2"
}, {
protocol: 765,
version: "1.20.3", display: "1.20.3/4"
}, {
protocol: 766,
version: "1.20.5", display: "1.20.5/6"
}, {
protocol: 767,
version: "1.21", display: "1.21/.1"
}, {
protocol: 768,
version: "1.21.2", display: "1.21.2/3"
}, {
protocol: 769,
version: "1.21.4"
}
]);
let server_version = parseInt(document.getElementById("server_version").value);
const container = "col-sm-4";
//checkbox generator
for (let i = 0; i < versions.length; i++) {
let version = versions[i];
let input = document.createElement("input");
input.type = "checkbox";
input.value = version.protocol;
input.id = version.protocol;
if (version.protocol === server_version) {
input.checked = true;
}
let label = document.createElement("label");
label.htmlFor = version.protocol;
if (typeof version.display !== "undefined") {
label.innerText = version.display;
} else {
label.innerText = version.version;
}
let br = document.createElement("br");
let idx = 2;
if (i < versions.length / 3) {
idx = 0;
} else if (i < versions.length / 3 * 2) {
idx = 1;
}
document.getElementsByClassName(container)[idx].appendChild(input);
document.getElementsByClassName(container)[idx].appendChild(label);
document.getElementsByClassName(container)[idx].appendChild(br);
}
let span = document.createElement("span");
span.id = "check";
span.innerText = "Check all";
document.getElementsByClassName(container)[2].appendChild(span);
</script>
<script>
//Language settings
let lang = new URLSearchParams(window.location.search).get("lang");
let langs = {
"en": () => {
},
"de": () => {
document.getElementById("server_version_text").innerHTML = "Wähle deine Server Version";
document.getElementById("proxy_text").innerHTML = "Möchtest du Via* auf einem Proxy installieren (Bungee, Velocity,..)?";
document.getElementById("pNo").innerHTML = "Nein";
document.getElementById("pOther").innerHTML = "Anderer";
document.getElementById("versions").innerHTML = "Klicke alle Versionen an, mit denen Spielern beitreten sollen";
document.getElementById("out_text").innerHTML = "Du brauchst";
document.getElementById("warn").innerHTML = "Bitte wähle eine weitere Version aus!";
document.getElementById("note").innerHTML = "Stelle sicher, dass du Via* nur auf dem <span class=\"ctooltip help\">Proxy<span class=\"ctooltiptext\">BungeeCord, Velocity, ...</span></span> ODER auf allen <span class=\"ctooltip help\">backend Servern<span class=\"ctooltiptext\">Paper, Spigot, ...</span></span> installierst (empfohlenes Setup)";
document.getElementById("velocity").innerHTML = "Du brauchst <a href=\"https://velocitypowered.com/\" target=\"_blank\" rel=\"noopener\">Velocity</a> als Proxy für 1.7 Support";
document.getElementById("viabungee").innerHTML = " Kopiere <code>ViaBungee</code> in den Bungee/Waterfall plugin Ordner und kopiere ViaVersion (und die Erweiterungen) nach <code>/plugins/ViaVersion/</code>";
blockMessage = "Füge folgende Nummern in der ViaVersion <code>$path</code> unter <code>block-versions: <b class='ctooltip'><span class='ctooltiptext'>Klicke zum kopieren</span>[$output]</b></code> ein";
toggleMessage = ["Alle wählen", "Alle abwählen"];
},
"pt": () => {
document.getElementById("server_version_text").innerHTML = "Selecione a versão do servidor";
document.getElementById("proxy_text").innerHTML = "Quer usar os plugins Via* em um proxy (BungeeCord, Velocity, ...)?";
document.getElementById("versions").innerHTML = "Selecione as versões para dar suporte";
document.getElementById("out_text").innerHTML = "Você precisa de";
document.getElementById("warn").innerHTML = "Selecione uma versão adicional!";
document.getElementById("note").innerHTML = "Tenha certeza de que os plugins Via* estão somente no proxy ou nos servidores backend (configuração recomendada)";
blockMessage = "Insira estes números na <code>$path</code> do ViaVersion em <code>block-versions: <b class='ctooltip'><span class='ctooltiptext'>Click to copy</span>[$output]</b></code>";//todo add translation
toggleMessage = ["Marcar tudo", "Desmarcar tudo"];
document.getElementById("velocity").innerHTML = "Você precisará do <a href='https://velocitypowered.com/' target='_blank' rel='noopener'>Velocity</a> como proxy para aceitar a versão 1.7";
document.getElementById("credits").innerHTML = "Feito com ♥ por Jo0001";
},
"fr": () => {
document.getElementById("server_version_text").innerHTML = "Sélectionnez votre version de serveur";
document.getElementById("proxy_text").innerHTML = "Voulez-vous installer les plugins Via* sur un proxy (BungeeCord, Velocity, ...) ?";
document.getElementById("versions").innerHTML = "Cochez les versions que vous souhaitez supporter";
document.getElementById("out_text").innerHTML = "Vous avez besoin de";
document.getElementById("warn").innerHTML = "Veuillez cocher au moins une version supplémentaire !";
document.getElementById("note").innerHTML = "Assurez-vous d'installer Via* uniquement sur le <span class=\"ctooltip help\">proxy<span class=\"ctooltiptext\">BungeeCord, Velocity, ...</span></span> OU sur chacun de vos <span class=\"ctooltip help\">serveurs<span class=\"ctooltiptext\">Paper, Spigot, ...</span></span> (recommandé)";
blockMessage = "Collez ces nombres dans le fichier <code>$path</code> de ViaVersion à la ligne <code>block-versions: <b class='ctooltip'><span class='ctooltiptext'>Clique pour copier</span>[$output]</b></code>";
toggleMessage = ["Tout cocher", "Tout décocher"];
document.getElementById("velocity").innerHTML = "Vous avez besoin de <a href='https://velocitypowered.com/' target='_blank' rel='noopener'>Velocity</a> comme proxy pour autoriser la version 1.7";
document.getElementById("credits").innerHTML = "Fait avec ♥ par Jo0001";
}
};
let toggleMessage = ["Check all", "Uncheck all"];
let blockMessage = "Paste these numbers to the ViaVersion <code>$path</code> under <code>block-versions: <b class='ctooltip'><span class='ctooltiptext'>Click to copy</span>[$output]</b></code>";
let path = "/plugins/ViaVersion/config.yml";
let langIds = Object.keys(langs);
if (!langIds.includes(lang)) {
lang = navigator.language.substring(0, 2);
if (!langIds.includes(lang)) lang = "en";
let url = new URL(window.location);
url.searchParams.set("lang", lang);
history.replaceState(null, null, url);
}
document.documentElement.lang = lang;
langs[lang]();
document.getElementById("check").addEventListener('click', toggleCheck)
//Plugin generation
function getPlugins() {
let server_version = parseInt(document.getElementById("server_version").value);
let player_versions = Array.from(document.getElementsByTagName("input")).filter(it => {
if (it.value == server_version) it.checked = true;
return it.checked;
}).map(it => parseInt(it.value)).filter(function (item) {
return !isNaN(item);
});
if (player_versions.includes(server_version) && player_versions.length === 1) {
document.getElementById("output_container").style.display = "none";
document.getElementById("warn").style.display = "inline-block";
document.getElementById("tip").style.display = "none";
return;
} else {
document.getElementById("output_container").style.display = "inline-block";
document.getElementById("warn").style.display = "none";
}
let rewind = player_versions.some(it => it < server_version && it < 107);
let backwards = player_versions.some(it => (it < server_version));
let proxyType = document.getElementById("proxy").value;
let proxy = proxyType !== "none";
document.getElementById("out").innerHTML = " ViaVersion" + (backwards ? " + ViaBackwards" : "") + (rewind ? " + ViaRewind" : "") + (rewind && !proxy ? " (+ ViaRewind Legacy Support)" : "") + (proxyType === "bungeecord" ? " + ViaBungee" : "") + (proxyType === "sponge" ? " + ViaSponge" : "");
generateBlockList();
if (player_versions.includes(5) && proxy && proxyType !== "velocity") {
document.getElementById("velocity").style.display = "list-item";
} else {
document.getElementById("velocity").style.display = "none";
}
if (proxyType === "bungeecord") {
document.getElementById("viabungee").style.display = "list-item";
} else {
document.getElementById("viabungee").style.display = "none";
}
function generateBlockList() {
let blocked_versions = Array.from(document.getElementsByTagName("input")).filter(it => {
return it.checked === false;
}).map(it => parseInt(it.value)).filter(function (item) {
return !isNaN(item);
});
if (blocked_versions.length === 0) {
document.getElementById("tip").style.display = "none";
return;
}
let confString;
function convert(array) {
let range = [];
for (let i = 0; i < array.length; i++) {
let version = versions.find((version) => version.protocol === array[i])
if (i !== 0) {//skip check for the first entry
let idx = versions.findIndex((version) => version.protocol === array[i]);
let idxBefore = versions.findIndex((version) => version.protocol === array[i - 1]);
if (idx - idxBefore > 1) {
range.push("|");
}
}
range.push(version.version);
}
return range;
}
let range = convert(blocked_versions);
let confArr = [];
let idx = range.indexOf("|");
if (idx !== -1) {
let lowerBound = range.slice(0, idx);
let upperBound = range.slice(range.lastIndexOf("|") + 1, range.length);
let middle = [];
if (count(range) > 1) {
//remove upper & lower and the separator to get the middle elements
middle = range.filter(function (el) {
return !upperBound.includes(el);
}).filter(function (el) {
return !lowerBound.includes(el);
}).filter(it => {
return it !== "|";
});
}
if (player_versions.includes(versions[0].protocol)) {
confArr = confArr.concat(lowerBound);
} else {
let pI = versions.findIndex((version) => version.version === lowerBound[lowerBound.length - 1]);
lowerBound.push(versions[pI + 1].version);
confArr.push("<" + lowerBound[idx]);
}
confArr = confArr.concat(middle);
if (player_versions.includes(versions[versions.length - 1].protocol)) {
confArr = confArr.concat(upperBound);
} else {
let op = convertToProtocol(upperBound[0]) < server_version ? "<" : ">";
confArr.push(op + convertToVersion(player_versions.at(-1)));
}
} else {//All unchecked checkboxes are one after the other without interruption (they can be at the end/start or in the middle
//check if only some versions in the middle should be blocked
if (player_versions.includes(versions[0].protocol) && player_versions.includes(versions.at(-1).protocol)) {
confArr = confArr.concat(range);
} else {
let upper = player_versions.at(-1) < convertToProtocol(range.at(-1));//all versions except the high/end ones are selected
let op = upper ? ">" : "<";
let version = upper ? convertToVersion(player_versions.at(-1)) : convertToVersion(player_versions[0]);
confArr.push(op + version);
}
}
function convertToVersion(protocol) {
return versions.find(version => version.protocol === protocol).version;
}
function convertToProtocol(mcstring) {
return versions.find(version => version.version === mcstring).protocol;
}
function count(arr) {
return arr.filter(it => {
return it === "|";
}).length;
}
confString = confArr.map(it =>
'"' + it + '"'
);
document.getElementById("tip").innerHTML = blockMessage.replaceAll("$output", confString).replaceAll("$path", path);
document.getElementsByClassName("ctooltip")[0].addEventListener('click', function () {
copyToClipboard(confString)
});
document.getElementById("tip").style.display = "list-item";
}
}
let check = false;
function toggleCheck() {
check = !check;
setCheckText();
let player_versions = Array.from(document.getElementsByTagName("input"));
player_versions.shift();
player_versions.forEach(it => {
it.checked = check;
});
getPlugins();
}
function setCheckText() {
document.getElementById("check").innerHTML = check ? toggleMessage[1] : toggleMessage[0];
}
setCheckText();
//copy blocklist to clipboard
function copyToClipboard(blocked_versions) {
let tooltiptextElm = document.getElementsByClassName("ctooltiptext")[0];
navigator.clipboard.writeText("[" + blocked_versions + "]").then(function () {
tooltiptextElm.style.border = "5px solid green";
setTimeout(function () {
tooltiptextElm.style.border = "none";
}, 2500);
}, function (e) {
console.exception(e);
tooltiptextElm.style.border = "5px solid red";
setTimeout(function () {
tooltiptextElm.style.border = "none";
}, 2500);
})
}
</script>
<!-- Cloudflare Web Analytics -->
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
data-cf-beacon='{"token": "9e524d0ad093418fbbe97cf1a013ee81"}'></script><!-- End Cloudflare Web Analytics -->
</body>
</html>