mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 17:51:13 +00:00
fix: mail
This commit is contained in:
parent
4a6ff4721c
commit
ddafeb9ed3
@ -0,0 +1,547 @@
|
|||||||
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
|
// source: GetAllMailNotify.proto
|
||||||
|
|
||||||
|
package emu.grasscutter.net.proto;
|
||||||
|
|
||||||
|
public final class GetAllMailNotifyOuterClass {
|
||||||
|
private GetAllMailNotifyOuterClass() {}
|
||||||
|
public static void registerAllExtensions(
|
||||||
|
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerAllExtensions(
|
||||||
|
com.google.protobuf.ExtensionRegistry registry) {
|
||||||
|
registerAllExtensions(
|
||||||
|
(com.google.protobuf.ExtensionRegistryLite) registry);
|
||||||
|
}
|
||||||
|
public interface GetAllMailNotifyOrBuilder extends
|
||||||
|
// @@protoc_insertion_point(interface_extends:GetAllMailNotify)
|
||||||
|
com.google.protobuf.MessageOrBuilder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <code>bool is_collected = 6;</code>
|
||||||
|
* @return The isCollected.
|
||||||
|
*/
|
||||||
|
boolean getIsCollected();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* Name: PFHIOOMPNBH
|
||||||
|
* CmdId: 1442
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* Protobuf type {@code GetAllMailNotify}
|
||||||
|
*/
|
||||||
|
public static final class GetAllMailNotify extends
|
||||||
|
com.google.protobuf.GeneratedMessageV3 implements
|
||||||
|
// @@protoc_insertion_point(message_implements:GetAllMailNotify)
|
||||||
|
GetAllMailNotifyOrBuilder {
|
||||||
|
private static final long serialVersionUID = 0L;
|
||||||
|
// Use GetAllMailNotify.newBuilder() to construct.
|
||||||
|
private GetAllMailNotify(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
private GetAllMailNotify() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
@SuppressWarnings({"unused"})
|
||||||
|
protected java.lang.Object newInstance(
|
||||||
|
UnusedPrivateParameter unused) {
|
||||||
|
return new GetAllMailNotify();
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public final com.google.protobuf.UnknownFieldSet
|
||||||
|
getUnknownFields() {
|
||||||
|
return this.unknownFields;
|
||||||
|
}
|
||||||
|
private GetAllMailNotify(
|
||||||
|
com.google.protobuf.CodedInputStream input,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||||
|
this();
|
||||||
|
if (extensionRegistry == null) {
|
||||||
|
throw new java.lang.NullPointerException();
|
||||||
|
}
|
||||||
|
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
|
||||||
|
com.google.protobuf.UnknownFieldSet.newBuilder();
|
||||||
|
try {
|
||||||
|
boolean done = false;
|
||||||
|
while (!done) {
|
||||||
|
int tag = input.readTag();
|
||||||
|
switch (tag) {
|
||||||
|
case 0:
|
||||||
|
done = true;
|
||||||
|
break;
|
||||||
|
case 48: {
|
||||||
|
|
||||||
|
isCollected_ = input.readBool();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
if (!parseUnknownField(
|
||||||
|
input, unknownFields, extensionRegistry, tag)) {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||||
|
throw e.setUnfinishedMessage(this);
|
||||||
|
} catch (java.io.IOException e) {
|
||||||
|
throw new com.google.protobuf.InvalidProtocolBufferException(
|
||||||
|
e).setUnfinishedMessage(this);
|
||||||
|
} finally {
|
||||||
|
this.unknownFields = unknownFields.build();
|
||||||
|
makeExtensionsImmutable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static final com.google.protobuf.Descriptors.Descriptor
|
||||||
|
getDescriptor() {
|
||||||
|
return emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.internal_static_GetAllMailNotify_descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||||
|
internalGetFieldAccessorTable() {
|
||||||
|
return emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.internal_static_GetAllMailNotify_fieldAccessorTable
|
||||||
|
.ensureFieldAccessorsInitialized(
|
||||||
|
emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify.class, emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify.Builder.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int IS_COLLECTED_FIELD_NUMBER = 6;
|
||||||
|
private boolean isCollected_;
|
||||||
|
/**
|
||||||
|
* <code>bool is_collected = 6;</code>
|
||||||
|
* @return The isCollected.
|
||||||
|
*/
|
||||||
|
@java.lang.Override
|
||||||
|
public boolean getIsCollected() {
|
||||||
|
return isCollected_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte memoizedIsInitialized = -1;
|
||||||
|
@java.lang.Override
|
||||||
|
public final boolean isInitialized() {
|
||||||
|
byte isInitialized = memoizedIsInitialized;
|
||||||
|
if (isInitialized == 1) return true;
|
||||||
|
if (isInitialized == 0) return false;
|
||||||
|
|
||||||
|
memoizedIsInitialized = 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||||
|
throws java.io.IOException {
|
||||||
|
if (isCollected_ != false) {
|
||||||
|
output.writeBool(6, isCollected_);
|
||||||
|
}
|
||||||
|
unknownFields.writeTo(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public int getSerializedSize() {
|
||||||
|
int size = memoizedSize;
|
||||||
|
if (size != -1) return size;
|
||||||
|
|
||||||
|
size = 0;
|
||||||
|
if (isCollected_ != false) {
|
||||||
|
size += com.google.protobuf.CodedOutputStream
|
||||||
|
.computeBoolSize(6, isCollected_);
|
||||||
|
}
|
||||||
|
size += unknownFields.getSerializedSize();
|
||||||
|
memoizedSize = size;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public boolean equals(final java.lang.Object obj) {
|
||||||
|
if (obj == this) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify)) {
|
||||||
|
return super.equals(obj);
|
||||||
|
}
|
||||||
|
emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify other = (emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify) obj;
|
||||||
|
|
||||||
|
if (getIsCollected()
|
||||||
|
!= other.getIsCollected()) return false;
|
||||||
|
if (!unknownFields.equals(other.unknownFields)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public int hashCode() {
|
||||||
|
if (memoizedHashCode != 0) {
|
||||||
|
return memoizedHashCode;
|
||||||
|
}
|
||||||
|
int hash = 41;
|
||||||
|
hash = (19 * hash) + getDescriptor().hashCode();
|
||||||
|
hash = (37 * hash) + IS_COLLECTED_FIELD_NUMBER;
|
||||||
|
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
|
||||||
|
getIsCollected());
|
||||||
|
hash = (29 * hash) + unknownFields.hashCode();
|
||||||
|
memoizedHashCode = hash;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(
|
||||||
|
java.nio.ByteBuffer data)
|
||||||
|
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||||
|
return PARSER.parseFrom(data);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(
|
||||||
|
java.nio.ByteBuffer data,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||||
|
return PARSER.parseFrom(data, extensionRegistry);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(
|
||||||
|
com.google.protobuf.ByteString data)
|
||||||
|
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||||
|
return PARSER.parseFrom(data);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(
|
||||||
|
com.google.protobuf.ByteString data,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||||
|
return PARSER.parseFrom(data, extensionRegistry);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(byte[] data)
|
||||||
|
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||||
|
return PARSER.parseFrom(data);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(
|
||||||
|
byte[] data,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||||
|
return PARSER.parseFrom(data, extensionRegistry);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(java.io.InputStream input)
|
||||||
|
throws java.io.IOException {
|
||||||
|
return com.google.protobuf.GeneratedMessageV3
|
||||||
|
.parseWithIOException(PARSER, input);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(
|
||||||
|
java.io.InputStream input,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws java.io.IOException {
|
||||||
|
return com.google.protobuf.GeneratedMessageV3
|
||||||
|
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseDelimitedFrom(java.io.InputStream input)
|
||||||
|
throws java.io.IOException {
|
||||||
|
return com.google.protobuf.GeneratedMessageV3
|
||||||
|
.parseDelimitedWithIOException(PARSER, input);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseDelimitedFrom(
|
||||||
|
java.io.InputStream input,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws java.io.IOException {
|
||||||
|
return com.google.protobuf.GeneratedMessageV3
|
||||||
|
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(
|
||||||
|
com.google.protobuf.CodedInputStream input)
|
||||||
|
throws java.io.IOException {
|
||||||
|
return com.google.protobuf.GeneratedMessageV3
|
||||||
|
.parseWithIOException(PARSER, input);
|
||||||
|
}
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parseFrom(
|
||||||
|
com.google.protobuf.CodedInputStream input,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws java.io.IOException {
|
||||||
|
return com.google.protobuf.GeneratedMessageV3
|
||||||
|
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder newBuilderForType() { return newBuilder(); }
|
||||||
|
public static Builder newBuilder() {
|
||||||
|
return DEFAULT_INSTANCE.toBuilder();
|
||||||
|
}
|
||||||
|
public static Builder newBuilder(emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify prototype) {
|
||||||
|
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return this == DEFAULT_INSTANCE
|
||||||
|
? new Builder() : new Builder().mergeFrom(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
protected Builder newBuilderForType(
|
||||||
|
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
|
||||||
|
Builder builder = new Builder(parent);
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* Name: PFHIOOMPNBH
|
||||||
|
* CmdId: 1442
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* Protobuf type {@code GetAllMailNotify}
|
||||||
|
*/
|
||||||
|
public static final class Builder extends
|
||||||
|
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
|
||||||
|
// @@protoc_insertion_point(builder_implements:GetAllMailNotify)
|
||||||
|
emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotifyOrBuilder {
|
||||||
|
public static final com.google.protobuf.Descriptors.Descriptor
|
||||||
|
getDescriptor() {
|
||||||
|
return emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.internal_static_GetAllMailNotify_descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||||
|
internalGetFieldAccessorTable() {
|
||||||
|
return emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.internal_static_GetAllMailNotify_fieldAccessorTable
|
||||||
|
.ensureFieldAccessorsInitialized(
|
||||||
|
emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify.class, emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify.Builder.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct using emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify.newBuilder()
|
||||||
|
private Builder() {
|
||||||
|
maybeForceBuilderInitialization();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Builder(
|
||||||
|
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
|
||||||
|
super(parent);
|
||||||
|
maybeForceBuilderInitialization();
|
||||||
|
}
|
||||||
|
private void maybeForceBuilderInitialization() {
|
||||||
|
if (com.google.protobuf.GeneratedMessageV3
|
||||||
|
.alwaysUseFieldBuilders) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder clear() {
|
||||||
|
super.clear();
|
||||||
|
isCollected_ = false;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public com.google.protobuf.Descriptors.Descriptor
|
||||||
|
getDescriptorForType() {
|
||||||
|
return emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.internal_static_GetAllMailNotify_descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify getDefaultInstanceForType() {
|
||||||
|
return emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify.getDefaultInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify build() {
|
||||||
|
emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify result = buildPartial();
|
||||||
|
if (!result.isInitialized()) {
|
||||||
|
throw newUninitializedMessageException(result);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify buildPartial() {
|
||||||
|
emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify result = new emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify(this);
|
||||||
|
result.isCollected_ = isCollected_;
|
||||||
|
onBuilt();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder clone() {
|
||||||
|
return super.clone();
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder setField(
|
||||||
|
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||||
|
java.lang.Object value) {
|
||||||
|
return super.setField(field, value);
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder clearField(
|
||||||
|
com.google.protobuf.Descriptors.FieldDescriptor field) {
|
||||||
|
return super.clearField(field);
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder clearOneof(
|
||||||
|
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
|
||||||
|
return super.clearOneof(oneof);
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder setRepeatedField(
|
||||||
|
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||||
|
int index, java.lang.Object value) {
|
||||||
|
return super.setRepeatedField(field, index, value);
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder addRepeatedField(
|
||||||
|
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||||
|
java.lang.Object value) {
|
||||||
|
return super.addRepeatedField(field, value);
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||||
|
if (other instanceof emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify) {
|
||||||
|
return mergeFrom((emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify)other);
|
||||||
|
} else {
|
||||||
|
super.mergeFrom(other);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder mergeFrom(emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify other) {
|
||||||
|
if (other == emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify.getDefaultInstance()) return this;
|
||||||
|
if (other.getIsCollected() != false) {
|
||||||
|
setIsCollected(other.getIsCollected());
|
||||||
|
}
|
||||||
|
this.mergeUnknownFields(other.unknownFields);
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public final boolean isInitialized() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public Builder mergeFrom(
|
||||||
|
com.google.protobuf.CodedInputStream input,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws java.io.IOException {
|
||||||
|
emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify parsedMessage = null;
|
||||||
|
try {
|
||||||
|
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
|
||||||
|
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||||
|
parsedMessage = (emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify) e.getUnfinishedMessage();
|
||||||
|
throw e.unwrapIOException();
|
||||||
|
} finally {
|
||||||
|
if (parsedMessage != null) {
|
||||||
|
mergeFrom(parsedMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCollected_ ;
|
||||||
|
/**
|
||||||
|
* <code>bool is_collected = 6;</code>
|
||||||
|
* @return The isCollected.
|
||||||
|
*/
|
||||||
|
@java.lang.Override
|
||||||
|
public boolean getIsCollected() {
|
||||||
|
return isCollected_;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>bool is_collected = 6;</code>
|
||||||
|
* @param value The isCollected to set.
|
||||||
|
* @return This builder for chaining.
|
||||||
|
*/
|
||||||
|
public Builder setIsCollected(boolean value) {
|
||||||
|
|
||||||
|
isCollected_ = value;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>bool is_collected = 6;</code>
|
||||||
|
* @return This builder for chaining.
|
||||||
|
*/
|
||||||
|
public Builder clearIsCollected() {
|
||||||
|
|
||||||
|
isCollected_ = false;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
@java.lang.Override
|
||||||
|
public final Builder setUnknownFields(
|
||||||
|
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||||
|
return super.setUnknownFields(unknownFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public final Builder mergeUnknownFields(
|
||||||
|
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||||
|
return super.mergeUnknownFields(unknownFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @@protoc_insertion_point(builder_scope:GetAllMailNotify)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @@protoc_insertion_point(class_scope:GetAllMailNotify)
|
||||||
|
private static final emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify DEFAULT_INSTANCE;
|
||||||
|
static {
|
||||||
|
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify getDefaultInstance() {
|
||||||
|
return DEFAULT_INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final com.google.protobuf.Parser<GetAllMailNotify>
|
||||||
|
PARSER = new com.google.protobuf.AbstractParser<GetAllMailNotify>() {
|
||||||
|
@java.lang.Override
|
||||||
|
public GetAllMailNotify parsePartialFrom(
|
||||||
|
com.google.protobuf.CodedInputStream input,
|
||||||
|
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||||
|
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||||
|
return new GetAllMailNotify(input, extensionRegistry);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static com.google.protobuf.Parser<GetAllMailNotify> parser() {
|
||||||
|
return PARSER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public com.google.protobuf.Parser<GetAllMailNotify> getParserForType() {
|
||||||
|
return PARSER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.Override
|
||||||
|
public emu.grasscutter.net.proto.GetAllMailNotifyOuterClass.GetAllMailNotify getDefaultInstanceForType() {
|
||||||
|
return DEFAULT_INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final com.google.protobuf.Descriptors.Descriptor
|
||||||
|
internal_static_GetAllMailNotify_descriptor;
|
||||||
|
private static final
|
||||||
|
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||||
|
internal_static_GetAllMailNotify_fieldAccessorTable;
|
||||||
|
|
||||||
|
public static com.google.protobuf.Descriptors.FileDescriptor
|
||||||
|
getDescriptor() {
|
||||||
|
return descriptor;
|
||||||
|
}
|
||||||
|
private static com.google.protobuf.Descriptors.FileDescriptor
|
||||||
|
descriptor;
|
||||||
|
static {
|
||||||
|
java.lang.String[] descriptorData = {
|
||||||
|
"\n\026GetAllMailNotify.proto\"(\n\020GetAllMailNo" +
|
||||||
|
"tify\022\024\n\014is_collected\030\006 \001(\010B\033\n\031emu.grassc" +
|
||||||
|
"utter.net.protob\006proto3"
|
||||||
|
};
|
||||||
|
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||||
|
.internalBuildGeneratedFileFrom(descriptorData,
|
||||||
|
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||||
|
});
|
||||||
|
internal_static_GetAllMailNotify_descriptor =
|
||||||
|
getDescriptor().getMessageTypes().get(0);
|
||||||
|
internal_static_GetAllMailNotify_fieldAccessorTable = new
|
||||||
|
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||||
|
internal_static_GetAllMailNotify_descriptor,
|
||||||
|
new java.lang.String[] { "IsCollected", });
|
||||||
|
}
|
||||||
|
|
||||||
|
// @@protoc_insertion_point(outer_class_scope)
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -6,13 +6,14 @@ import dev.morphia.annotations.Indexed;
|
|||||||
import dev.morphia.annotations.Transient;
|
import dev.morphia.annotations.Transient;
|
||||||
import emu.grasscutter.database.DatabaseHelper;
|
import emu.grasscutter.database.DatabaseHelper;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
|
import emu.grasscutter.net.proto.*;
|
||||||
|
import emu.grasscutter.utils.Utils;
|
||||||
|
import org.bson.types.ObjectId;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bson.types.ObjectId;
|
|
||||||
|
|
||||||
@Entity(value = "mail", useDiscriminator = false)
|
@Entity(value = "mail", useDiscriminator = false)
|
||||||
public class Mail {
|
public class Mail {
|
||||||
@Id private ObjectId id;
|
@Id private ObjectId id;
|
||||||
@ -51,18 +52,32 @@ public class Mail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ObjectId getId() {
|
public ObjectId getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOwnerUid() {
|
public int getOwnerUid() {
|
||||||
return ownerUid;
|
return ownerUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOwnerUid(int ownerUid) {
|
public void setOwnerUid(int ownerUid) {
|
||||||
this.ownerUid = ownerUid;
|
this.ownerUid = ownerUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
public MailDataOuterClass.MailData toProto(Player player) {
|
||||||
|
return MailDataOuterClass.MailData.newBuilder()
|
||||||
|
.setMailId(player.getMailId(this))
|
||||||
|
.setMailTextContent(this.mailContent.toProto())
|
||||||
|
.addAllItemList(this.itemList.stream().map(MailItem::toProto).toList())
|
||||||
|
.setSendTime((int) this.sendTime)
|
||||||
|
.setExpireTime((int) this.expireTime)
|
||||||
|
.setImportance(this.importance)
|
||||||
|
.setIsRead(this.isRead)
|
||||||
|
.setIsAttachmentGot(this.isAttachmentGot)
|
||||||
|
.setCollectState(MailCollectStateOuterClass.MailCollectState.MAIL_COLLECT_STATE_NOT_COLLECTIBLE)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity
|
||||||
public static class MailContent {
|
public static class MailContent {
|
||||||
public String title;
|
public String title;
|
||||||
public String content;
|
public String content;
|
||||||
@ -87,6 +102,14 @@ public class Mail {
|
|||||||
this.content = content;
|
this.content = content;
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MailTextContentOuterClass.MailTextContent toProto() {
|
||||||
|
return MailTextContentOuterClass.MailTextContent.newBuilder()
|
||||||
|
.setTitle(this.title)
|
||||||
|
.setContent(this.content)
|
||||||
|
.setSender(this.sender)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@ -105,13 +128,25 @@ public class Mail {
|
|||||||
this(itemId, 1);
|
this(itemId, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailItem(int itemId, int itemCount) { this(itemId, itemCount, 1); }
|
public MailItem(int itemId, int itemCount) {
|
||||||
|
this(itemId, itemCount, 1);
|
||||||
|
}
|
||||||
|
|
||||||
public MailItem(int itemId, int itemCount, int itemLevel) {
|
public MailItem(int itemId, int itemCount, int itemLevel) {
|
||||||
this.itemId = itemId;
|
this.itemId = itemId;
|
||||||
this.itemCount = itemCount;
|
this.itemCount = itemCount;
|
||||||
this.itemLevel = itemLevel;
|
this.itemLevel = itemLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MailItemOuterClass.MailItem toProto() {
|
||||||
|
return MailItemOuterClass.MailItem.newBuilder()
|
||||||
|
.setEquipParam(Utils.make(() -> EquipParamOuterClass.EquipParam.newBuilder()
|
||||||
|
.setItemId(this.itemId)
|
||||||
|
.setItemNum(this.itemCount)
|
||||||
|
.setItemLevel(this.itemLevel)
|
||||||
|
.setPromoteLevel(0)//mock
|
||||||
|
.build())).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
|
@ -577,8 +577,6 @@ public class PacketOpcodes {
|
|||||||
public static final int GetAllActivatedBargainDataRsp = 457;
|
public static final int GetAllActivatedBargainDataRsp = 457;
|
||||||
public static final int GetAllH5ActivityInfoReq = 5693;
|
public static final int GetAllH5ActivityInfoReq = 5693;
|
||||||
public static final int GetAllH5ActivityInfoRsp = 5698;
|
public static final int GetAllH5ActivityInfoRsp = 5698;
|
||||||
public static final int GetAllMailReq = 1459;
|
|
||||||
public static final int GetAllMailRsp = 1407;
|
|
||||||
public static final int GetAllSceneGalleryInfoReq = 5572;
|
public static final int GetAllSceneGalleryInfoReq = 5572;
|
||||||
public static final int GetAllSceneGalleryInfoRsp = 5582;
|
public static final int GetAllSceneGalleryInfoRsp = 5582;
|
||||||
public static final int GetAllUnlockNameCardReq = 4046;
|
public static final int GetAllUnlockNameCardReq = 4046;
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
package emu.grasscutter.server.packet.recv;
|
||||||
|
|
||||||
|
import emu.grasscutter.game.player.Player;
|
||||||
|
import emu.grasscutter.net.packet.Opcodes;
|
||||||
|
import emu.grasscutter.net.packet.PacketHandler;
|
||||||
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
|
import emu.grasscutter.net.proto.GetAllMailNotifyOuterClass;
|
||||||
|
import emu.grasscutter.server.game.GameSession;
|
||||||
|
import emu.grasscutter.server.packet.send.PacketGetAllMailResultNotify;
|
||||||
|
import emu.grasscutter.utils.Utils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
@Opcodes(PacketOpcodes.GetAllMailNotify)
|
||||||
|
public class HandlerGetAllMailNotify extends PacketHandler {
|
||||||
|
private static final int MAX_MAIL_DATA_NUM_PER_PACKET = 40;
|
||||||
|
|
||||||
|
private static void subdivide(Player player) {
|
||||||
|
var notGiftedMails = player.getAllMail().stream().filter(mail -> mail.stateValue == 1).toList();
|
||||||
|
var packetsBeSent = notGiftedMails.size() / MAX_MAIL_DATA_NUM_PER_PACKET + 1;
|
||||||
|
var curPacketNum = new AtomicInteger(1);
|
||||||
|
for (int i = 0; i < packetsBeSent; i++) {
|
||||||
|
player.sendPacket(new PacketGetAllMailResultNotify(packetsBeSent, curPacketNum.get(), Utils.make(() -> {
|
||||||
|
var index = (curPacketNum.get() - 1) * MAX_MAIL_DATA_NUM_PER_PACKET;
|
||||||
|
return notGiftedMails.subList(index, curPacketNum.get() == packetsBeSent ? notGiftedMails.size() - 1 : index + MAX_MAIL_DATA_NUM_PER_PACKET - 1);
|
||||||
|
}).stream().map(mail -> mail.toProto(player)).toList(), createTransaction(player), false));
|
||||||
|
curPacketNum.incrementAndGet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String createTransaction(Player player) {
|
||||||
|
return player.getUid() + "-" + Utils.getCurrentSeconds() + "-" + 0;//mock
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||||
|
var req = GetAllMailNotifyOuterClass.GetAllMailNotify.parseFrom(payload);
|
||||||
|
var gift = req.getIsCollected();
|
||||||
|
if (gift) {
|
||||||
|
session.send(new PacketGetAllMailResultNotify(1, 1, List.of(), "", true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
subdivide(session.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +0,0 @@
|
|||||||
package emu.grasscutter.server.packet.recv;
|
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
|
||||||
import emu.grasscutter.net.packet.Opcodes;
|
|
||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
|
||||||
import emu.grasscutter.net.packet.PacketHandler;
|
|
||||||
import emu.grasscutter.net.proto.GetAllMailReqOuterClass;
|
|
||||||
import emu.grasscutter.net.proto.GetPlayerTokenReqOuterClass;
|
|
||||||
import emu.grasscutter.server.game.GameSession;
|
|
||||||
import emu.grasscutter.server.packet.send.PacketGetAllMailRsp;
|
|
||||||
import emu.grasscutter.server.packet.send.PacketGetGachaInfoRsp;
|
|
||||||
|
|
||||||
@Opcodes(PacketOpcodes.GetAllMailReq)
|
|
||||||
public class HandlerGetAllMailReq extends PacketHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
|
||||||
GetAllMailReqOuterClass.GetAllMailReq req = GetAllMailReqOuterClass.GetAllMailReq.parseFrom(payload);
|
|
||||||
session.send(new PacketGetAllMailRsp(session.getPlayer(), req.getIsCollected()));
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,22 @@
|
|||||||
|
package emu.grasscutter.server.packet.send;
|
||||||
|
|
||||||
|
import emu.grasscutter.net.packet.BasePacket;
|
||||||
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
|
import emu.grasscutter.net.proto.GetAllMailResultNotifyOuterClass;
|
||||||
|
import emu.grasscutter.net.proto.MailDataOuterClass;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PacketGetAllMailResultNotify extends BasePacket {
|
||||||
|
public PacketGetAllMailResultNotify(int packetBeSentNum, int packetNum, List<MailDataOuterClass.MailData> mailData, String transaction, boolean isGift) {
|
||||||
|
super(PacketOpcodes.GetAllMailResultNotify);
|
||||||
|
|
||||||
|
this.setData(GetAllMailResultNotifyOuterClass.GetAllMailResultNotify.newBuilder()
|
||||||
|
.setPacketBeSentNum(packetBeSentNum)
|
||||||
|
.addAllMailList(mailData)
|
||||||
|
.setTransaction(transaction)
|
||||||
|
.setIsCollected(isGift)
|
||||||
|
.setPacketNum(packetNum)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
@ -1,78 +0,0 @@
|
|||||||
package emu.grasscutter.server.packet.send;
|
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
|
||||||
import emu.grasscutter.game.mail.Mail;
|
|
||||||
import emu.grasscutter.game.player.Player;
|
|
||||||
import emu.grasscutter.net.packet.BasePacket;
|
|
||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
|
||||||
import emu.grasscutter.net.proto.EquipParamOuterClass;
|
|
||||||
import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp;
|
|
||||||
import emu.grasscutter.net.proto.ItemParamOuterClass;
|
|
||||||
import emu.grasscutter.net.proto.MailDataOuterClass;
|
|
||||||
import emu.grasscutter.net.proto.MailDataOuterClass.MailData;
|
|
||||||
import emu.grasscutter.net.proto.MailItemOuterClass;
|
|
||||||
import emu.grasscutter.net.proto.MailTextContentOuterClass.MailTextContent;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PacketGetAllMailRsp extends BasePacket {
|
|
||||||
|
|
||||||
public PacketGetAllMailRsp(Player player, boolean isGiftMail) {
|
|
||||||
super(PacketOpcodes.GetAllMailRsp);
|
|
||||||
GetAllMailRsp.Builder proto = GetAllMailRsp.newBuilder();
|
|
||||||
|
|
||||||
if (isGiftMail) {
|
|
||||||
proto.setIsCollected(true);
|
|
||||||
} else {
|
|
||||||
proto.setIsCollected(false);
|
|
||||||
|
|
||||||
if (player.getAllMail().size() != 0) { // Make sure the player has mail
|
|
||||||
List<MailData> mailDataList = new ArrayList<MailData>();
|
|
||||||
|
|
||||||
for (Mail message : player.getAllMail()) {
|
|
||||||
if (message.stateValue == 1) { // Make sure it isn't a gift
|
|
||||||
if (message.expireTime > (int) Instant.now().getEpochSecond()) { // Make sure the message isn't expired (The game won't show expired mail, but I don't want to send unnecessary information).
|
|
||||||
if (mailDataList.size() <= 1000) { // Make sure that there isn't over 1000 messages in the mailbox. (idk what will happen if there is but the game probably won't like it.)
|
|
||||||
MailTextContent.Builder mailTextContent = MailTextContent.newBuilder();
|
|
||||||
mailTextContent.setTitle(message.mailContent.title);
|
|
||||||
mailTextContent.setContent(message.mailContent.content);
|
|
||||||
mailTextContent.setSender(message.mailContent.sender);
|
|
||||||
|
|
||||||
List<MailItemOuterClass.MailItem> mailItems = new ArrayList<>();
|
|
||||||
|
|
||||||
for (Mail.MailItem item : message.itemList) {
|
|
||||||
MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder();
|
|
||||||
EquipParamOuterClass.EquipParam.Builder itemParam = EquipParamOuterClass.EquipParam.newBuilder();
|
|
||||||
itemParam.setItemId(item.itemId);
|
|
||||||
itemParam.setItemNum(item.itemCount);
|
|
||||||
mailItem.setEquipParam(itemParam.build());
|
|
||||||
|
|
||||||
mailItems.add(mailItem.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
MailDataOuterClass.MailData.Builder mailData = MailDataOuterClass.MailData.newBuilder();
|
|
||||||
mailData.setMailId(player.getMailId(message));
|
|
||||||
mailData.setMailTextContent(mailTextContent.build());
|
|
||||||
mailData.addAllItemList(mailItems);
|
|
||||||
mailData.setSendTime((int) message.sendTime);
|
|
||||||
mailData.setExpireTime((int) message.expireTime);
|
|
||||||
mailData.setImportance(message.importance);
|
|
||||||
mailData.setIsRead(message.isRead);
|
|
||||||
mailData.setIsAttachmentGot(message.isAttachmentGot);
|
|
||||||
mailData.setCollectStateValue(1);
|
|
||||||
|
|
||||||
mailDataList.add(mailData.build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
proto.addAllMailList(mailDataList);
|
|
||||||
proto.setIsTruncated(mailDataList.size() > 1000); // When enabled this will send a notification to the user telling them their inbox is full and they should delete old messages when opening the mailbox.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.setData(proto.build());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +1,5 @@
|
|||||||
package emu.grasscutter.utils;
|
package emu.grasscutter.utils;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.StandardCopyOption;
|
|
||||||
import java.time.*;
|
|
||||||
import java.time.temporal.TemporalAdjusters;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.config.ConfigContainer;
|
import emu.grasscutter.config.ConfigContainer;
|
||||||
import emu.grasscutter.data.DataLoader;
|
import emu.grasscutter.data.DataLoader;
|
||||||
@ -17,10 +8,21 @@ import io.netty.buffer.ByteBufUtil;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.time.DayOfWeek;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.temporal.TemporalAdjusters;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import static emu.grasscutter.utils.FileUtils.getResourcePath;
|
import static emu.grasscutter.utils.FileUtils.getResourcePath;
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
@ -29,6 +31,10 @@ import static emu.grasscutter.utils.Language.translate;
|
|||||||
public final class Utils {
|
public final class Utils {
|
||||||
public static final Random random = new Random();
|
public static final Random random = new Random();
|
||||||
|
|
||||||
|
public static <T> T make(Supplier<T> factory) {
|
||||||
|
return factory.get();
|
||||||
|
}
|
||||||
|
|
||||||
public static int randomRange(int min, int max) {
|
public static int randomRange(int min, int max) {
|
||||||
return random.nextInt(max - min + 1) + min;
|
return random.nextInt(max - min + 1) + min;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user