Impersonate
Have you ever wanted to impersonate another player ? Be it for making machinimas, roleplaying, playing 5D chess in factions, or just pranking friends, there are lots of (relatively) good reasons to assume the identity of someone else.
Features
Impersonate allows players to take on the name and appearance of other players. When impersonating someone, a player will:
- have the skin of the impersonated player
- have the nameplate of the impersonated player
- send every chat message as if they were the impersonated player
- appear as the impersonated players in online player lists, if the impersonated player is online both will be shown as them separately
- sign books as if they were the impersonated player
- etc.
They will however not fool the impersonated player’s pets, if any.
To avoid moderation chaos, server logs will always display the actual player’s name, alongside their fake identity. Server operators will have ongoing impersonations revealed in the same way.
Commands
Impersonate adds the /impersonate
command, allowing server operators and mapmakers to interact with the API through
commands.
/impersonate disguise
/impersonate disguise as <name> [<targets>] [<key>]
: disguises one or more players<name>
: Name of the player to impersonate. Does not have to be online or even real.[<targets>]
(optional) : If specified, must be either a player’s username or a target selector. If unspecified, defaults to the player using the command. When used in a command block,[<targets>]
is not optional.[<key>]
(optional) : If specified, must be a valid identifier serving as a key for the impersonation.
/impersonate disguise clear [<targets>] [<key>]
: stops the impersonation of one or more players[<targets>]
(optional) : If specified, must be either a player’s username or a target selector. If unspecified, defaults to the player using the command. When used in a command block,[<targets>]
is not optional.[<key>]
(optional) : If specified, must be a valid identifier that was previously used as a key to start an impersonation. If left unspecified, the command will clear every active impersonation.
/impersonate disguise query [<target>] [<key>]
: queries the ongoing impersonation for a given player.[<target>]
(optional) : If specified, must be either a player’s username or a target selector. If unspecified, defaults to the player using the command. When used in a command block, player is not optional.[<key>]
(optional) : If specified, must be a valid identifier. In that case, the command will display the specific impersonation using that key, otherwise it will display the currently visible (most recent) impersonation.
Gamerules
impersonate:fakeCapes
: Whether impersonators should get the cape and elytra of impersonated players. Defaults tofalse
. If Illuminations is installed, the gamerule also applies to player cosmetics.impersonate:opRevealImpersonations
: Whether ongoing impersonations should be revealed to online server operators. Defaults totrue
.impersonate:logRevealImpersonations
: Whether ongoing impersonations should be revealed in the server logs. Defaults totrue
.
Using Impersonate (for developers)
If you are a developer, you can use Impersonate as a library for your own project by inserting the following in your build.gradle
:
You can find the current version of Impersonate in the releases tab of the repository on Github, and the latest CCA version in the appropriate repository.
Example code
You can find examples in the Test Mod and in the Impersonate Command.
public static final Identifier IMPERSONATION_KEY = new Identifier("mymod", "impersonitem");
public boolean useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) {
if (entity instanceof ServerPlayerEntity) {
Impersonator.get(user).impersonate(IMPERSONATION_KEY, ((PlayerEntity) entity).getGameProfile());
} else {
Impersonator.get(user).stopImpersonation(IMPERSONATION_KEY);
}
return super.useOnEntity(stack, user, entity, hand);
}