Support plugin source for dynmap chat (Closes #242)

This commit is contained in:
James Lyne 2021-11-12 00:12:17 +00:00
parent f7fb22cd38
commit 8a66d05139
2 changed files with 17 additions and 1 deletions

View File

@ -17,6 +17,7 @@
<template> <template>
<li :class="`message message--${message.type}`"> <li :class="`message message--${message.type}`">
<img v-if="showFace" width="16" height="16" class="message__face" :src="image" alt="" /> <img v-if="showFace" width="16" height="16" class="message__face" :src="image" alt="" />
<span v-if="messageChannel" class="message__channel" v-html="messageChannel"></span>
<span v-if="showSender" class="message__sender" v-html="message.playerName"></span> <span v-if="showSender" class="message__sender" v-html="message.playerName"></span>
<span class="message__content" v-html="messageContent"></span> <span class="message__content" v-html="messageContent"></span>
</li> </li>
@ -41,6 +42,7 @@
let image = ref(defaultImage), let image = ref(defaultImage),
showFace = computed(() => store.state.components.chatBox?.showPlayerFaces && props.message.playerAccount), showFace = computed(() => store.state.components.chatBox?.showPlayerFaces && props.message.playerAccount),
showSender = computed(() => props.message.playerName && props.message.type === 'chat'), showSender = computed(() => props.message.playerName && props.message.type === 'chat'),
messageChannel = computed(() => props.message.type === 'chat' ? props.message.channel : undefined),
messageContent = computed(() => { messageContent = computed(() => {
switch(props.message.type) { switch(props.message.type) {
case 'chat': case 'chat':
@ -73,6 +75,7 @@
image, image,
showFace, showFace,
showSender, showSender,
messageChannel,
messageContent messageContent
} }
} }
@ -87,10 +90,23 @@
margin-right: 0.5rem; margin-right: 0.5rem;
} }
.message__channel,
.message__sender { .message__sender {
margin-right: 0.5rem; margin-right: 0.5rem;
word-wrap: break-word; word-wrap: break-word;
}
.message__channel {
&:not(:empty):before {
content: '[';
}
&:not(:empty):after {
content: ']';
}
}
.message__sender {
&:not(:empty):after { &:not(:empty):after {
content: ': '; content: ': ';
} }

View File

@ -487,7 +487,7 @@ export function buildUpdates(data: Array<any>, lastUpdate: Date) {
continue; continue;
} }
if (entry.source !== 'player' && entry.source !== 'web') { if (entry.source !== 'player' && entry.source !== 'web' && entry.source !== 'plugin') {
dropped.notImplemented++; dropped.notImplemented++;
continue; continue;
} }