clean up README
ci/woodpecker/push/jfmod Pipeline was successful
Details
ci/woodpecker/push/jfmod Pipeline was successful
Details
This commit is contained in:
parent
b4b592509b
commit
2a317e9b5a
30
README.md
30
README.md
|
@ -1,27 +1,39 @@
|
||||||
Better-Whitelist provides a basic whitelist system for your server that you can adapt to your use case.
|
Better-Whitelist provides a basic whitelist system for your server that you can adapt to your use case.
|
||||||
|
|
||||||
The mod is required both on the server and any clients connecting to the server.
|
The mod is required both on the server and any clients connecting to the server.
|
||||||
|
|
||||||
The whitelist is configured using [μScript](https://git.frohnmeyer-wds.de/Johannes/java-commons/src/branch/master/muscript), but you don't have to be good at programming to use this mod.
|
The whitelist is configured using [μScript](https://git.frohnmeyer-wds.de/Johannes/java-commons/src/branch/master/muscript), but you don't have to be good at programming to use this mod.
|
||||||
|
|
||||||
A config file with some additional details will be created when you first start your server with the mod.
|
A config file with some additional details will be created when you first start your server with the mod.
|
||||||
|
|
||||||
A simple config for Better-Whitelist could look as follows (please note that you'd probably have to add exceptions for client-side mods with optional server-side components when using this):
|
A simple config for Better-Whitelist could look as follows (please note that you'd probably have to add exceptions for client-side mods with optional server-side components when using this):
|
||||||
```
|
```
|
||||||
sharedMods = mods::values()::filter({ v -> v.environment != 'server' })::map({ v -> { id = v.id, version = v.version } })
|
// convert a mod to a simpler representation to save bandwidth
|
||||||
|
simplify = { mod -> { id = mod.id, version = mod.version } }
|
||||||
|
|
||||||
|
// all non-serverside mods present on the server
|
||||||
|
sharedMods = mods::values()
|
||||||
|
::filter({ v -> v.environment != 'server' & v.id != 'java' })
|
||||||
|
::map(simplify)
|
||||||
|
|
||||||
// ensure the client has the correct version of every non-serverside mod on the server
|
// ensure the client has the correct version of every non-serverside mod on the server
|
||||||
assert(challenge({ arg ->
|
clientMissing = challenge({ arg ->
|
||||||
arg::allMatch({ v -> mods::values()::anyMatch({ m -> v.id == m.id & v.version == m.version }) })
|
arg::filter({ v -> !mods::values()::anyMatch({ m -> v.id == m.id & v.version == m.version }) })
|
||||||
}, sharedMods))
|
}, sharedMods)
|
||||||
|
assert(clientMissing::isEmpty(), 'You lack required mods: ' || clientMissing)
|
||||||
|
|
||||||
// ensure the client has no additional mods that would be required on the server
|
// ensure the client has no additional mods that would be required on the server
|
||||||
assert(challenge({ arg ->
|
clientAdditional = challenge({ arg, fn ->
|
||||||
clientSideMods = mods::values()::filter({ v -> v.environment != 'client' })
|
clientSideMods = mods::values()::filter({ v -> v.environment != 'client' & v.id != 'java' })
|
||||||
clientSideMods::allMatch({ v -> arg::anyMatch({ m -> v.id == m.id & v.version == m.version }) })
|
clientSideMods::filter({ v -> !arg::anyMatch({ m -> v.id == m.id & v.version == m.version }) })::map(fn)
|
||||||
}, sharedMods))
|
}, sharedMods, simplify)
|
||||||
|
assert(clientAdditional::isEmpty(), 'You have unsupported mods: ' || clientAdditional)
|
||||||
|
|
||||||
// filter resource packs for X-Ray packs
|
// filter resource packs for X-Ray packs
|
||||||
bannedWords = listOf('xray', 'x-ray', 'cheat')
|
bannedWords = listOf('xray', 'x-ray', 'cheat')
|
||||||
assert(!challenge({ ->
|
assert(!challenge({ ->
|
||||||
resourcePacks::map({ pack -> pack.name || ' ' || pack.displayName || ' ' || pack.description })
|
resourcePacks::map({ pack -> pack.name || ' ' || pack.displayName || ' ' || pack.description })
|
||||||
})::anyMatch({ v -> bannedWords::anyMatch({ word -> v::contains(word) }) }))
|
})::anyMatch({ v -> bannedWords::anyMatch({ word -> v::toLower()::contains(word) }) }), "Please don't cheat, " || user.name)
|
||||||
```
|
```
|
||||||
|
|
||||||
The following things are available to your scripts:
|
The following things are available to your scripts:
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class BetterWhitelistServer implements DedicatedServerModInitializer {
|
||||||
if (!challenge.responses.isEmpty()) return challenge.responses.remove();
|
if (!challenge.responses.isEmpty()) return challenge.responses.remove();
|
||||||
else throw new AssertFail("Took too long to respond");
|
else throw new AssertFail("Took too long to respond");
|
||||||
}).set("user", Map.of(
|
}).set("user", Map.of(
|
||||||
"id", DFinal.of(gp.getId().toString()),
|
"id", gp.getId() == null ? new DNull() : DFinal.of(gp.getId().toString()),
|
||||||
"name", DFinal.of(gp.getName())
|
"name", DFinal.of(gp.getName())
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue