mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 01:27:40 +01:00
Add show-displayname option
This commit is contained in:
parent
46a8a7d04c
commit
cca98e817f
@ -153,6 +153,10 @@ public class DiscordSettings implements IConf {
|
|||||||
return config.getBoolean("show-name", false);
|
return config.getBoolean("show-name", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowDisplayName() {
|
||||||
|
return config.getBoolean("show-displayname", false);
|
||||||
|
}
|
||||||
|
|
||||||
public String getAvatarURL() {
|
public String getAvatarURL() {
|
||||||
return config.getString("avatar-url", "https://crafthead.net/helm/{uuid}");
|
return config.getString("avatar-url", "https://crafthead.net/helm/{uuid}");
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public class JDADiscordService implements DiscordService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateTypesRelay() {
|
public void updateTypesRelay() {
|
||||||
if (!getSettings().isShowAvatar() && !getSettings().isShowName()) {
|
if (!getSettings().isShowAvatar() && !getSettings().isShowName() && !getSettings().isShowDisplayName()) {
|
||||||
for (WebhookClient webhook : channelIdToWebhook.values()) {
|
for (WebhookClient webhook : channelIdToWebhook.values()) {
|
||||||
webhook.close();
|
webhook.close();
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class BukkitListener implements Listener {
|
|||||||
MessageUtil.sanitizeDiscordMarkdown(FormatUtil.stripEssentialsFormat(jda.getPlugin().getEss().getPermissionsHandler().getSuffix(player)))),
|
MessageUtil.sanitizeDiscordMarkdown(FormatUtil.stripEssentialsFormat(jda.getPlugin().getEss().getPermissionsHandler().getSuffix(player)))),
|
||||||
player.hasPermission("essentials.discord.ping"),
|
player.hasPermission("essentials.discord.ping"),
|
||||||
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", player.getUniqueId().toString()) : null,
|
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", player.getUniqueId().toString()) : null,
|
||||||
jda.getSettings().isShowName() ? player.getName() : null,
|
jda.getSettings().isShowName() ? player.getName() : (jda.getSettings().isShowDisplayName() ? player.getDisplayName() : null),
|
||||||
player.getUniqueId());
|
player.getUniqueId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ public class BukkitListener implements Listener {
|
|||||||
MessageUtil.sanitizeDiscordMarkdown(message),
|
MessageUtil.sanitizeDiscordMarkdown(message),
|
||||||
false,
|
false,
|
||||||
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", player.getUniqueId().toString()) : null,
|
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", player.getUniqueId().toString()) : null,
|
||||||
jda.getSettings().isShowName() ? player.getName() : null,
|
jda.getSettings().isShowName() ? player.getName() : (jda.getSettings().isShowDisplayName() ? player.getDisplayName() : null),
|
||||||
player.getUniqueId()));
|
player.getUniqueId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ public class BukkitListener implements Listener {
|
|||||||
MessageUtil.sanitizeDiscordMarkdown(event.getDeathMessage())),
|
MessageUtil.sanitizeDiscordMarkdown(event.getDeathMessage())),
|
||||||
false,
|
false,
|
||||||
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", event.getEntity().getUniqueId().toString()) : null,
|
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", event.getEntity().getUniqueId().toString()) : null,
|
||||||
jda.getSettings().isShowName() ? event.getEntity().getName() : null,
|
jda.getSettings().isShowName() ? event.getEntity().getName() : (jda.getSettings().isShowDisplayName() ? event.getEntity().getDisplayName() : null),
|
||||||
event.getEntity().getUniqueId());
|
event.getEntity().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ public class BukkitListener implements Listener {
|
|||||||
MessageUtil.sanitizeDiscordMarkdown(event.getAffected().getDisplayName())),
|
MessageUtil.sanitizeDiscordMarkdown(event.getAffected().getDisplayName())),
|
||||||
false,
|
false,
|
||||||
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", event.getAffected().getBase().getUniqueId().toString()) : null,
|
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", event.getAffected().getBase().getUniqueId().toString()) : null,
|
||||||
jda.getSettings().isShowName() ? event.getAffected().getName() : null,
|
jda.getSettings().isShowName() ? event.getAffected().getName() : (jda.getSettings().isShowDisplayName() ? event.getAffected().getDisplayName() : null),
|
||||||
event.getAffected().getBase().getUniqueId());
|
event.getAffected().getBase().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +219,8 @@ public class BukkitListener implements Listener {
|
|||||||
MessageUtil.sanitizeDiscordMarkdown(event.getPlayer().getDisplayName()),
|
MessageUtil.sanitizeDiscordMarkdown(event.getPlayer().getDisplayName()),
|
||||||
event.getName()),
|
event.getName()),
|
||||||
false,
|
false,
|
||||||
jda.getSettings().isShowAvatar() ? AVATAR_URL.replace("{uuid}", event.getPlayer().getUniqueId().toString()) : null,
|
jda.getSettings().isShowAvatar() ? jda.getSettings().getAvatarURL().replace("{uuid}", event.getPlayer().getUniqueId().toString()) : null,
|
||||||
jda.getSettings().isShowName() ? event.getPlayer().getName() : null,
|
jda.getSettings().isShowName() ? event.getPlayer().getName() : (jda.getSettings().isShowDisplayName() ? event.getPlayer().getDisplayName() : null),
|
||||||
event.getPlayer().getUniqueId());
|
event.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +134,9 @@ show-avatar: false
|
|||||||
avatar-url: "https://crafthead.net/helm/{uuid}"
|
avatar-url: "https://crafthead.net/helm/{uuid}"
|
||||||
# Whether or not player messages should show their name as the bot name in Discord.
|
# Whether or not player messages should show their name as the bot name in Discord.
|
||||||
show-name: false
|
show-name: false
|
||||||
|
# Whether or not player messages should show their display-name/nickname as the bot name in Discord.
|
||||||
|
# You must disable show-name for this option to work.
|
||||||
|
show-displayname: false
|
||||||
|
|
||||||
# Whether or not fake join and leave messages should be sent to Discord when a player toggles vanish in Minecraft.
|
# Whether or not fake join and leave messages should be sent to Discord when a player toggles vanish in Minecraft.
|
||||||
# Fake join/leave messages will be sent the same as real join and leave messages (and to the same channel).
|
# Fake join/leave messages will be sent the same as real join and leave messages (and to the same channel).
|
||||||
|
Loading…
Reference in New Issue
Block a user