mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 12:08:17 +00:00
Hardcode EventType.GAME
for ServerLogEvent
This commit is contained in:
parent
52da2c235d
commit
95df9a3162
@ -1,22 +1,24 @@
|
|||||||
package emu.grasscutter.server.event.internal;
|
package emu.grasscutter.server.event.internal;
|
||||||
|
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.core.AppenderBase;
|
|
||||||
import emu.grasscutter.server.event.types.ServerEvent;
|
import emu.grasscutter.server.event.types.ServerEvent;
|
||||||
|
|
||||||
public class ServerLogEvent extends ServerEvent {
|
public final class ServerLogEvent extends ServerEvent {
|
||||||
ILoggingEvent loggingEvent;
|
private final ILoggingEvent loggingEvent;
|
||||||
String consoleMessage;
|
private final String consoleMessage;
|
||||||
|
|
||||||
|
public ServerLogEvent(ILoggingEvent loggingEvent, String consoleMessage) {
|
||||||
|
super(Type.GAME);
|
||||||
|
|
||||||
public ServerLogEvent(Type type, ILoggingEvent loggingEvent, String consoleMessage) {
|
|
||||||
super(type);
|
|
||||||
this.loggingEvent = loggingEvent;
|
this.loggingEvent = loggingEvent;
|
||||||
this.consoleMessage = consoleMessage;
|
this.consoleMessage = consoleMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILoggingEvent getLoggingEvent() { return loggingEvent; }
|
public ILoggingEvent getLoggingEvent() {
|
||||||
|
return this.loggingEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public String getConsoleMessage() {
|
public String getConsoleMessage() {
|
||||||
return consoleMessage;
|
return this.consoleMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,12 @@ public class ServerLogEventAppender<E> extends AppenderBase<E> {
|
|||||||
@Override
|
@Override
|
||||||
protected void append(E event) {
|
protected void append(E event) {
|
||||||
byte[] byteArray = this.encoder.encode(event);
|
byte[] byteArray = this.encoder.encode(event);
|
||||||
ServerLogEvent sle = new ServerLogEvent(ServerEvent.Type.GAME, (ILoggingEvent) event, new String(byteArray, StandardCharsets.UTF_8));
|
ServerLogEvent sle = new ServerLogEvent((ILoggingEvent) event, new String(byteArray, StandardCharsets.UTF_8));
|
||||||
sle.call();
|
sle.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Encoder<E> getEncoder() {
|
public Encoder<E> getEncoder() {
|
||||||
return encoder;
|
return this.encoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEncoder(Encoder<E> encoder) {
|
public void setEncoder(Encoder<E> encoder) {
|
||||||
|
Loading…
Reference in New Issue
Block a user