Skip to content

Commit

Permalink
feat: Add name change protection config option (#90)
Browse files Browse the repository at this point in the history
This allows dimensions to prevent a clients character name from changing
by the server sending a different name. It also rewrites packets to
ensure that both client -> server and server -> client use the name
stored by dimensions.

Exclusions are provided when particular dimensions actually require this
functionality, whilst still providing an unchanging name for other
dimensions.
  • Loading branch information
popstarfreas authored Oct 31, 2021
1 parent ad579dd commit 11a1dd4
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 34 deletions.
45 changes: 30 additions & 15 deletions app/node_modules/dimensions/client.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 44 additions & 19 deletions app/node_modules/dimensions/clientpackethandler.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions app/node_modules/dimensions/configloader.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions app/node_modules/dimensions/terrariaserverpackethandler.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions config.js.example
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,19 @@ exports.ConfigSettings = {
host: "localhost",
port: 6379
},

nameChanges: {
// Prevents a server from changing client's name in dimensions
// modes:
// * "legacy" - Behaviour of v5.9.1 and lower
// 1. Passes through player info packets from client and server even if they have
// a mismatched name.
// * "rewrite" - 1. Never updates a client's name dimensions-side after it has been set,
// unless the packet is from the server and it is excluded from this rule.
// 2. Rewrites packets from the client and the server if they have a name mismatch.
mode: "legacy",
// A list of dimension names that are allowed (only the server itself, not client) to update a client's name
rewriteExclusions: [],
},
}
};
14 changes: 14 additions & 0 deletions config.js.quickstart
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,19 @@ exports.ConfigSettings = {
host: "localhost",
port: 6379
},

nameChanges: {
// Prevents a server from changing client's name in dimensions
// modes:
// * "legacy" - Behaviour of v5.9.1 and lower
// 1. Passes through player info packets from client and server even if they have
// a mismatched name.
// * "rewrite" - 1. Never updates a client's name dimensions-side after it has been set,
// unless the packet is from the server and it is excluded from this rule.
// 2. Rewrites packets from the client and the server if they have a name mismatch.
mode: "legacy",
// A list of dimension names that are allowed (only the server itself, not client) to update a client's name
rewriteExclusions: [],
},
}
};

0 comments on commit 11a1dd4

Please sign in to comment.