mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-21 19:34:42 +01:00
Revert final's added by 15e2f3ca34 (#2144)
* Revert final's added by 15e2f3ca34
* Apply suggestions from code review
Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
---------
Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
package emu.grasscutter.server.http.documentation;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.DOCUMENT_LANGUAGE;
|
||||
|
||||
import emu.grasscutter.tools.Tools;
|
||||
import emu.grasscutter.utils.Language;
|
||||
import io.javalin.http.ContentType;
|
||||
import io.javalin.http.Context;
|
||||
import java.util.List;
|
||||
|
||||
final class GachaMappingRequestHandler implements DocumentationHandler {
|
||||
private final List<String> gachaJsons;
|
||||
|
||||
GachaMappingRequestHandler() {
|
||||
this.gachaJsons = Tools.createGachaMappingJsons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Context ctx) {
|
||||
final int langIdx =
|
||||
Language.TextStrings.MAP_LANGUAGES.getOrDefault(
|
||||
DOCUMENT_LANGUAGE,
|
||||
0); // TODO: This should really be based off the client language somehow
|
||||
ctx.contentType(ContentType.APPLICATION_JSON).result(gachaJsons.get(langIdx));
|
||||
}
|
||||
}
|
||||
package emu.grasscutter.server.http.documentation;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.DOCUMENT_LANGUAGE;
|
||||
|
||||
import emu.grasscutter.tools.Tools;
|
||||
import emu.grasscutter.utils.Language;
|
||||
import io.javalin.http.ContentType;
|
||||
import io.javalin.http.Context;
|
||||
import java.util.List;
|
||||
|
||||
final class GachaMappingRequestHandler implements DocumentationHandler {
|
||||
private final List<String> gachaJsons;
|
||||
|
||||
GachaMappingRequestHandler() {
|
||||
this.gachaJsons = Tools.createGachaMappingJsons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Context ctx) {
|
||||
final int langIdx =
|
||||
Language.TextStrings.MAP_LANGUAGES.getOrDefault(
|
||||
DOCUMENT_LANGUAGE,
|
||||
0); // TODO: This should really be based off the client language somehow
|
||||
ctx.contentType(ContentType.APPLICATION_JSON).result(gachaJsons.get(langIdx));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo;
|
||||
import emu.grasscutter.net.proto.PrivateChatNotifyOuterClass.PrivateChatNotify;
|
||||
|
||||
public class PacketPrivateChatNotify extends BasePacket {
|
||||
private final ChatInfo info;
|
||||
|
||||
public PacketPrivateChatNotify(int senderId, int recvId, String message) {
|
||||
super(PacketOpcodes.PrivateChatNotify);
|
||||
|
||||
ChatInfo info =
|
||||
ChatInfo.newBuilder()
|
||||
.setTime((int) (System.currentTimeMillis() / 1000))
|
||||
.setUid(senderId)
|
||||
.setToUid(recvId)
|
||||
.setText(message)
|
||||
.build();
|
||||
this.info = info;
|
||||
|
||||
PrivateChatNotify proto = PrivateChatNotify.newBuilder().setChatInfo(info).build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public PacketPrivateChatNotify(int senderId, int recvId, int emote) {
|
||||
super(PacketOpcodes.PrivateChatNotify);
|
||||
|
||||
ChatInfo info =
|
||||
ChatInfo.newBuilder()
|
||||
.setTime((int) (System.currentTimeMillis() / 1000))
|
||||
.setUid(senderId)
|
||||
.setToUid(recvId)
|
||||
.setIcon(emote)
|
||||
.build();
|
||||
this.info = info;
|
||||
|
||||
PrivateChatNotify proto = PrivateChatNotify.newBuilder().setChatInfo(info).build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public ChatInfo getChatInfo() {
|
||||
return this.info;
|
||||
}
|
||||
}
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo;
|
||||
import emu.grasscutter.net.proto.PrivateChatNotifyOuterClass.PrivateChatNotify;
|
||||
|
||||
public class PacketPrivateChatNotify extends BasePacket {
|
||||
private final ChatInfo info;
|
||||
|
||||
public PacketPrivateChatNotify(int senderId, int recvId, String message) {
|
||||
super(PacketOpcodes.PrivateChatNotify);
|
||||
|
||||
ChatInfo info =
|
||||
ChatInfo.newBuilder()
|
||||
.setTime((int) (System.currentTimeMillis() / 1000))
|
||||
.setUid(senderId)
|
||||
.setToUid(recvId)
|
||||
.setText(message)
|
||||
.build();
|
||||
this.info = info;
|
||||
|
||||
PrivateChatNotify proto = PrivateChatNotify.newBuilder().setChatInfo(info).build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public PacketPrivateChatNotify(int senderId, int recvId, int emote) {
|
||||
super(PacketOpcodes.PrivateChatNotify);
|
||||
|
||||
ChatInfo info =
|
||||
ChatInfo.newBuilder()
|
||||
.setTime((int) (System.currentTimeMillis() / 1000))
|
||||
.setUid(senderId)
|
||||
.setToUid(recvId)
|
||||
.setIcon(emote)
|
||||
.build();
|
||||
this.info = info;
|
||||
|
||||
PrivateChatNotify proto = PrivateChatNotify.newBuilder().setChatInfo(info).build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public ChatInfo getChatInfo() {
|
||||
return this.info;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user