Compare commits

...

70 Commits

Author SHA1 Message Date
Breno A.
a7f1012621
Merge 0e7e165dff into 9c36daa3fa 2024-11-23 18:36:59 +01:00
Emmanuel Ferdman
9c36daa3fa
Update code of conduct reference (#2535)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2024-11-23 12:26:50 -05:00
Breno A
0e7e165dff
Merge pull request #8 from brenoepics/dependabot/gradle/org.slf4j-slf4j-api-2.0.13
chore(deps): bump org.slf4j:slf4j-api from 2.0.7 to 2.0.13
2024-06-10 07:52:53 -03:00
dependabot[bot]
ab5824bb92
chore(deps): bump org.slf4j:slf4j-api from 2.0.7 to 2.0.13
Bumps org.slf4j:slf4j-api from 2.0.7 to 2.0.13.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 10:52:31 +00:00
Breno A
c77aa520fb
Merge pull request #7 from brenoepics/dependabot/gradle/org.java-websocket-Java-WebSocket-1.5.6
chore(deps): bump org.java-websocket:Java-WebSocket from 1.5.2 to 1.5.6
2024-06-10 07:52:04 -03:00
Breno A
a0922ff222
Merge pull request #9 from brenoepics/dependabot/gradle/ch.qos.logback-logback-core-1.5.6
chore(deps): bump ch.qos.logback:logback-core from 1.4.7 to 1.5.6
2024-06-10 07:51:28 -03:00
dependabot[bot]
0819435275
chore(deps): bump ch.qos.logback:logback-core from 1.4.7 to 1.5.6
Bumps [ch.qos.logback:logback-core](https://github.com/qos-ch/logback) from 1.4.7 to 1.5.6.
- [Commits](https://github.com/qos-ch/logback/compare/v_1.4.7...v_1.5.6)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 06:31:38 +00:00
dependabot[bot]
011549f2ce
chore(deps): bump org.java-websocket:Java-WebSocket from 1.5.2 to 1.5.6
Bumps [org.java-websocket:Java-WebSocket](https://github.com/TooTallNate/Java-WebSocket) from 1.5.2 to 1.5.6.
- [Release notes](https://github.com/TooTallNate/Java-WebSocket/releases)
- [Changelog](https://github.com/TooTallNate/Java-WebSocket/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TooTallNate/Java-WebSocket/compare/v1.5.2...v1.5.6)

---
updated-dependencies:
- dependency-name: org.java-websocket:Java-WebSocket
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 06:31:32 +00:00
Breno A
cd48328f59
Merge pull request #4 from brenoepics/dependabot/gradle/org.junit.jupiter-junit-jupiter-engine-5.10.2
chore(deps): bump org.junit.jupiter:junit-jupiter-engine from 5.8.2 to 5.10.2
2024-06-09 13:22:16 -03:00
Breno A
a05d6cdc2f
Merge pull request #3 from brenoepics/dependabot/gradle/org.jline-jline-terminal-jna-3.26.1
chore(deps): bump org.jline:jline-terminal-jna from 3.21.0 to 3.26.1
2024-06-09 13:22:06 -03:00
Breno A
22c7f3c45f
Merge pull request #2 from brenoepics/dependabot/gradle/com.fasterxml.jackson-jackson-bom-2.17.1
chore(deps): bump com.fasterxml.jackson:jackson-bom from 2.14.0 to 2.17.1
2024-06-09 13:21:53 -03:00
Breno A
fa283d8d17
Merge pull request #1 from brenoepics/dependabot/gradle/com.google.protobuf-protoc-4.27.1
chore(deps): bump com.google.protobuf:protoc from 3.18.1 to 4.27.1
2024-06-09 13:21:38 -03:00
github-actions
0736956317 Format code [skip actions] 2024-06-09 16:08:43 +00:00
Breno A.
75d8ed0777 Merge branch 'development' of https://github.com/brenoepics/Grasscutter into development 2024-06-09 13:07:04 -03:00
Breno A.
63fbe66158 security: add secure mode and padding scheme 2024-06-09 13:06:59 -03:00
dependabot[bot]
ff2aeac9a5
chore(deps): bump org.junit.jupiter:junit-jupiter-engine
Bumps [org.junit.jupiter:junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.8.2 to 5.10.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.8.2...r5.10.2)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-09 15:27:08 +00:00
dependabot[bot]
bbec09d444
chore(deps): bump org.jline:jline-terminal-jna from 3.21.0 to 3.26.1
Bumps [org.jline:jline-terminal-jna](https://github.com/jline/jline3) from 3.21.0 to 3.26.1.
- [Release notes](https://github.com/jline/jline3/releases)
- [Changelog](https://github.com/jline/jline3/blob/master/changelog.md)
- [Commits](https://github.com/jline/jline3/compare/jline-parent-3.21.0...jline-parent-3.26.1)

---
updated-dependencies:
- dependency-name: org.jline:jline-terminal-jna
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-09 15:27:04 +00:00
dependabot[bot]
52b7ca6b09
chore(deps): bump com.fasterxml.jackson:jackson-bom
Bumps [com.fasterxml.jackson:jackson-bom](https://github.com/FasterXML/jackson-bom) from 2.14.0 to 2.17.1.
- [Commits](https://github.com/FasterXML/jackson-bom/compare/jackson-bom-2.14.0...jackson-bom-2.17.1)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson:jackson-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-09 15:27:00 +00:00
dependabot[bot]
62d53f37ea
chore(deps): bump com.google.protobuf:protoc from 3.18.1 to 4.27.1
Bumps [com.google.protobuf:protoc](https://github.com/protocolbuffers/protobuf) from 3.18.1 to 4.27.1.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

---
updated-dependencies:
- dependency-name: com.google.protobuf:protoc
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-09 15:26:57 +00:00
Breno A
1234d184c8
ci: Create dependabot.yml 2024-06-09 12:26:04 -03:00
Breno A.
c313939ec0 Merge branch 'development' of https://github.com/brenoepics/Grasscutter into development 2024-06-09 12:23:05 -03:00
Breno A.
dbb4f857ef ci: bump actions 2024-06-09 12:22:37 -03:00
github-actions
2bb2da44bc Format code [skip actions] 2024-06-09 15:12:09 +00:00
Breno A.
bfc2c7c096 refactor: fix lombok 2024-06-09 12:09:50 -03:00
github-actions
8c53f2b679 Format code [skip actions] 2024-06-09 13:49:49 +00:00
Breno A.
d4ce7aac08 refactor: fix nullable params 2024-06-09 10:26:58 -03:00
Breno A.
3b68645330 refactor: number comparison 2024-06-09 10:09:59 -03:00
Breno A.
db280387ba chore: fix codestyle indentation 2024-06-09 10:06:57 -03:00
Breno A.
809009f96c refactor: null check is not necessary, we have instanceof 2024-06-09 10:02:56 -03:00
Breno A.
45bf5edb13 perf: stream api can be simplified here 2024-06-09 10:01:03 -03:00
Breno A.
3d00abcc91 perf: we can just equalsIgnoreCase 2024-06-09 10:00:07 -03:00
Breno A.
85ca8777c9 perf: remove redundant collection operation 2024-06-09 09:59:16 -03:00
Breno A.
8f8a6a7bfe perf: simplify optional chain 2024-06-09 09:58:25 -03:00
Breno A.
f01da54eaa perf: size cannot be negative 2024-06-09 09:57:41 -03:00
Breno A.
4b03304cdc perf: this is just Math.min 2024-06-09 09:56:58 -03:00
Breno A.
dd9f59fbfc refactor(lombok): add Setter where possible 2024-06-09 09:55:51 -03:00
Breno A.
8f4120fcd3 refactor(lombok): add Getter where possible 2024-06-09 09:52:49 -03:00
Breno A.
7ee644c794 perf: add Serial annotation here 2024-06-09 09:46:29 -03:00
Breno A.
aeadf6bba7 perf: equals "" can be isEmpty here 2024-06-09 09:45:05 -03:00
Breno A.
1e2ccc9fc6 perf: we can chain append here 2024-06-09 09:44:23 -03:00
Breno A.
1424405c64 perf: fix redundant addAll 2024-06-09 09:43:31 -03:00
Breno A.
33d5c5238a perf: findAny().isPresent() is cleaner here 2024-06-09 09:42:43 -03:00
Breno A.
b7735295f1 perf: count > 0 can be anyMatch 2024-06-09 09:42:06 -03:00
Breno A.
e4123f47d6 perf: class initializer may be static 2024-06-09 09:39:46 -03:00
Breno A.
4f1ad7b576 perf: Call to 'asList()' with only one argument 2024-06-09 09:39:21 -03:00
Breno A.
6e3b3b20a0 refactor: implicit cast from double to float may be lossy 2024-06-09 09:38:33 -03:00
Breno A.
d5ad077ce1 fix: integer division in floating point 2024-06-09 09:37:06 -03:00
Breno A.
6e7418a89d refactor: replace concatenation log with parameterized 2024-06-09 09:35:38 -03:00
Breno A.
77e246213f refactor: fix javadoc issues 2024-06-09 09:33:59 -03:00
Breno A.
c9b42a6dfb refactor: replace switch with enhanced switch 2024-06-09 09:25:14 -03:00
Breno A.
7db8b6f0c7 refactor: Integer.ParseInt is more appropriate here 2024-06-09 09:20:19 -03:00
Breno A.
6d669bd47a refactor: Integer.ParseInt is more appropriate here 2024-06-09 09:19:41 -03:00
Breno A.
bb82e21c82 refactor: replace for loop with enhanced loop 2024-06-09 09:18:48 -03:00
Breno A.
b5d0afd0fe refactor: we don't need explicit types here 2024-06-09 09:17:05 -03:00
Breno A.
fcd409320d refactor: replace statement with expression lambda 2024-06-09 09:15:22 -03:00
Breno A.
c7119aae68 refactor: simplify map operations
we can use computeIfAbsent here
2024-06-09 09:13:18 -03:00
Breno A.
3119e0fffc refactor: replace lambda with method reference 2024-06-09 09:11:58 -03:00
Breno A.
870085fc91 refactor: replace lambda with method reference 2024-06-09 09:10:48 -03:00
Breno A.
8c35c89bf5 refactor: replace Collections.sort with list.sort
Collections.sort is just a wrapper, so it is better to use an instance method directly.
2024-06-09 09:09:45 -03:00
Breno A.
9c946e9d2e chore: remove unused import 2024-06-09 09:07:54 -03:00
Breno A.
427a1cf5f5 fix: variable is assigned to itself 2024-06-09 09:06:12 -03:00
Breno A.
0161b4d73d refactor: replace protected with private for final class 2024-06-09 09:04:26 -03:00
Breno A.
ca6ddfd2cc refactor: replace protected with private for final class 2024-06-09 09:03:50 -03:00
Breno A.
7d3abb083b refactor: this can also be final 2024-06-09 09:00:39 -03:00
Breno A.
9fa0f2bcad refactor: unwrap redundant code block 2024-06-09 08:58:01 -03:00
Breno A.
029ef823e1 refactor: remove unnecessary semicolons 2024-06-09 08:56:58 -03:00
Breno A.
c3eafba072 refactor: remove unnecessary toString call 2024-06-09 08:55:58 -03:00
Breno A.
ef58ab3e5a refactor: replace size() == 0 with isEmpty() 2024-06-09 08:54:37 -03:00
Breno A.
da61d30f44 refactor: make getGoodsLimit one liner 2024-06-09 08:50:40 -03:00
Breno A.
6bb349d92b fix: make those fields final 2024-06-09 08:47:56 -03:00
365 changed files with 1769 additions and 3012 deletions

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "gradle" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

View File

@ -20,9 +20,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
distribution: temurin distribution: temurin
java-version: '17' java-version: '17'
@ -44,7 +44,7 @@ jobs:
- name: Run Gradle - name: Run Gradle
run: ./gradlew -PskipHandbook=1 && ./gradlew jar -PskipHandbook=1 run: ./gradlew -PskipHandbook=1 && ./gradlew jar -PskipHandbook=1
- name: Upload build - name: Upload build
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: Grasscutter name: Grasscutter
path: grasscutter-*.jar path: grasscutter-*.jar

View File

@ -76,13 +76,13 @@ dependencies {
implementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.8' implementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.8'
// Logging libraries. // Logging libraries.
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.7' implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.13'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.4.7' implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.5.6'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.7' implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.7'
// Line reading libraries. // Line reading libraries.
implementation group: 'org.jline', name: 'jline', version: '3.21.0' implementation group: 'org.jline', name: 'jline', version: '3.21.0'
implementation group: 'org.jline', name: 'jline-terminal-jna', version: '3.21.0' implementation group: 'org.jline', name: 'jline-terminal-jna', version: '3.26.1'
implementation group: 'net.java.dev.jna', name: 'jna', version: '5.10.0' implementation group: 'net.java.dev.jna', name: 'jna', version: '5.10.0'
// Java Netty for networking. // Java Netty for networking.
@ -96,7 +96,7 @@ dependencies {
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.19.6' implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.19.6'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.2' implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.2'
implementation platform('com.fasterxml.jackson:jackson-bom:2.14.0') implementation platform('com.fasterxml.jackson:jackson-bom:2.17.1')
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.2' implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.2'
// Reflections libraries. // Reflections libraries.
@ -121,7 +121,7 @@ dependencies {
// Java HTTP server library. // Java HTTP server library.
implementation group: 'io.javalin', name: 'javalin', version: '5.5.0' implementation group: 'io.javalin', name: 'javalin', version: '5.5.0'
// Java WebSocket server & client library. // Java WebSocket server & client library.
implementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.5.2' implementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.5.6'
// Google Protocol Buffer definitions. // Google Protocol Buffer definitions.
// These are the raw '.proto' files. // These are the raw '.proto' files.
@ -130,7 +130,7 @@ dependencies {
// Testing libraries. // Testing libraries.
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.8.2' testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.8.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.8.2' testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.8.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.8.2' testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.2'
// HTTP client library for testing. // HTTP client library for testing.
testImplementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.10.0' testImplementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.10.0'
@ -261,7 +261,7 @@ clean {
protobuf { protobuf {
protoc { protoc {
// The artifact spec for the Protobuf Compiler // The artifact spec for the Protobuf Compiler
artifact = 'com.google.protobuf:protoc:3.18.1' artifact = 'com.google.protobuf:protoc:4.27.1'
} }
generatedFilesBaseDir = "$projectDir/src/generated/" generatedFilesBaseDir = "$projectDir/src/generated/"

View File

@ -5,7 +5,7 @@
[EN](../README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [FR](README_fr-FR.md) | [ES](README_es-ES.md) | [HE](README_HE.md) | [RU](README_ru-RU.md) | [PL](README_pl-PL.md) | [ID](README_id-ID.md) | [KR](README_ko-KR.md) | [FIL/PH](README_fil-PH.md) | [NL](README_NL.md) | [JP](README_ja-JP.md) | [IT](README_it-IT.md) | [VI](README_vi-VN.md) | [हिंदी](README_hn-IN.md) [EN](../README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [FR](README_fr-FR.md) | [ES](README_es-ES.md) | [HE](README_HE.md) | [RU](README_ru-RU.md) | [PL](README_pl-PL.md) | [ID](README_id-ID.md) | [KR](README_ko-KR.md) | [FIL/PH](README_fil-PH.md) | [NL](README_NL.md) | [JP](README_ja-JP.md) | [IT](README_it-IT.md) | [VI](README_vi-VN.md) | [हिंदी](README_hn-IN.md)
**Aantekening:** We verwelkomen altijd bijdragers aan het project. Lees onze [Gedragscode](https://github.com/Grasscutters/Grasscutter/blob/development/README_NL.md#bijdragen-aan-het-project) zorgvuldig door voordat u uw bijdrage toevoegt. **Aantekening:** We verwelkomen altijd bijdragers aan het project. Lees onze [Gedragscode](https://github.com/Grasscutters/Grasscutter/blob/stable/CONTRIBUTING.md) zorgvuldig door voordat u uw bijdrage toevoegt.
## Huidige functies ## Huidige functies

View File

@ -1,12 +1,12 @@
package emu.grasscutter; package emu.grasscutter;
public final class DebugConstants { public final class DebugConstants {
public static boolean LOG_ABILITIES = false; public static final boolean LOG_ABILITIES = false;
public static boolean LOG_LUA_SCRIPTS = false; public static final boolean LOG_LUA_SCRIPTS = false;
public static boolean LOG_QUEST_START = false; public static final boolean LOG_QUEST_START = false;
public static boolean LOG_MISSING_ABILITIES = false; public static final boolean LOG_MISSING_ABILITIES = false;
public static boolean LOG_MISSING_LUA_SCRIPTS = false; public static final boolean LOG_MISSING_LUA_SCRIPTS = false;
public static boolean LOG_MISSING_ABILITY_HANDLERS = false; public static final boolean LOG_MISSING_ABILITY_HANDLERS = false;
/** /**
* WARNING: THIS IS A DANGEROUS SETTING. DO NOT ENABLE UNLESS YOU KNOW WHAT YOU ARE DOING. This * WARNING: THIS IS A DANGEROUS SETTING. DO NOT ENABLE UNLESS YOU KNOW WHAT YOU ARE DOING. This

View File

@ -7,8 +7,8 @@ import emu.grasscutter.utils.objects.SparseSet;
import java.util.Arrays; import java.util.Arrays;
public final class GameConstants { public final class GameConstants {
public static String VERSION = "4.0.0"; public static final String VERSION = "4.0.0";
public static int[] VERSION_PARTS = {4, 0, 0}; public static final int[] VERSION_PARTS = {4, 0, 0};
public static boolean DEBUG = false; public static boolean DEBUG = false;
public static final int DEFAULT_TEAMS = 4; public static final int DEFAULT_TEAMS = 4;

View File

@ -312,7 +312,7 @@ public final class Grasscutter {
public static void updateDayOfWeek() { public static void updateDayOfWeek() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Grasscutter.currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); Grasscutter.currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
logger.debug("Set day of week to " + currentDayOfWeek); logger.debug("Set day of week to {}", currentDayOfWeek);
} }
public static void startConsole() { public static void startConsole() {

View File

@ -103,7 +103,7 @@ public final class DefaultAuthenticators {
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); KeyFactory keyFactory = KeyFactory.getInstance("RSA");
RSAPrivateKey private_key = (RSAPrivateKey) keyFactory.generatePrivate(keySpec); RSAPrivateKey private_key = (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding");
cipher.init(Cipher.DECRYPT_MODE, private_key); cipher.init(Cipher.DECRYPT_MODE, private_key);

View File

@ -53,7 +53,7 @@ public final class CommandMap {
* @return Instance chaining. * @return Instance chaining.
*/ */
public CommandMap registerCommand(String label, CommandHandler command) { public CommandMap registerCommand(String label, CommandHandler command) {
Grasscutter.getLogger().trace("Registered command: " + label); Grasscutter.getLogger().trace("Registered command: {}", label);
label = label.toLowerCase(); label = label.toLowerCase();
// Get command data. // Get command data.
@ -76,7 +76,7 @@ public final class CommandMap {
* @return Instance chaining. * @return Instance chaining.
*/ */
public CommandMap unregisterCommand(String label) { public CommandMap unregisterCommand(String label) {
Grasscutter.getLogger().trace("Un-registered command: " + label); Grasscutter.getLogger().trace("Un-registered command: {}", label);
CommandHandler handler = this.commands.get(label); CommandHandler handler = this.commands.get(label);
if (handler == null) return this; if (handler == null) return this;
@ -231,14 +231,12 @@ public final class CommandMap {
if (player != null) { if (player != null) {
Grasscutter.getLogger() Grasscutter.getLogger()
.info( .info(
"Command used by [" "Command used by [{} (Player UID: {})]: {}",
+ player.getAccount().getUsername() player.getAccount().getUsername(),
+ " (Player UID: " player.getUid(),
+ player.getUid() rawMessage);
+ ")]: "
+ rawMessage);
} else { } else {
Grasscutter.getLogger().info("Command used by server console: " + rawMessage); Grasscutter.getLogger().info("Command used by server console: {}", rawMessage);
} }
} }
@ -350,11 +348,12 @@ public final class CommandMap {
this.registerCommand(cmdData.label(), (CommandHandler) object); this.registerCommand(cmdData.label(), (CommandHandler) object);
else else
Grasscutter.getLogger() Grasscutter.getLogger()
.error("Class " + annotated.getName() + " is not a CommandHandler!"); .error("Class {} is not a CommandHandler!", annotated.getName());
} catch (Exception exception) { } catch (Exception exception) {
Grasscutter.getLogger() Grasscutter.getLogger()
.error( .error(
"Failed to register command handler for " + annotated.getSimpleName(), "Failed to register command handler for {}",
annotated.getSimpleName(),
exception); exception);
} }
}); });

View File

@ -69,7 +69,7 @@ public final class AchievementCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) { if (args.isEmpty()) {
this.sendUsageMessage(sender); this.sendUsageMessage(sender);
return; return;
} }
@ -88,7 +88,7 @@ public final class AchievementCommand implements CommandHandler {
private void grant( private void grant(
Player sender, Player targetPlayer, Achievements achievements, List<String> args) { Player sender, Player targetPlayer, Achievements achievements, List<String> args) {
if (args.size() < 1) { if (args.isEmpty()) {
this.sendUsageMessage(sender); this.sendUsageMessage(sender);
} }
@ -109,7 +109,7 @@ public final class AchievementCommand implements CommandHandler {
private void revoke( private void revoke(
Player sender, Player targetPlayer, Achievements achievements, List<String> args) { Player sender, Player targetPlayer, Achievements achievements, List<String> args) {
if (args.size() < 1) { if (args.isEmpty()) {
this.sendUsageMessage(sender); this.sendUsageMessage(sender);
} }
@ -136,20 +136,19 @@ public final class AchievementCommand implements CommandHandler {
parseInt(args.remove(0)) parseInt(args.remove(0))
.ifPresentOrElse( .ifPresentOrElse(
integer -> { integer ->
parseInt(args.remove(0)) parseInt(args.remove(0))
.ifPresentOrElse( .ifPresentOrElse(
progress -> { progress -> {
var ret = achievements.progress(integer, progress); var ret = achievements.progress(integer, progress);
switch (ret.getRet()) { switch (ret.getRet()) {
case SUCCESS -> sendSuccessMessage( case SUCCESS -> sendSuccessMessage(
sender, "progress", targetPlayer.getNickname(), integer, progress); sender, "progress", targetPlayer.getNickname(), integer, progress);
case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage( case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage(
sender, ret.getRet().getKey()); sender, ret.getRet().getKey());
} }
}, },
() -> this.sendUsageMessage(sender)); () -> this.sendUsageMessage(sender)),
},
() -> this.sendUsageMessage(sender)); () -> this.sendUsageMessage(sender));
} }
} }

View File

@ -19,7 +19,7 @@ public final class AnnounceCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
var manager = Grasscutter.getGameServer().getAnnouncementSystem(); var manager = Grasscutter.getGameServer().getAnnouncementSystem();
if (args.size() < 1) { if (args.isEmpty()) {
sendUsageMessage(sender); sendUsageMessage(sender);
return; return;
} }

View File

@ -51,7 +51,7 @@ public final class ClearCommand implements CommandHandler {
// Extract any tagged int arguments (e.g. "lv90", "x100", "r5") // Extract any tagged int arguments (e.g. "lv90", "x100", "r5")
parseIntParameters(args, param, intCommandHandlers); parseIntParameters(args, param, intCommandHandlers);
if (args.size() < 1) { if (args.isEmpty()) {
sendUsageMessage(sender); sendUsageMessage(sender);
return; return;
} }
@ -93,9 +93,10 @@ public final class ClearCommand implements CommandHandler {
} }
} }
@Setter
private static class ClearItemParameters { private static class ClearItemParameters {
@Setter public int lvl = 1; public int lvl = 1;
@Setter public int refinement = 1; public int refinement = 1;
@Setter public int rank = 4; public int rank = 4;
} }
} }

View File

@ -16,7 +16,7 @@ public final class EnterDungeonCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) { if (args.isEmpty()) {
sendUsageMessage(sender); sendUsageMessage(sender);
return; return;
} }

View File

@ -3,16 +3,23 @@ package emu.grasscutter.command.commands;
import static emu.grasscutter.GameConstants.*; import static emu.grasscutter.GameConstants.*;
import static emu.grasscutter.command.CommandHelpers.*; import static emu.grasscutter.command.CommandHelpers.*;
import emu.grasscutter.command.*; import emu.grasscutter.command.Command;
import emu.grasscutter.data.*; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.GameDepot;
import emu.grasscutter.data.excels.ItemData; import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.data.excels.avatar.AvatarData; import emu.grasscutter.data.excels.avatar.AvatarData;
import emu.grasscutter.data.excels.reliquary.*; import emu.grasscutter.data.excels.reliquary.ReliquaryAffixData;
import emu.grasscutter.data.excels.reliquary.ReliquaryMainPropData;
import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.inventory.*; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.inventory.ItemType;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.*; import emu.grasscutter.game.props.ActionReason;
import java.util.*; import emu.grasscutter.game.props.FightProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import lombok.Setter; import lombok.Setter;
@ -279,7 +286,7 @@ public final class GiveCommand implements CommandHandler {
parseIntParameters(args, param, intCommandHandlers); parseIntParameters(args, param, intCommandHandlers);
// At this point, first remaining argument MUST be itemId/avatarId // At this point, first remaining argument MUST be itemId/avatarId
if (args.size() < 1) { if (args.isEmpty()) {
sendUsageMessage(sender); // Reachable if someone does `/give lv90` or similar sendUsageMessage(sender); // Reachable if someone does `/give lv90` or similar
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@ -362,7 +369,7 @@ public final class GiveCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) { // *No args* if (args.isEmpty()) { // *No args*
sendUsageMessage(sender); sendUsageMessage(sender);
return; return;
} }

View File

@ -63,9 +63,7 @@ public final class GroupCommand implements CommandHandler {
CommandHandler.sendMessage(sender, translate(sender, "commands.group.refreshed", groupId)); CommandHandler.sendMessage(sender, translate(sender, "commands.group.refreshed", groupId));
} }
default -> { default -> sendUsageMessage(sender);
sendUsageMessage(sender);
}
} }
} }
} }

View File

@ -19,14 +19,14 @@ public final class ListCommand implements CommandHandler {
Map<Integer, Player> playersMap = Grasscutter.getGameServer().getPlayers(); Map<Integer, Player> playersMap = Grasscutter.getGameServer().getPlayers();
boolean needUID = false; boolean needUID = false;
if (args.size() > 0) { if (!args.isEmpty()) {
needUID = args.get(0).equals("uid"); needUID = args.get(0).equals("uid");
} }
CommandHandler.sendMessage( CommandHandler.sendMessage(
sender, translate(sender, "commands.list.success", playersMap.size())); sender, translate(sender, "commands.list.success", playersMap.size()));
if (playersMap.size() != 0) { if (!playersMap.isEmpty()) {
StringBuilder playerSet = new StringBuilder(); StringBuilder playerSet = new StringBuilder();
boolean finalNeedUID = needUID; boolean finalNeedUID = needUID;

View File

@ -18,7 +18,7 @@ public final class ResetConstCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() > 0 && args.get(0).equalsIgnoreCase("all")) { if (!args.isEmpty() && args.get(0).equalsIgnoreCase("all")) {
targetPlayer.getAvatars().forEach(this::resetConstellation); targetPlayer.getAvatars().forEach(this::resetConstellation);
CommandHandler.sendMessage(sender, translate(sender, "commands.resetConst.reset_all")); CommandHandler.sendMessage(sender, translate(sender, "commands.resetConst.reset_all"));
} else { } else {

View File

@ -24,8 +24,7 @@ public final class SendMailCommand implements CommandHandler {
// the command system (again). For now this will do // the command system (again). For now this will do
// Key = User that is constructing the mail. // Key = User that is constructing the mail.
private static final HashMap<Integer, MailBuilder> mailBeingConstructed = private static final HashMap<Integer, MailBuilder> mailBeingConstructed = new HashMap<>();
new HashMap<Integer, MailBuilder>();
// Yes this is awful and I hate it. // Yes this is awful and I hate it.
@Override @Override
@ -69,7 +68,7 @@ public final class SendMailCommand implements CommandHandler {
} else { } else {
MailBuilder mailBuilder = mailBeingConstructed.get(senderId); MailBuilder mailBuilder = mailBeingConstructed.get(senderId);
if (args.size() >= 1) { if (!args.isEmpty()) {
switch (args.get(0).toLowerCase()) { switch (args.get(0).toLowerCase()) {
case "stop" -> { case "stop" -> {
mailBeingConstructed.remove(senderId); mailBeingConstructed.remove(senderId);
@ -106,14 +105,12 @@ public final class SendMailCommand implements CommandHandler {
getConstructionArgs(mailBuilder.constructionStage, sender))); getConstructionArgs(mailBuilder.constructionStage, sender)));
} }
} }
case "help" -> { case "help" -> CommandHandler.sendMessage(
CommandHandler.sendMessage( sender,
sender, translate(
translate( sender,
sender, "commands.sendMail.please_use",
"commands.sendMail.please_use", getConstructionArgs(mailBuilder.constructionStage, sender)));
getConstructionArgs(mailBuilder.constructionStage, sender)));
}
default -> { default -> {
switch (mailBuilder.constructionStage) { switch (mailBuilder.constructionStage) {
case 0 -> { case 0 -> {

View File

@ -17,7 +17,7 @@ public final class SendMessageCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() == 0) { if (args.isEmpty()) {
sendUsageMessage(sender); sendUsageMessage(sender);
return; return;
} }

View File

@ -17,7 +17,7 @@ import java.util.List;
public final class SetConstCommand implements CommandHandler { public final class SetConstCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) { if (args.isEmpty()) {
sendUsageMessage(sender); sendUsageMessage(sender);
return; return;
} }

View File

@ -291,9 +291,9 @@ public final class SetPropCommand implements CommandHandler {
} }
static class Prop { static class Prop {
String name; final String name;
PlayerProperty prop; final PlayerProperty prop;
PseudoProp pseudoProp; final PseudoProp pseudoProp;
public Prop(PlayerProperty prop) { public Prop(PlayerProperty prop) {
this(prop.toString(), prop, PseudoProp.NONE); this(prop.toString(), prop, PseudoProp.NONE);

View File

@ -95,9 +95,8 @@ public final class SetSceneTagCommand implements CommandHandler {
// Only remove for big world as some other scenes only have defaults // Only remove for big world as some other scenes only have defaults
.filter(sceneTag -> sceneTag.getSceneId() == 3) .filter(sceneTag -> sceneTag.getSceneId() == 3)
.forEach( .forEach(
sceneTag -> { sceneTag ->
targetPlayer.getSceneTags().get(sceneTag.getSceneId()).remove(sceneTag.getId()); targetPlayer.getSceneTags().get(sceneTag.getSceneId()).remove(sceneTag.getId()));
});
this.setSceneTags(targetPlayer); this.setSceneTags(targetPlayer);
} }

View File

@ -171,8 +171,8 @@ public final class SetStatsCommand implements CommandHandler {
} }
private static class Stat { private static class Stat {
String name; final String name;
FightProperty prop; final FightProperty prop;
public Stat(FightProperty prop) { public Stat(FightProperty prop) {
this.name = prop.toString(); this.name = prop.toString();

View File

@ -49,7 +49,7 @@ public final class SpawnCommand implements CommandHandler {
parseIntParameters(args, param, intCommandHandlers); parseIntParameters(args, param, intCommandHandlers);
// At this point, first remaining argument MUST be the id and the rest the pos // At this point, first remaining argument MUST be the id and the rest the pos
if (args.size() < 1) { if (args.isEmpty()) {
sendUsageMessage(sender); // Reachable if someone does `/give lv90` or similar sendUsageMessage(sender); // Reachable if someone does `/give lv90` or similar
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }

View File

@ -27,7 +27,7 @@ public final class TalentCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) { if (args.isEmpty()) {
sendUsageMessage(sender); sendUsageMessage(sender);
return; return;
} }
@ -45,9 +45,7 @@ public final class TalentCommand implements CommandHandler {
String cmdSwitch = args.get(0).toLowerCase(); String cmdSwitch = args.get(0).toLowerCase();
switch (cmdSwitch) { switch (cmdSwitch) {
default -> { default -> sendUsageMessage(sender);
sendUsageMessage(sender);
}
case "set" -> { case "set" -> {
if (args.size() < 3) { if (args.size() < 3) {
sendUsageMessage(sender); sendUsageMessage(sender);

View File

@ -131,7 +131,7 @@ public final class TrialAvatarActivityCommand implements CommandHandler {
translate( translate(
sender, "commands.trialAvatarActivity.success_reward", Integer.parseInt(param))); sender, "commands.trialAvatarActivity.success_reward", Integer.parseInt(param)));
} else { } else {
if (!param.toLowerCase().equals("all")) { if (!param.equalsIgnoreCase("all")) {
CommandHandler.sendMessage( CommandHandler.sendMessage(
sender, translate(sender, "commands.trialAvatarActivity.invalid_param")); sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
return; return;

View File

@ -78,11 +78,11 @@ public class ConfigContainer {
} }
} }
public Structure folderStructure = new Structure(); public final Structure folderStructure = new Structure();
public Database databaseInfo = new Database(); public final Database databaseInfo = new Database();
public Language language = new Language(); public final Language language = new Language();
public Account account = new Account(); public final Account account = new Account();
public Server server = new Server(); public final Server server = new Server();
// DO NOT. TOUCH. THE VERSION NUMBER. // DO NOT. TOUCH. THE VERSION NUMBER.
public int version = version(); public int version = version();
@ -90,99 +90,99 @@ public class ConfigContainer {
/* Option containers. */ /* Option containers. */
public static class Database { public static class Database {
public DataStore server = new DataStore(); public final DataStore server = new DataStore();
public DataStore game = new DataStore(); public final DataStore game = new DataStore();
public static class DataStore { public static class DataStore {
public String connectionUri = "mongodb://localhost:27017"; public final String connectionUri = "mongodb://localhost:27017";
public String collection = "grasscutter"; public final String collection = "grasscutter";
} }
} }
public static class Structure { public static class Structure {
public String resources = "./resources/"; public final String resources = "./resources/";
public String data = "./data/"; public final String data = "./data/";
public String packets = "./packets/"; public final String packets = "./packets/";
public String scripts = "resources:Scripts/"; public final String scripts = "resources:Scripts/";
public String plugins = "./plugins/"; public final String plugins = "./plugins/";
public String cache = "./cache/"; public final String cache = "./cache/";
// UNUSED (potentially added later?) // UNUSED (potentially added later?)
// public String dumps = "./dumps/"; // public String dumps = "./dumps/";
} }
public static class Server { public static class Server {
public Set<Integer> debugWhitelist = Set.of(); public final Set<Integer> debugWhitelist = Set.of();
public Set<Integer> debugBlacklist = Set.of(); public final Set<Integer> debugBlacklist = Set.of();
public ServerRunMode runMode = ServerRunMode.HYBRID; public final ServerRunMode runMode = ServerRunMode.HYBRID;
public boolean logCommands = false; public final boolean logCommands = false;
/** /**
* If enabled, the 'require' Lua function will load the script's compiled varient into the context. (faster; doesn't work as well) * If enabled, the 'require' Lua function will load the script's compiled varient into the context. (faster; doesn't work as well)
* If disabled, all 'require' calls will be replaced with the referenced script's source. (slower; works better) * If disabled, all 'require' calls will be replaced with the referenced script's source. (slower; works better)
*/ */
public boolean fastRequire = true; public final boolean fastRequire = true;
public HTTP http = new HTTP(); public final HTTP http = new HTTP();
public Game game = new Game(); public final Game game = new Game();
public Dispatch dispatch = new Dispatch(); public final Dispatch dispatch = new Dispatch();
public DebugMode debugMode = new DebugMode(); public final DebugMode debugMode = new DebugMode();
} }
public static class Language { public static class Language {
public Locale language = Locale.getDefault(); public Locale language = Locale.getDefault();
public Locale fallback = Locale.US; public final Locale fallback = Locale.US;
public String document = "EN"; public final String document = "EN";
} }
public static class Account { public static class Account {
public boolean autoCreate = false; public final boolean autoCreate = false;
public boolean EXPERIMENTAL_RealPassword = false; public final boolean EXPERIMENTAL_RealPassword = false;
public String[] defaultPermissions = {}; public final String[] defaultPermissions = {};
public String playerEmail = "grasscutter.io"; public final String playerEmail = "grasscutter.io";
public int maxPlayer = -1; public final int maxPlayer = -1;
} }
/* Server options. */ /* Server options. */
public static class HTTP { public static class HTTP {
/* This starts the HTTP server before the game server. */ /* This starts the HTTP server before the game server. */
public boolean startImmediately = false; public final boolean startImmediately = false;
public String bindAddress = "0.0.0.0"; public final String bindAddress = "0.0.0.0";
public int bindPort = 443; public final int bindPort = 443;
/* This is the address used in URLs. */ /* This is the address used in URLs. */
public String accessAddress = "127.0.0.1"; public final String accessAddress = "127.0.0.1";
/* This is the port used in URLs. */ /* This is the port used in URLs. */
public int accessPort = 0; public final int accessPort = 0;
public Encryption encryption = new Encryption(); public final Encryption encryption = new Encryption();
public Policies policies = new Policies(); public final Policies policies = new Policies();
public Files files = new Files(); public final Files files = new Files();
} }
public static class Game { public static class Game {
public String bindAddress = "0.0.0.0"; public final String bindAddress = "0.0.0.0";
public int bindPort = 22102; public final int bindPort = 22102;
/* This is the address used in the default region. */ /* This is the address used in the default region. */
public String accessAddress = "127.0.0.1"; public final String accessAddress = "127.0.0.1";
/* This is the port used in the default region. */ /* This is the port used in the default region. */
public int accessPort = 0; public final int accessPort = 0;
/* Enabling this will generate a unique packet encryption key for each player. */ /* Enabling this will generate a unique packet encryption key for each player. */
public boolean useUniquePacketKey = true; public final boolean useUniquePacketKey = true;
/* Entities within a certain range will be loaded for the player */ /* Entities within a certain range will be loaded for the player */
public int loadEntitiesForPlayerRange = 300; public final int loadEntitiesForPlayerRange = 300;
/* Start in 'unstable-quests', Lua scripts will be enabled by default. */ /* Start in 'unstable-quests', Lua scripts will be enabled by default. */
public boolean enableScriptInBigWorld = true; public final boolean enableScriptInBigWorld = true;
public boolean enableConsole = true; public boolean enableConsole = true;
/* Kcp internal work interval (milliseconds) */ /* Kcp internal work interval (milliseconds) */
public int kcpInterval = 20; public final int kcpInterval = 20;
/* Controls whether packets should be logged in console or not */ /* Controls whether packets should be logged in console or not */
public ServerDebugMode logPackets = ServerDebugMode.NONE; public ServerDebugMode logPackets = ServerDebugMode.NONE;
/* Show packet payload in console or no (in any case the payload is shown in encrypted view) */ /* Show packet payload in console or no (in any case the payload is shown in encrypted view) */
@ -190,13 +190,13 @@ public class ConfigContainer {
/* Show annoying loop packets or no */ /* Show annoying loop packets or no */
public boolean isShowLoopPackets = false; public boolean isShowLoopPackets = false;
public boolean cacheSceneEntitiesEveryRun = false; public final boolean cacheSceneEntitiesEveryRun = false;
public GameOptions gameOptions = new GameOptions(); public final GameOptions gameOptions = new GameOptions();
public JoinOptions joinOptions = new JoinOptions(); public final JoinOptions joinOptions = new JoinOptions();
public ConsoleAccount serverAccount = new ConsoleAccount(); public final ConsoleAccount serverAccount = new ConsoleAccount();
public VisionOptions[] visionOptions = new VisionOptions[] { public final VisionOptions[] visionOptions = new VisionOptions[] {
new VisionOptions("VISION_LEVEL_NORMAL" , 80 , 20), new VisionOptions("VISION_LEVEL_NORMAL" , 80 , 20),
new VisionOptions("VISION_LEVEL_LITTLE_REMOTE" , 16 , 40), new VisionOptions("VISION_LEVEL_LITTLE_REMOTE" , 16 , 40),
new VisionOptions("VISION_LEVEL_REMOTE" , 1000 , 250), new VisionOptions("VISION_LEVEL_REMOTE" , 1000 , 250),
@ -210,17 +210,17 @@ public class ConfigContainer {
public static class Dispatch { public static class Dispatch {
/* An array of servers. */ /* An array of servers. */
public List<Region> regions = List.of(); public final List<Region> regions = List.of();
/* The URL used to make HTTP requests to the dispatch server. */ /* The URL used to make HTTP requests to the dispatch server. */
public String dispatchUrl = "ws://127.0.0.1:1111"; public final String dispatchUrl = "ws://127.0.0.1:1111";
/* A unique key used for encryption. */ /* A unique key used for encryption. */
public byte[] encryptionKey = Crypto.createSessionKey(32); public final byte[] encryptionKey = Crypto.createSessionKey(32);
/* A unique key used for authentication. */ /* A unique key used for authentication. */
public String dispatchKey = Utils.base64Encode( public final String dispatchKey = Utils.base64Encode(
Crypto.createSessionKey(32)); Crypto.createSessionKey(32));
public String defaultName = "Grasscutter"; public final String defaultName = "Grasscutter";
/* Controls whether http requests should be logged in console or not */ /* Controls whether http requests should be logged in console or not */
public ServerDebugMode logRequests = ServerDebugMode.NONE; public ServerDebugMode logRequests = ServerDebugMode.NONE;
@ -230,127 +230,127 @@ public class ConfigContainer {
* (see StartupArguments.enableDebug) */ * (see StartupArguments.enableDebug) */
public static class DebugMode { public static class DebugMode {
/* Log level of the main server code (works only with -debug arg) */ /* Log level of the main server code (works only with -debug arg) */
public Level serverLoggerLevel = Level.DEBUG; public final Level serverLoggerLevel = Level.DEBUG;
/* Log level of the third-party services (works only with -debug arg): /* Log level of the third-party services (works only with -debug arg):
javalin, quartz, reflections, jetty, mongodb.driver */ javalin, quartz, reflections, jetty, mongodb.driver */
public Level servicesLoggersLevel = Level.INFO; public final Level servicesLoggersLevel = Level.INFO;
/* Controls whether packets should be logged in console or not */ /* Controls whether packets should be logged in console or not */
public ServerDebugMode logPackets = ServerDebugMode.ALL; public final ServerDebugMode logPackets = ServerDebugMode.ALL;
/* Show packet payload in console or no (in any case the payload is shown in encrypted view) */ /* Show packet payload in console or no (in any case the payload is shown in encrypted view) */
public boolean isShowPacketPayload = false; public final boolean isShowPacketPayload = false;
/* Show annoying loop packets or no */ /* Show annoying loop packets or no */
public boolean isShowLoopPackets = false; public final boolean isShowLoopPackets = false;
/* Controls whether http requests should be logged in console or not */ /* Controls whether http requests should be logged in console or not */
public ServerDebugMode logRequests = ServerDebugMode.ALL; public final ServerDebugMode logRequests = ServerDebugMode.ALL;
} }
public static class Encryption { public static class Encryption {
public boolean useEncryption = true; public boolean useEncryption = true;
/* Should 'https' be appended to URLs? */ /* Should 'https' be appended to URLs? */
public boolean useInRouting = true; public boolean useInRouting = true;
public String keystore = "./keystore.p12"; public final String keystore = "./keystore.p12";
public String keystorePassword = "123456"; public final String keystorePassword = "123456";
} }
public static class Policies { public static class Policies {
public Policies.CORS cors = new Policies.CORS(); public final Policies.CORS cors = new Policies.CORS();
public static class CORS { public static class CORS {
public boolean enabled = true; public final boolean enabled = true;
public String[] allowedOrigins = new String[]{"*"}; public final String[] allowedOrigins = new String[]{"*"};
} }
} }
public static class GameOptions { public static class GameOptions {
public InventoryLimits inventoryLimits = new InventoryLimits(); public final InventoryLimits inventoryLimits = new InventoryLimits();
public AvatarLimits avatarLimits = new AvatarLimits(); public final AvatarLimits avatarLimits = new AvatarLimits();
public int sceneEntityLimit = 1000; // Unenforced. TODO: Implement. public final int sceneEntityLimit = 1000; // Unenforced. TODO: Implement.
public boolean watchGachaConfig = false; public final boolean watchGachaConfig = false;
public boolean enableShopItems = true; public final boolean enableShopItems = true;
public boolean staminaUsage = true; public final boolean staminaUsage = true;
public boolean energyUsage = true; public final boolean energyUsage = true;
public boolean fishhookTeleport = true; public final boolean fishhookTeleport = true;
public boolean trialCostumes = false; public final boolean trialCostumes = false;
@SerializedName(value = "questing", alternate = "questOptions") @SerializedName(value = "questing", alternate = "questOptions")
public Questing questing = new Questing(); public final Questing questing = new Questing();
public ResinOptions resinOptions = new ResinOptions(); public final ResinOptions resinOptions = new ResinOptions();
public Rates rates = new Rates(); public final Rates rates = new Rates();
public HandbookOptions handbook = new HandbookOptions(); public final HandbookOptions handbook = new HandbookOptions();
public static class InventoryLimits { public static class InventoryLimits {
public int weapons = 2000; public final int weapons = 2000;
public int relics = 2000; public final int relics = 2000;
public int materials = 2000; public final int materials = 2000;
public int furniture = 2000; public final int furniture = 2000;
public int all = 30000; public final int all = 30000;
} }
public static class AvatarLimits { public static class AvatarLimits {
public int singlePlayerTeam = 4; public final int singlePlayerTeam = 4;
public int multiplayerTeam = 4; public final int multiplayerTeam = 4;
} }
public static class Rates { public static class Rates {
public float adventureExp = 1.0f; public final float adventureExp = 1.0f;
public float mora = 1.0f; public float mora = 1.0f;
public float leyLines = 1.0f; public float leyLines = 1.0f;
} }
public static class ResinOptions { public static class ResinOptions {
public boolean resinUsage = false; public final boolean resinUsage = false;
public int cap = 160; public final int cap = 160;
public int rechargeTime = 480; public final int rechargeTime = 480;
} }
public static class Questing { public static class Questing {
/* Should questing behavior be used? */ /* Should questing behavior be used? */
public boolean enabled = true; public final boolean enabled = true;
} }
public static class HandbookOptions { public static class HandbookOptions {
public boolean enable = false; public final boolean enable = false;
public boolean allowCommands = true; public final boolean allowCommands = true;
public Limits limits = new Limits(); public final Limits limits = new Limits();
public Server server = new Server(); public final Server server = new Server();
public static class Limits { public static class Limits {
/* Are rate limits checked? */ /* Are rate limits checked? */
public boolean enabled = false; public final boolean enabled = false;
/* The time for limits to expire. */ /* The time for limits to expire. */
public int interval = 3; public final int interval = 3;
/* The maximum amount of normal requests. */ /* The maximum amount of normal requests. */
public int maxRequests = 10; public final int maxRequests = 10;
/* The maximum amount of entities to be spawned in one request. */ /* The maximum amount of entities to be spawned in one request. */
public int maxEntities = 25; public final int maxEntities = 25;
} }
public static class Server { public static class Server {
/* Are the server settings sent to the handbook? */ /* Are the server settings sent to the handbook? */
public boolean enforced = false; public final boolean enforced = false;
/* The default server address for the handbook's authentication. */ /* The default server address for the handbook's authentication. */
public String address = "127.0.0.1"; public final String address = "127.0.0.1";
/* The default server port for the handbook's authentication. */ /* The default server port for the handbook's authentication. */
public int port = 443; public final int port = 443;
/* Should the defaults be enforced? */ /* Should the defaults be enforced? */
public boolean canChange = true; public final boolean canChange = true;
} }
} }
} }
public static class VisionOptions { public static class VisionOptions {
public String name; public final String name;
public int visionRange; public final int visionRange;
public int gridWidth; public final int gridWidth;
public VisionOptions(String name, int visionRange, int gridWidth) { public VisionOptions(String name, int visionRange, int gridWidth) {
this.name = name; this.name = name;
@ -360,21 +360,21 @@ public class ConfigContainer {
} }
public static class JoinOptions { public static class JoinOptions {
public int[] welcomeEmotes = {2007, 1002, 4010}; public final int[] welcomeEmotes = {2007, 1002, 4010};
public String welcomeMessage = "Welcome to a Grasscutter server."; public final String welcomeMessage = "Welcome to a Grasscutter server.";
public JoinOptions.Mail welcomeMail = new JoinOptions.Mail(); public final JoinOptions.Mail welcomeMail = new JoinOptions.Mail();
public static class Mail { public static class Mail {
public String title = "Welcome to Grasscutter!"; public final String title = "Welcome to Grasscutter!";
public String content = """ public final String content = """
Hi there!\r Hi there!\r
First of all, welcome to Grasscutter. If you have any issues, please let us know so that Lawnmower can help you! \r First of all, welcome to Grasscutter. If you have any issues, please let us know so that Lawnmower can help you! \r
\r \r
Check out our:\r Check out our:\r
<type="browser" text="Discord" href="https://discord.gg/T5vZU6UyeG"/> <type="browser" text="Discord" href="https://discord.gg/T5vZU6UyeG"/>
"""; """;
public String sender = "Lawnmower"; public final String sender = "Lawnmower";
public emu.grasscutter.game.mail.Mail.MailItem[] items = { public final emu.grasscutter.game.mail.Mail.MailItem[] items = {
new emu.grasscutter.game.mail.Mail.MailItem(13509, 1, 1), new emu.grasscutter.game.mail.Mail.MailItem(13509, 1, 1),
new emu.grasscutter.game.mail.Mail.MailItem(201, 99999, 1) new emu.grasscutter.game.mail.Mail.MailItem(201, 99999, 1)
}; };
@ -382,18 +382,18 @@ public class ConfigContainer {
} }
public static class ConsoleAccount { public static class ConsoleAccount {
public int avatarId = 10000007; public final int avatarId = 10000007;
public int nameCardId = 210001; public final int nameCardId = 210001;
public int adventureRank = 1; public final int adventureRank = 1;
public int worldLevel = 0; public final int worldLevel = 0;
public String nickName = "Server"; public final String nickName = "Server";
public String signature = "Welcome to Grasscutter!"; public final String signature = "Welcome to Grasscutter!";
} }
public static class Files { public static class Files {
public String indexFile = "./index.html"; public final String indexFile = "./index.html";
public String errorFile = "./404.html"; public final String errorFile = "./404.html";
} }
/* Objects. */ /* Objects. */

View File

@ -1,10 +1,17 @@
package emu.grasscutter.data; package emu.grasscutter.data;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.utils.*; import emu.grasscutter.utils.FileUtils;
import java.io.*; import emu.grasscutter.utils.JsonUtils;
import java.nio.file.*; import emu.grasscutter.utils.TsvUtils;
import java.util.*; import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import lombok.val; import lombok.val;
public class DataLoader { public class DataLoader {
@ -15,7 +22,7 @@ public class DataLoader {
* *
* @param resourcePath The path to the data file to be loaded. * @param resourcePath The path to the data file to be loaded.
* @return InputStream of the data file. * @return InputStream of the data file.
* @throws FileNotFoundException * @throws FileNotFoundException If the file is not found.
* @see #load(String, boolean) * @see #load(String, boolean)
*/ */
public static InputStream load(String resourcePath) throws FileNotFoundException { public static InputStream load(String resourcePath) throws FileNotFoundException {
@ -24,22 +31,18 @@ public class DataLoader {
/** /**
* Creates an input stream reader for a data file. If the file isn't found within the /data * Creates an input stream reader for a data file. If the file isn't found within the /data
* directory then it will fallback to the default within the jar resources * directory then it will fall back to the default within the jar resources
* *
* @param resourcePath The path to the data file to be loaded. * @param resourcePath The path to the data file to be loaded.
* @return InputStreamReader of the data file. * @return InputStreamReader of the data file.
* @throws IOException * @throws IOException If the file is not found.
* @throws FileNotFoundException * @throws FileNotFoundException If the file is not found.
* @see #load(String, boolean) * @see #load(String, boolean)
*/ */
public static InputStreamReader loadReader(String resourcePath) public static InputStreamReader loadReader(String resourcePath) throws IOException {
throws IOException, FileNotFoundException { InputStream is = load(resourcePath, true);
try { if (is == null) throw new FileNotFoundException("File not found: " + resourcePath);
InputStream is = load(resourcePath, true); return new InputStreamReader(is);
return new InputStreamReader(is);
} catch (FileNotFoundException exception) {
throw exception;
}
} }
/** /**
@ -49,7 +52,7 @@ public class DataLoader {
* @param useFallback If the file does not exist in the /data directory, should it use the default * @param useFallback If the file does not exist in the /data directory, should it use the default
* file in the jar? * file in the jar?
* @return InputStream of the data file. * @return InputStream of the data file.
* @throws FileNotFoundException * @throws FileNotFoundException If the file is not found.
*/ */
public static InputStream load(String resourcePath, boolean useFallback) public static InputStream load(String resourcePath, boolean useFallback)
throws FileNotFoundException { throws FileNotFoundException {
@ -89,7 +92,7 @@ public class DataLoader {
public static <T> List<T> loadTableToList(String resourcePath, Class<T> classType) public static <T> List<T> loadTableToList(String resourcePath, Class<T> classType)
throws IOException { throws IOException {
val path = FileUtils.getDataPathTsjJsonTsv(resourcePath); val path = FileUtils.getDataPathTsjJsonTsv(resourcePath);
Grasscutter.getLogger().trace("Loading data table from: " + path); Grasscutter.getLogger().trace("Loading data table from: {}", path);
return switch (FileUtils.getFileExtension(path)) { return switch (FileUtils.getFileExtension(path)) {
case "json" -> JsonUtils.loadToList(path, classType); case "json" -> JsonUtils.loadToList(path, classType);
case "tsj" -> TsvUtils.loadTsjToListSetField(path, classType); case "tsj" -> TsvUtils.loadTsjToListSetField(path, classType);
@ -120,10 +123,9 @@ public class DataLoader {
if (!Files.exists(filePath)) { if (!Files.exists(filePath)) {
var root = filePath.getParent(); var root = filePath.getParent();
if (root.toFile().mkdirs()) if (root.toFile().mkdirs()) Grasscutter.getLogger().info("Created data folder '{}'", root);
Grasscutter.getLogger().info("Created data folder '" + root + "'");
Grasscutter.getLogger().debug("Creating default '" + name + "' data"); Grasscutter.getLogger().debug("Creating default '{}' data", name);
FileUtils.copyResource("/defaults/data/" + name, filePath.toString()); FileUtils.copyResource("/defaults/data/" + name, filePath.toString());
} }
} }

View File

@ -569,8 +569,8 @@ public final class GameData {
private static final Int2IntMap trialAvatarIndexIdTrialActivityDataDataMap = private static final Int2IntMap trialAvatarIndexIdTrialActivityDataDataMap =
new Int2IntOpenHashMap(); new Int2IntOpenHashMap();
private static Map<Integer, List<Integer>> fetters = new HashMap<>(); private static final Map<Integer, List<Integer>> fetters = new HashMap<>();
private static Map<Integer, List<ShopGoodsData>> shopGoods = new HashMap<>(); private static final Map<Integer, List<ShopGoodsData>> shopGoods = new HashMap<>();
// Getters with different names that stay for now // Getters with different names that stay for now
public static Int2ObjectMap<MainQuestData> getMainQuestDataMap() { public static Int2ObjectMap<MainQuestData> getMainQuestDataMap() {
@ -630,15 +630,21 @@ public final class GameData {
// Non-nullable value getters // Non-nullable value getters
public static int getAvatarLevelExpRequired(int level) { public static int getAvatarLevelExpRequired(int level) {
return Optional.ofNullable(avatarLevelDataMap.get(level)).map(d -> d.getExp()).orElse(0); return Optional.ofNullable(avatarLevelDataMap.get(level))
.map(AvatarLevelData::getExp)
.orElse(0);
} }
public static int getAvatarFetterLevelExpRequired(int level) { public static int getAvatarFetterLevelExpRequired(int level) {
return Optional.ofNullable(avatarFetterLevelDataMap.get(level)).map(d -> d.getExp()).orElse(0); return Optional.ofNullable(avatarFetterLevelDataMap.get(level))
.map(AvatarFetterLevelData::getExp)
.orElse(0);
} }
public static int getRelicExpRequired(int rankLevel, int level) { public static int getRelicExpRequired(int rankLevel, int level) {
return Optional.ofNullable(getRelicLevelData(rankLevel, level)).map(d -> d.getExp()).orElse(0); return Optional.ofNullable(getRelicLevelData(rankLevel, level))
.map(ReliquaryLevelData::getExp)
.orElse(0);
} }
// Generic getter // Generic getter
@ -655,7 +661,7 @@ public final class GameData {
field.setAccessible(false); field.setAccessible(false);
} catch (Exception e) { } catch (Exception e) {
Grasscutter.getLogger() Grasscutter.getLogger()
.error("Error fetching resource map for " + resourceDefinition.getSimpleName(), e); .error("Error fetching resource map for {}", resourceDefinition.getSimpleName(), e);
} }
return map; return map;
@ -713,8 +719,8 @@ public final class GameData {
/** /**
* Fetches the trial data * Fetches the trial data
* *
* @param trialAvatarIndexId * @param trialAvatarIndexId The ID of the trial avatar
* @return * @return The trial data for the trial avatar
*/ */
@Nullable public static TrialAvatarActivityDataData getTrialAvatarActivityDataByAvatarIndex( @Nullable public static TrialAvatarActivityDataData getTrialAvatarActivityDataByAvatarIndex(
int trialAvatarIndexId) { int trialAvatarIndexId) {

View File

@ -13,17 +13,17 @@ import lombok.*;
public class GameDepot { public class GameDepot {
public static final int[] BLOCK_SIZE = new int[] {50, 500}; // Scales public static final int[] BLOCK_SIZE = new int[] {50, 500}; // Scales
private static Int2ObjectMap<WeightedList<ReliquaryMainPropData>> relicRandomMainPropDepot = private static final Int2ObjectMap<WeightedList<ReliquaryMainPropData>> relicRandomMainPropDepot =
new Int2ObjectOpenHashMap<>(); new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<List<ReliquaryMainPropData>> relicMainPropDepot = private static final Int2ObjectMap<List<ReliquaryMainPropData>> relicMainPropDepot =
new Int2ObjectOpenHashMap<>(); new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<List<ReliquaryAffixData>> relicAffixDepot = private static final Int2ObjectMap<List<ReliquaryAffixData>> relicAffixDepot =
new Int2ObjectOpenHashMap<>(); new Int2ObjectOpenHashMap<>();
@Getter @Setter private static Map<String, AvatarConfig> playerAbilities = new HashMap<>(); @Getter @Setter private static Map<String, AvatarConfig> playerAbilities = new HashMap<>();
@Getter @Getter
private static HashMap<SpawnDataEntry.GridBlockId, ArrayList<SpawnDataEntry>> spawnLists = private static final HashMap<SpawnDataEntry.GridBlockId, ArrayList<SpawnDataEntry>> spawnLists =
new HashMap<>(); new HashMap<>();
@Getter @Setter private static BlossomConfig blossomConfig; @Getter @Setter private static BlossomConfig blossomConfig;
@ -50,7 +50,7 @@ public class GameDepot {
list.add(data); list.add(data);
} }
// Let the server owner know if theyre missing weights // Let the server owner know if theyre missing weights
if (relicMainPropDepot.size() == 0 || relicAffixDepot.size() == 0) { if (relicMainPropDepot.isEmpty() || relicAffixDepot.isEmpty()) {
Grasscutter.getLogger() Grasscutter.getLogger()
.error( .error(
"Relic properties are missing weights! Please check your ReliquaryMainPropExcelConfigData or ReliquaryAffixExcelConfigData files in your ExcelBinOutput folder."); "Relic properties are missing weights! Please check your ReliquaryMainPropExcelConfigData or ReliquaryAffixExcelConfigData files in your ExcelBinOutput folder.");

View File

@ -63,7 +63,7 @@ public final class ResourceLoader {
private static List<Set<Class<?>>> getResourceDefClassesPrioritySets() { private static List<Set<Class<?>>> getResourceDefClassesPrioritySets() {
val classes = Grasscutter.reflector.getSubTypesOf(GameResource.class); val classes = Grasscutter.reflector.getSubTypesOf(GameResource.class);
val priorities = ResourceType.LoadPriority.getInOrder(); val priorities = ResourceType.LoadPriority.getInOrder();
Grasscutter.getLogger().debug("Priorities are " + priorities); Grasscutter.getLogger().debug("Priorities are {}", priorities);
val map = new LinkedHashMap<ResourceType.LoadPriority, Set<Class<?>>>(priorities.size()); val map = new LinkedHashMap<ResourceType.LoadPriority, Set<Class<?>>>(priorities.size());
priorities.forEach(p -> map.put(p, new HashSet<>())); priorities.forEach(p -> map.put(p, new HashSet<>()));
@ -140,36 +140,35 @@ public final class ResourceLoader {
getResourceDefClassesPrioritySets() getResourceDefClassesPrioritySets()
.forEach( .forEach(
classes -> { classes ->
classes.stream() classes.stream()
.parallel() .parallel()
.unordered() .unordered()
.forEach( .forEach(
c -> { c -> {
val type = c.getAnnotation(ResourceType.class); val type = c.getAnnotation(ResourceType.class);
if (type == null) return; if (type == null) return;
val map = GameData.getMapByResourceDef(c); val map = GameData.getMapByResourceDef(c);
if (map == null) return; if (map == null) return;
try { try {
loadFromResource(c, type, map, doReload); loadFromResource(c, type, map, doReload);
} catch (Exception e) { } catch (Exception e) {
errors.add(Pair.of(Arrays.toString(type.name()), e)); errors.add(Pair.of(Arrays.toString(type.name()), e));
} }
}); }));
});
errors.forEach( errors.forEach(
pair -> pair ->
Grasscutter.getLogger() Grasscutter.getLogger()
.error("Error loading resource file: " + pair.left(), pair.right())); .error("Error loading resource file: {}", pair.left(), pair.right()));
long endTime = System.nanoTime(); long endTime = System.nanoTime();
long ns = (endTime - startTime); // divide by 1000000 to get milliseconds. long ns = (endTime - startTime); // divide by 1000000 to get milliseconds.
Grasscutter.getLogger().debug("Loading resources took " + ns + "ns == " + ns / 1000000 + "ms"); Grasscutter.getLogger().debug("Loading resources took {}ns == {}ms", ns, ns / 1000000);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
protected static void loadFromResource( private static void loadFromResource(
Class<?> c, ResourceType type, Int2ObjectMap map, boolean doReload) throws Exception { Class<?> c, ResourceType type, Int2ObjectMap map, boolean doReload) throws Exception {
val simpleName = c.getSimpleName(); val simpleName = c.getSimpleName();
if (doReload || !loadedResources.contains(simpleName)) { if (doReload || !loadedResources.contains(simpleName)) {
@ -181,7 +180,7 @@ public final class ResourceLoader {
} }
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
protected static <T> void loadFromResource(Class<T> c, Path filename, Int2ObjectMap map) private static <T> void loadFromResource(Class<T> c, Path filename, Int2ObjectMap map)
throws Exception { throws Exception {
val results = val results =
switch (FileUtils.getFileExtension(filename)) { switch (FileUtils.getFileExtension(filename)) {
@ -200,7 +199,7 @@ public final class ResourceLoader {
} }
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
protected static <T> void loadFromResource(Class<T> c, String fileName, Int2ObjectMap map) private static <T> void loadFromResource(Class<T> c, String fileName, Int2ObjectMap map)
throws Exception { throws Exception {
JsonUtils.loadToList(getResourcePath("ExcelBinOutput/" + fileName), c) JsonUtils.loadToList(getResourcePath("ExcelBinOutput/" + fileName), c)
.forEach( .forEach(
@ -283,7 +282,7 @@ public final class ResourceLoader {
} }
}); });
Grasscutter.getLogger() Grasscutter.getLogger()
.debug("Loaded " + GameData.getSceneNpcBornData().size() + " SceneRouteDatas."); .debug("Loaded {} SceneRouteDatas.", GameData.getSceneNpcBornData().size());
} catch (IOException e) { } catch (IOException e) {
Grasscutter.getLogger().error("Failed to load SceneRouteData folder."); Grasscutter.getLogger().error("Failed to load SceneRouteData folder.");
} }
@ -404,7 +403,7 @@ public final class ResourceLoader {
.forEach(data -> loadAbilityData(data.Default)); .forEach(data -> loadAbilityData(data.Default));
} catch (IOException e) { } catch (IOException e) {
Grasscutter.getLogger() Grasscutter.getLogger()
.error("Error loading ability modifiers from path " + path.toString() + ": ", e); .error("Error loading ability modifiers from path {}: ", path.toString(), e);
} }
} }
@ -413,7 +412,7 @@ public final class ResourceLoader {
GameData.getAbilityHashes().put(Utils.abilityHash(data.abilityName), data.abilityName); GameData.getAbilityHashes().put(Utils.abilityHash(data.abilityName), data.abilityName);
var modifiers = data.modifiers; var modifiers = data.modifiers;
if (modifiers == null || modifiers.size() == 0) return; if (modifiers == null || modifiers.isEmpty()) return;
var name = data.abilityName; var name = data.abilityName;
var modifierEntry = new AbilityModifierEntry(name); var modifierEntry = new AbilityModifierEntry(name);
@ -466,7 +465,7 @@ public final class ResourceLoader {
path, String.class, new TypeToken<List<TalentData>>() {}.getType())); path, String.class, new TypeToken<List<TalentData>>() {}.getType()));
} catch (IOException e) { } catch (IOException e) {
Grasscutter.getLogger() Grasscutter.getLogger()
.error("Error loading ability modifiers from path " + path.toString() + ": ", e); .error("Error loading ability modifiers from path {}: ", path.toString(), e);
} }
} }
@ -533,7 +532,7 @@ public final class ResourceLoader {
}); });
} catch (IOException e) { } catch (IOException e) {
Grasscutter.getLogger() Grasscutter.getLogger()
.error("Error loading open config: no files found in " + folderName); .error("Error loading open config: no files found in {}", folderName);
return; return;
} }
} }
@ -589,7 +588,7 @@ public final class ResourceLoader {
} }
Grasscutter.getLogger() Grasscutter.getLogger()
.debug("Loaded " + GameData.getMainQuestDataMap().size() + " MainQuestDatas."); .debug("Loaded {} MainQuestDatas.", GameData.getMainQuestDataMap().size());
} }
public static void loadScriptSceneData() { public static void loadScriptSceneData() {
@ -607,7 +606,7 @@ public final class ResourceLoader {
} }
}); });
Grasscutter.getLogger() Grasscutter.getLogger()
.debug("Loaded " + GameData.getScriptSceneDataMap().size() + " ScriptSceneDatas."); .debug("Loaded {} ScriptSceneDatas.", GameData.getScriptSceneDataMap().size());
} catch (IOException e) { } catch (IOException e) {
Grasscutter.getLogger().debug("ScriptSceneData folder missing or empty."); Grasscutter.getLogger().debug("ScriptSceneData folder missing or empty.");
} }
@ -632,9 +631,8 @@ public final class ResourceLoader {
}); });
Grasscutter.getLogger() Grasscutter.getLogger()
.debug( .debug(
"Loaded " "Loaded {} HomeworldDefaultSaveDatas.",
+ GameData.getHomeworldDefaultSaveData().size() GameData.getHomeworldDefaultSaveData().size());
+ " HomeworldDefaultSaveDatas.");
} catch (IOException e) { } catch (IOException e) {
Grasscutter.getLogger().error("Failed to load HomeworldDefaultSave folder."); Grasscutter.getLogger().error("Failed to load HomeworldDefaultSave folder.");
} }
@ -647,7 +645,7 @@ public final class ResourceLoader {
path -> { path -> {
try { try {
val data = JsonUtils.loadToClass(path, SceneNpcBornData.class); val data = JsonUtils.loadToClass(path, SceneNpcBornData.class);
if (data.getBornPosList() == null || data.getBornPosList().size() == 0) { if (data.getBornPosList() == null || data.getBornPosList().isEmpty()) {
return; return;
} }
@ -659,7 +657,7 @@ public final class ResourceLoader {
} }
}); });
Grasscutter.getLogger() Grasscutter.getLogger()
.debug("Loaded " + GameData.getSceneNpcBornData().size() + " SceneNpcBornDatas."); .debug("Loaded {} SceneNpcBornDatas.", GameData.getSceneNpcBornData().size());
} catch (IOException e) { } catch (IOException e) {
Grasscutter.getLogger().error("Failed to load SceneNpcBorn folder."); Grasscutter.getLogger().error("Failed to load SceneNpcBorn folder.");
} }
@ -837,7 +835,6 @@ public final class ResourceLoader {
try { try {
JsonUtils.loadToList(getResourcePath("Server/SubfieldMapping.json"), SubfieldMapping.class) JsonUtils.loadToList(getResourcePath("Server/SubfieldMapping.json"), SubfieldMapping.class)
.forEach(entry -> subfieldMap.put(entry.getEntityId(), entry)); .forEach(entry -> subfieldMap.put(entry.getEntityId(), entry));
;
} catch (IOException | NullPointerException ignored) { } catch (IOException | NullPointerException ignored) {
} }
Grasscutter.getLogger().debug("Loaded {} subfield mappings.", subfieldMap.size()); Grasscutter.getLogger().debug("Loaded {} subfield mappings.", subfieldMap.size());
@ -851,7 +848,6 @@ public final class ResourceLoader {
JsonUtils.loadToList( JsonUtils.loadToList(
getResourcePath("Server/DropSubfieldMapping.json"), DropSubfieldMapping.class) getResourcePath("Server/DropSubfieldMapping.json"), DropSubfieldMapping.class)
.forEach(entry -> dropSubfieldMap.put(entry.getDropId(), entry)); .forEach(entry -> dropSubfieldMap.put(entry.getDropId(), entry));
;
} catch (IOException | NullPointerException ignored) { } catch (IOException | NullPointerException ignored) {
} }
Grasscutter.getLogger().debug("Loaded {} drop subfield mappings.", dropSubfieldMap.size()); Grasscutter.getLogger().debug("Loaded {} drop subfield mappings.", dropSubfieldMap.size());
@ -866,7 +862,6 @@ public final class ResourceLoader {
getResourcePath("Server/DropTableExcelConfigData.json"), getResourcePath("Server/DropTableExcelConfigData.json"),
DropTableExcelConfigData.class) DropTableExcelConfigData.class)
.forEach(entry -> dropTableExcelConfigDataMap.put(entry.getId(), entry)); .forEach(entry -> dropTableExcelConfigDataMap.put(entry.getId(), entry));
;
} catch (IOException | NullPointerException ignored) { } catch (IOException | NullPointerException ignored) {
} }
Grasscutter.getLogger() Grasscutter.getLogger()

View File

@ -1,5 +1,8 @@
package emu.grasscutter.data.binout; package emu.grasscutter.data.binout;
import lombok.Getter;
@Getter
public class AbilityEmbryoEntry { public class AbilityEmbryoEntry {
private String name; private String name;
private String[] abilities; private String[] abilities;
@ -10,12 +13,4 @@ public class AbilityEmbryoEntry {
this.name = avatarName; this.name = avatarName;
this.abilities = array; this.abilities = array;
} }
public String getName() {
return name;
}
public String[] getAbilities() {
return abilities;
}
} }

View File

@ -3,17 +3,18 @@ package emu.grasscutter.data.binout;
import com.google.gson.*; import com.google.gson.*;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.*;
public class AbilityMixinData implements Serializable { public class AbilityMixinData implements Serializable {
private static final long serialVersionUID = -2001232313615923575L; @Serial private static final long serialVersionUID = -2001232313615923575L;
public enum Type { public enum Type {
AttachToGadgetStateMixin, AttachToGadgetStateMixin,
AttachToStateIDMixin, AttachToStateIDMixin,
ShieldBarMixin, ShieldBarMixin,
TileAttackManagerMixin; TileAttackManagerMixin
} }
@SerializedName("$type") @SerializedName("$type")
@ -27,7 +28,7 @@ public class AbilityMixinData implements Serializable {
List<String> list = (new Gson()).fromJson(modifierName, listType); List<String> list = (new Gson()).fromJson(modifierName, listType);
return list; return list;
} else { } else {
return Arrays.asList(modifierName.getAsString()); return Collections.singletonList(modifierName.getAsString());
} }
} }
} }

View File

@ -3,11 +3,12 @@ package emu.grasscutter.data.binout;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import emu.grasscutter.data.common.DynamicFloat; import emu.grasscutter.data.common.DynamicFloat;
import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.ElementType;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import lombok.ToString; import lombok.ToString;
public class AbilityModifier implements Serializable { public class AbilityModifier implements Serializable {
private static final long serialVersionUID = -2001232313615923575L; @Serial private static final long serialVersionUID = -2001232313615923575L;
public State state; public State state;
@ -264,7 +265,7 @@ public class AbilityModifier implements Serializable {
TurnDirectionToPos, TurnDirectionToPos,
UpdateReactionDamage, UpdateReactionDamage,
UseSkillEliteSet, UseSkillEliteSet,
WidgetSkillStart; WidgetSkillStart
} }
@SerializedName("$type") @SerializedName("$type")

View File

@ -2,12 +2,13 @@ package emu.grasscutter.data.binout;
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
import java.util.*; import java.util.*;
import lombok.Getter;
public class AbilityModifierEntry { public class AbilityModifierEntry {
public List<AbilityModifierAction> onModifierAdded; public final List<AbilityModifierAction> onModifierAdded;
public List<AbilityModifierAction> onThinkInterval; @Getter public final List<AbilityModifierAction> onThinkInterval;
public List<AbilityModifierAction> onRemoved; @Getter public final List<AbilityModifierAction> onRemoved;
private final String name; // Custom value @Getter private final String name; // Custom value
public AbilityModifierEntry(String name) { public AbilityModifierEntry(String name) {
this.name = name; this.name = name;
@ -16,19 +17,7 @@ public class AbilityModifierEntry {
this.onRemoved = new ArrayList<>(); this.onRemoved = new ArrayList<>();
} }
public String getName() {
return name;
}
public List<AbilityModifierAction> getOnAdded() { public List<AbilityModifierAction> getOnAdded() {
return onModifierAdded; return onModifierAdded;
} }
public List<AbilityModifierAction> getOnThinkInterval() {
return onThinkInterval;
}
public List<AbilityModifierAction> getOnRemoved() {
return onRemoved;
}
} }

View File

@ -5,53 +5,22 @@ import emu.grasscutter.data.GameData;
import emu.grasscutter.game.quest.enums.QuestType; import emu.grasscutter.game.quest.enums.QuestType;
import java.util.*; import java.util.*;
import lombok.Data; import lombok.Data;
import lombok.Getter;
public class MainQuestData { public class MainQuestData {
private int id; @Getter private int id;
private int ICLLDPJFIMA; private int ICLLDPJFIMA;
private int series; @Getter private int series;
private QuestType type; @Getter private QuestType type;
private long titleTextMapHash; @Getter private long titleTextMapHash;
private int[] suggestTrackMainQuestList; @Getter private int[] suggestTrackMainQuestList;
private int[] rewardIdList; @Getter private int[] rewardIdList;
private SubQuestData[] subQuests; @Getter private SubQuestData[] subQuests;
private List<TalkData> talks; @Getter private List<TalkData> talks;
private long[] preloadLuaList; private long[] preloadLuaList;
public int getId() {
return id;
}
public int getSeries() {
return series;
}
public QuestType getType() {
return type;
}
public long getTitleTextMapHash() {
return titleTextMapHash;
}
public int[] getSuggestTrackMainQuestList() {
return suggestTrackMainQuestList;
}
public int[] getRewardIdList() {
return rewardIdList;
}
public SubQuestData[] getSubQuests() {
return subQuests;
}
public List<TalkData> getTalks() {
return talks;
}
public void onLoad() { public void onLoad() {
if (this.talks == null) this.talks = new ArrayList<>(); if (this.talks == null) this.talks = new ArrayList<>();
if (this.subQuests == null) this.subQuests = new SubQuestData[0]; if (this.subQuests == null) this.subQuests = new SubQuestData[0];

View File

@ -2,7 +2,9 @@ package emu.grasscutter.data.binout;
import emu.grasscutter.data.ResourceLoader.OpenConfigData; import emu.grasscutter.data.ResourceLoader.OpenConfigData;
import java.util.*; import java.util.*;
import lombok.Getter;
@Getter
public class OpenConfigEntry { public class OpenConfigEntry {
private final String name; private final String name;
private String[] addAbilities; private String[] addAbilities;
@ -25,46 +27,23 @@ public class OpenConfigEntry {
} }
} }
if (abilityList.size() > 0) { if (!abilityList.isEmpty()) {
this.addAbilities = abilityList.toArray(new String[0]); this.addAbilities = abilityList.toArray(new String[0]);
} }
if (modList.size() > 0) { if (!modList.isEmpty()) {
this.skillPointModifiers = modList.toArray(new SkillPointModifier[0]); this.skillPointModifiers = modList.toArray(new SkillPointModifier[0]);
} }
} }
public String getName() { @Getter
return name;
}
public String[] getAddAbilities() {
return addAbilities;
}
public int getExtraTalentIndex() {
return extraTalentIndex;
}
public SkillPointModifier[] getSkillPointModifiers() {
return skillPointModifiers;
}
public static class SkillPointModifier { public static class SkillPointModifier {
private int skillId; private final int skillId;
private int delta; private final int delta;
public SkillPointModifier(int skillId, int delta) { public SkillPointModifier(int skillId, int delta) {
this.skillId = skillId; this.skillId = skillId;
this.delta = delta; this.delta = delta;
} }
public int getSkillId() {
return skillId;
}
public int getDelta() {
return delta;
}
} }
} }

View File

@ -3,9 +3,10 @@ package emu.grasscutter.data.binout;
import emu.grasscutter.data.common.PointData; import emu.grasscutter.data.common.PointData;
import lombok.Getter; import lombok.Getter;
@Getter
public class ScenePointEntry { public class ScenePointEntry {
@Getter private final int sceneId; private final int sceneId;
@Getter private final PointData pointData; private final PointData pointData;
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
public ScenePointEntry(String name, PointData pointData) { public ScenePointEntry(String name, PointData pointData) {

View File

@ -10,7 +10,7 @@ public class TalentData implements Serializable {
ModifySkillCD, ModifySkillCD,
UnlockTalentParam, UnlockTalentParam,
AddTalentExtraLevel, AddTalentExtraLevel,
ModifyAbility; ModifyAbility
} }
@SerializedName("$type") @SerializedName("$type")

View File

@ -4,13 +4,14 @@ import emu.grasscutter.data.binout.config.fields.ConfigAbilityData;
import java.util.List; import java.util.List;
import lombok.Getter; import lombok.Getter;
@Getter
public class ConfigLevelEntity { public class ConfigLevelEntity {
@Getter private List<ConfigAbilityData> abilities; private List<ConfigAbilityData> abilities;
@Getter private List<ConfigAbilityData> monsterAbilities; private List<ConfigAbilityData> monsterAbilities;
@Getter private List<ConfigAbilityData> avatarAbilities; private List<ConfigAbilityData> avatarAbilities;
@Getter private List<ConfigAbilityData> teamAbilities; private List<ConfigAbilityData> teamAbilities;
@Getter private List<Integer> preloadMonsterEntityIDs; private List<Integer> preloadMonsterEntityIDs;
@Getter private String dropElemControlType; private String dropElemControlType;
} }

View File

@ -3,13 +3,14 @@ package emu.grasscutter.data.binout.routes;
// import emu.grasscutter.scripts.constants.IntValueEnum; // import emu.grasscutter.scripts.constants.IntValueEnum;
import lombok.Getter; import lombok.Getter;
@Getter
public enum RotAngleType /*implements IntValueEnum */ { public enum RotAngleType /*implements IntValueEnum */ {
ROT_NONE(-1), ROT_NONE(-1),
ROT_ANGLE_X(0), ROT_ANGLE_X(0),
ROT_ANGLE_Y(1), ROT_ANGLE_Y(1),
ROT_ANGLE_Z(2); ROT_ANGLE_Z(2);
@Getter private final int id; private final int id;
RotAngleType(int id) { RotAngleType(int id) {
this.id = id; this.id = id;

View File

@ -3,13 +3,14 @@ package emu.grasscutter.data.binout.routes;
// import emu.grasscutter.scripts.constants.IntValueEnum; // import emu.grasscutter.scripts.constants.IntValueEnum;
import lombok.Getter; import lombok.Getter;
@Getter
public enum RouteType /*implements IntValueEnum*/ { public enum RouteType /*implements IntValueEnum*/ {
Unknown(-1), Unknown(-1),
OneWay(0), OneWay(0),
Reciprocate(1), Reciprocate(1),
Loop(2); Loop(2);
@Getter private final int id; private final int id;
RouteType(int id) { RouteType(int id) {
this.id = id; this.id = id;

View File

@ -1,19 +1,10 @@
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
import lombok.Getter;
@Getter
public class CurveInfo { public class CurveInfo {
private String type; private String type;
private String arith; private String arith;
private float value; private float value;
public String getType() {
return type;
}
public String getArith() {
return arith;
}
public float getValue() {
return value;
}
} }

View File

@ -92,7 +92,7 @@ public class DynamicFloat {
} }
public static class StackOp { public static class StackOp {
public Op op; public final Op op;
public float fValue; public float fValue;
public String sValue; public String sValue;

View File

@ -1,24 +1,14 @@
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
import lombok.Getter;
@Getter
public class FightPropData { public class FightPropData {
private String propType; private String propType;
private FightProperty prop; private FightProperty prop;
private float value; private float value;
public String getPropType() {
return propType;
}
public float getValue() {
return value;
}
public FightProperty getProp() {
return prop;
}
public void onLoad() { public void onLoad() {
this.prop = FightProperty.getPropByName(propType); this.prop = FightProperty.getPropByName(propType);
} }

View File

@ -1,8 +1,10 @@
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import lombok.Getter;
// Used in excels // Used in excels
@Getter
public class ItemParamData { public class ItemParamData {
@SerializedName( @SerializedName(
value = "id", value = "id",
@ -21,18 +23,10 @@ public class ItemParamData {
this.count = count; this.count = count;
} }
public int getId() {
return id;
}
public int getItemId() { public int getItemId() {
return id; return id;
} }
public int getCount() {
return count;
}
public int getItemCount() { public int getItemCount() {
return count; return count;
} }

View File

@ -1,19 +1,14 @@
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
import lombok.Getter;
@Getter
public class ItemParamStringData { public class ItemParamStringData {
private int id; private int id;
private String count; private String count;
public ItemParamStringData() {} public ItemParamStringData() {}
public int getId() {
return id;
}
public String getCount() {
return count;
}
public ItemParamData toItemParamData() { public ItemParamData toItemParamData() {
if (count.contains(";")) { if (count.contains(";")) {
String[] split = count.split(";"); String[] split = count.split(";");

View File

@ -1,10 +1,11 @@
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
import emu.grasscutter.game.props.ItemUseOp; import emu.grasscutter.game.props.ItemUseOp;
import lombok.Getter;
public class ItemUseData { public class ItemUseData {
private ItemUseOp useOp; private ItemUseOp useOp;
private String[] useParam; @Getter private String[] useParam;
public ItemUseOp getUseOp() { public ItemUseOp getUseOp() {
if (useOp == null) { if (useOp == null) {
@ -12,8 +13,4 @@ public class ItemUseData {
} }
return useOp; return useOp;
} }
public String[] getUseParam() {
return useParam;
}
} }

View File

@ -1,24 +1,18 @@
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
import java.util.List; import java.util.List;
import lombok.Getter;
@Getter
public class OpenCondData { public class OpenCondData {
private String condType; private String condType;
private List<Integer> paramList; private List<Integer> paramList;
public String getCondType() { public void setCondType(String cType) {
return condType; condType = cType;
} }
public void setCondType(String condType) { public void setParamList(List<Integer> pList) {
condType = condType; paramList = pList;
}
public List<Integer> getParamList() {
return paramList;
}
public void setParamList(List<Integer> paramList) {
paramList = paramList;
} }
} }

View File

@ -1,14 +1,9 @@
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
import lombok.Getter;
@Getter
public class PropGrowCurve { public class PropGrowCurve {
private String type; private String type;
private String growCurve; private String growCurve;
public String getType() {
return this.type;
}
public String getGrowCurve() {
return this.growCurve;
}
} }

View File

@ -4,21 +4,22 @@ import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData; import emu.grasscutter.data.common.ItemParamData;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.Getter;
@ResourceType(name = "CombineExcelConfigData.json") @ResourceType(name = "CombineExcelConfigData.json")
public class CombineData extends GameResource { public class CombineData extends GameResource {
private int combineId; @Getter private int combineId;
private int playerLevel; @Getter private int playerLevel;
private boolean isDefaultShow; private boolean isDefaultShow;
private int combineType; @Getter private int combineType;
private int subCombineType; @Getter private int subCombineType;
private int resultItemId; @Getter private int resultItemId;
private int resultItemCount; @Getter private int resultItemCount;
private int scoinCost; @Getter private int scoinCost;
private List<ItemParamData> randomItems; @Getter private List<ItemParamData> randomItems;
private List<ItemParamData> materialItems; @Getter private List<ItemParamData> materialItems;
private String recipeType; @Getter private String recipeType;
@Override @Override
public int getId() { public int getId() {
@ -35,47 +36,7 @@ public class CombineData extends GameResource {
materialItems.stream().filter(item -> item.getId() > 0).collect(Collectors.toList()); materialItems.stream().filter(item -> item.getId() > 0).collect(Collectors.toList());
} }
public int getCombineId() {
return combineId;
}
public int getPlayerLevel() {
return playerLevel;
}
public boolean isDefaultShow() { public boolean isDefaultShow() {
return isDefaultShow; return isDefaultShow;
} }
public int getCombineType() {
return combineType;
}
public int getSubCombineType() {
return subCombineType;
}
public int getResultItemId() {
return resultItemId;
}
public int getResultItemCount() {
return resultItemCount;
}
public int getScoinCost() {
return scoinCost;
}
public List<ItemParamData> getRandomItems() {
return randomItems;
}
public List<ItemParamData> getMaterialItems() {
return materialItems;
}
public String getRecipeType() {
return recipeType;
}
} }

View File

@ -2,7 +2,9 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import emu.grasscutter.data.ResourceType.LoadPriority; import emu.grasscutter.data.ResourceType.LoadPriority;
import lombok.Getter;
@Getter
@ResourceType( @ResourceType(
name = {"CookBonusExcelConfigData.json"}, name = {"CookBonusExcelConfigData.json"},
loadPriority = LoadPriority.LOW) loadPriority = LoadPriority.LOW)
@ -17,22 +19,6 @@ public class CookBonusData extends GameResource {
return this.avatarId; return this.avatarId;
} }
public int getAvatarId() {
return avatarId;
}
public int getRecipeId() {
return recipeId;
}
public int[] getParamVec() {
return paramVec;
}
public int[] getComplexParamVec() {
return complexParamVec;
}
public int getReplacementItemId() { public int getReplacementItemId() {
return this.paramVec[0]; return this.paramVec[0];
} }

View File

@ -3,13 +3,14 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData; import emu.grasscutter.data.common.ItemParamData;
import java.util.List; import java.util.List;
import lombok.Getter;
@ResourceType( @ResourceType(
name = "EnvAnimalGatherExcelConfigData.json", name = "EnvAnimalGatherExcelConfigData.json",
loadPriority = ResourceType.LoadPriority.LOW) loadPriority = ResourceType.LoadPriority.LOW)
public class EnvAnimalGatherConfigData extends GameResource { public class EnvAnimalGatherConfigData extends GameResource {
private int animalId; @Getter private int animalId;
private String entityType; @Getter private String entityType;
private List<ItemParamData> gatherItemId; private List<ItemParamData> gatherItemId;
private String excludeWeathers; private String excludeWeathers;
private int aliveTime; private int aliveTime;
@ -21,15 +22,7 @@ public class EnvAnimalGatherConfigData extends GameResource {
return animalId; return animalId;
} }
public int getAnimalId() {
return animalId;
}
public String getEntityType() {
return entityType;
}
public ItemParamData getGatherItem() { public ItemParamData getGatherItem() {
return gatherItemId.size() > 0 ? gatherItemId.get(0) : null; return !gatherItemId.isEmpty() ? gatherItemId.get(0) : null;
} }
} }

View File

@ -3,17 +3,18 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import emu.grasscutter.data.common.FightPropData; import emu.grasscutter.data.common.FightPropData;
import java.util.ArrayList; import java.util.ArrayList;
import lombok.Getter;
@ResourceType(name = "EquipAffixExcelConfigData.json") @ResourceType(name = "EquipAffixExcelConfigData.json")
public class EquipAffixData extends GameResource { public class EquipAffixData extends GameResource {
private int affixId; private int affixId;
private int id; private int id;
private int level; @Getter private int level;
private long nameTextMapHash; @Getter private long nameTextMapHash;
private String openConfig; @Getter private String openConfig;
private FightPropData[] addProps; @Getter private FightPropData[] addProps;
private float[] paramList; @Getter private float[] paramList;
@Override @Override
public int getId() { public int getId() {
@ -24,29 +25,9 @@ public class EquipAffixData extends GameResource {
return id; return id;
} }
public int getLevel() {
return level;
}
public long getNameTextMapHash() {
return nameTextMapHash;
}
public String getOpenConfig() {
return openConfig;
}
public FightPropData[] getAddProps() {
return addProps;
}
public float[] getParamList() {
return paramList;
}
@Override @Override
public void onLoad() { public void onLoad() {
ArrayList<FightPropData> parsed = new ArrayList<FightPropData>(getAddProps().length); ArrayList<FightPropData> parsed = new ArrayList<>(getAddProps().length);
for (FightPropData prop : getAddProps()) { for (FightPropData prop : getAddProps()) {
if (prop.getPropType() != null && prop.getValue() != 0f) { if (prop.getPropType() != null && prop.getValue() != 0f) {
prop.onLoad(); prop.onLoad();

View File

@ -2,21 +2,18 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import emu.grasscutter.data.ResourceType.LoadPriority; import emu.grasscutter.data.ResourceType.LoadPriority;
import lombok.Getter;
@ResourceType(name = "FetterCharacterCardExcelConfigData.json", loadPriority = LoadPriority.HIGHEST) @ResourceType(name = "FetterCharacterCardExcelConfigData.json", loadPriority = LoadPriority.HIGHEST)
public class FetterCharacterCardData extends GameResource { public class FetterCharacterCardData extends GameResource {
private int avatarId; private int avatarId;
private int rewardId; @Getter private int rewardId;
@Override @Override
public int getId() { public int getId() {
return avatarId; return avatarId;
} }
public int getRewardId() {
return rewardId;
}
@Override @Override
public void onLoad() {} public void onLoad() {}
} }

View File

@ -4,6 +4,7 @@ import emu.grasscutter.data.*;
import emu.grasscutter.data.ResourceType.LoadPriority; import emu.grasscutter.data.ResourceType.LoadPriority;
import emu.grasscutter.data.common.OpenCondData; import emu.grasscutter.data.common.OpenCondData;
import java.util.List; import java.util.List;
import lombok.Getter;
@ResourceType( @ResourceType(
name = { name = {
@ -15,7 +16,7 @@ import java.util.List;
}, },
loadPriority = LoadPriority.HIGHEST) loadPriority = LoadPriority.HIGHEST)
public class FetterData extends GameResource { public class FetterData extends GameResource {
private int avatarId; @Getter private int avatarId;
private int fetterId; private int fetterId;
private List<OpenCondData> openCond; private List<OpenCondData> openCond;
@ -24,10 +25,6 @@ public class FetterData extends GameResource {
return fetterId; return fetterId;
} }
public int getAvatarId() {
return avatarId;
}
public List<OpenCondData> getOpenConds() { public List<OpenCondData> getOpenConds() {
return openCond; return openCond;
} }

View File

@ -1,14 +1,15 @@
package emu.grasscutter.data.excels; package emu.grasscutter.data.excels;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@ResourceType(name = "GatherExcelConfigData.json") @ResourceType(name = "GatherExcelConfigData.json")
public class GatherData extends GameResource { public class GatherData extends GameResource {
private int pointType; private int pointType;
private int id; private int id;
private int gadgetId; @Getter private int gadgetId;
private int itemId; @Getter private int itemId;
private int cd; // Probably hours @Getter private int cd; // Probably hours
private boolean isForbidGuest; private boolean isForbidGuest;
private boolean initDisableInteract; private boolean initDisableInteract;
@ -21,18 +22,6 @@ public class GatherData extends GameResource {
return id; return id;
} }
public int getGadgetId() {
return gadgetId;
}
public int getItemId() {
return itemId;
}
public int getCd() {
return cd;
}
public boolean isForbidGuest() { public boolean isForbidGuest() {
return isForbidGuest; return isForbidGuest;
} }

View File

@ -24,7 +24,7 @@ public class ItemData extends GameResource {
@Getter(onMethod_ = @Override) @Getter(onMethod_ = @Override)
private int id; private int id;
private int stackLimit = 1; private final int stackLimit = 1;
private int maxUseCount; private int maxUseCount;
private int rankLevel; private int rankLevel;
private String effectName; private String effectName;
@ -37,7 +37,7 @@ public class ItemData extends GameResource {
private int[] destroyReturnMaterialCount; private int[] destroyReturnMaterialCount;
// Enums // Enums
private ItemType itemType = ItemType.ITEM_NONE; private final ItemType itemType = ItemType.ITEM_NONE;
private MaterialType materialType = MaterialType.MATERIAL_NONE; private MaterialType materialType = MaterialType.MATERIAL_NONE;
private EquipType equipType = EquipType.EQUIP_NONE; private EquipType equipType = EquipType.EQUIP_NONE;
private String effectType; private String effectType;
@ -48,10 +48,10 @@ public class ItemData extends GameResource {
private int[] satiationParams; private int[] satiationParams;
// Usable item // Usable item
private ItemUseTarget useTarget = ItemUseTarget.ITEM_USE_TARGET_NONE; private final ItemUseTarget useTarget = ItemUseTarget.ITEM_USE_TARGET_NONE;
private List<ItemUseData> itemUse; private List<ItemUseData> itemUse;
private List<ItemUseAction> itemUseActions; private List<ItemUseAction> itemUseActions;
private boolean useOnGain = false; private final boolean useOnGain = false;
// Relic // Relic
private int mainPropDepotId; private int mainPropDepotId;
@ -79,7 +79,7 @@ public class ItemData extends GameResource {
private int comfort; private int comfort;
private List<Integer> furnType; private List<Integer> furnType;
private List<Integer> furnitureGadgetID; private List<Integer> furnitureGadgetID;
private SpecialFurnitureType specialFurnitureType = SpecialFurnitureType.NOT_SPECIAL; private final SpecialFurnitureType specialFurnitureType = SpecialFurnitureType.NOT_SPECIAL;
@SerializedName( @SerializedName(
value = "roomSceneId", value = "roomSceneId",

View File

@ -39,12 +39,10 @@ public class OpenStateData extends GameResource {
OPEN_STATE_COND_PARENT_QUEST OPEN_STATE_COND_PARENT_QUEST
} }
@Getter
public static class OpenStateCond { public static class OpenStateCond {
@Getter
private OpenStateCondType condType; private OpenStateCondType condType;
@Getter
private int param; private int param;
@Getter
private int param2; private int param2;
} }
} }

View File

@ -9,7 +9,7 @@ public class PlayerLevelData extends GameResource {
private int level; private int level;
private int exp; private int exp;
private int rewardId; private int rewardId;
private int expeditionLimitAdd = 0; private final int expeditionLimitAdd = 0;
private int unlockWorldLevel; private int unlockWorldLevel;
private long unlockDescTextMapHash; private long unlockDescTextMapHash;

View File

@ -25,7 +25,8 @@ public class ProudSkillData extends GameResource {
@Getter private long nameTextMapHash; @Getter private long nameTextMapHash;
@Transient private Iterable<ItemParamData> totalCostItems; @Transient private Iterable<ItemParamData> totalCostItems;
@Transient @Getter private Object2FloatMap<String> paramListMap = new Object2FloatOpenHashMap<>(); @Transient @Getter
private final Object2FloatMap<String> paramListMap = new Object2FloatOpenHashMap<>();
@Override @Override
public int getId() { public int getId() {

View File

@ -6,11 +6,12 @@ import emu.grasscutter.game.world.World;
import java.util.*; import java.util.*;
import lombok.Getter; import lombok.Getter;
@Getter
@ResourceType(name = "RefreshPolicyExcelConfigData.json") @ResourceType(name = "RefreshPolicyExcelConfigData.json")
public class RefreshPolicyExcelConfigData extends GameResource { public class RefreshPolicyExcelConfigData extends GameResource {
@Getter private int id; private int id;
@Getter private RefreshType type; private RefreshType type;
@Getter private String time; private String time;
private static int upperBound(List<Integer> list, int low, int high, int value) { private static int upperBound(List<Integer> list, int low, int high, int value) {
while (low < high) { while (low < high) {
@ -48,9 +49,9 @@ public class RefreshPolicyExcelConfigData extends GameResource {
upperBound( upperBound(
params, (int) params.get(0), (int) params.get(params.size() - 1), (int) temp); params, (int) params.get(0), (int) params.get(params.size() - 1), (int) temp);
var upper_bound = params.get(upper_bound_idx); var upper_bound = params.get(upper_bound_idx);
if (params.get(params.size() - 1) == upper_bound) { if (params.get(params.size() - 1).equals(upper_bound)) {
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7; return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
} else if (params.get(0) == upper_bound) { } else if (params.get(0).equals(upper_bound)) {
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7; return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
} }
return (params.get(upper_bound_idx - 1) - params.get(0)); return (params.get(upper_bound_idx - 1) - params.get(0));
@ -64,15 +65,15 @@ public class RefreshPolicyExcelConfigData extends GameResource {
upperBound( upperBound(
params, (int) params.get(0), (int) params.get(params.size() - 1), (int) temp); params, (int) params.get(0), (int) params.get(params.size() - 1), (int) temp);
var upper_bound = params.get(upper_bound_idx); var upper_bound = params.get(upper_bound_idx);
if (params.get(params.size() - 1) == upper_bound) { if (params.get(params.size() - 1).equals(upper_bound)) {
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7; return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
} else if (params.get(0) == upper_bound) { } else if (params.get(0).equals(upper_bound)) {
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7; return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
} }
return (params.get(upper_bound_idx - 1) - params.get(0)); return (params.get(upper_bound_idx - 1) - params.get(0));
} }
case REFRESH_DAYBEGIN_INTERVAL: case REFRESH_DAYBEGIN_INTERVAL:
if (params.size() == 0) return -1; if (params.isEmpty()) return -1;
return params.get(0) * 60 * 60 * 24; return params.get(0) * 60 * 60 * 24;
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -3,21 +3,18 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData; import emu.grasscutter.data.common.ItemParamData;
import java.util.List; import java.util.List;
import lombok.Getter;
@ResourceType(name = "RewardExcelConfigData.json") @ResourceType(name = "RewardExcelConfigData.json")
public class RewardData extends GameResource { public class RewardData extends GameResource {
public int rewardId; public int rewardId;
public List<ItemParamData> rewardItemList; @Getter public List<ItemParamData> rewardItemList;
@Override @Override
public int getId() { public int getId() {
return rewardId; return rewardId;
} }
public List<ItemParamData> getRewardItemList() {
return rewardItemList;
}
@Override @Override
public void onLoad() { public void onLoad() {
rewardItemList = rewardItemList.stream().filter(i -> i.getId() > 0).toList(); rewardItemList = rewardItemList.stream().filter(i -> i.getId() > 0).toList();

View File

@ -8,7 +8,7 @@ import lombok.Getter;
@ResourceType(name = "RewardPreviewExcelConfigData.json", loadPriority = LoadPriority.HIGH) @ResourceType(name = "RewardPreviewExcelConfigData.json", loadPriority = LoadPriority.HIGH)
public class RewardPreviewData extends GameResource { public class RewardPreviewData extends GameResource {
@Getter(onMethod_ = @Override) @Getter(onMethod = @__(@Override))
private int id; private int id;
private ItemParamStringData[] previewItems; private ItemParamStringData[] previewItems;
@ -25,7 +25,7 @@ public class RewardPreviewData extends GameResource {
Arrays.stream(this.previewItems) Arrays.stream(this.previewItems)
.filter(d -> d.getId() > 0 && d.getCount() != null && !d.getCount().isEmpty()) .filter(d -> d.getId() > 0 && d.getCount() != null && !d.getCount().isEmpty())
.map(ItemParamStringData::toItemParamData) .map(ItemParamStringData::toItemParamData)
.toArray(size -> new ItemParamData[size]); .toArray(ItemParamData[]::new);
} else { } else {
this.previewItemsArray = new ItemParamData[0]; this.previewItemsArray = new ItemParamData[0];
} }

View File

@ -5,25 +5,27 @@ import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData; import emu.grasscutter.data.common.ItemParamData;
import emu.grasscutter.game.shop.ShopInfo; import emu.grasscutter.game.shop.ShopInfo;
import java.util.List; import java.util.List;
import lombok.Getter;
@ResourceType(name = "ShopGoodsExcelConfigData.json") @ResourceType(name = "ShopGoodsExcelConfigData.json")
public class ShopGoodsData extends GameResource { public class ShopGoodsData extends GameResource {
private int goodsId; @Getter private int goodsId;
private int shopType; @Getter private int shopType;
private int itemId; @Getter private int itemId;
private int itemCount; @Getter private int itemCount;
private int costScoin; @Getter private int costScoin;
private int costHcoin; @Getter private int costHcoin;
private int costMcoin; @Getter private int costMcoin;
private List<ItemParamData> costItems; @Getter private List<ItemParamData> costItems;
private int minPlayerLevel; @Getter private int minPlayerLevel;
private int maxPlayerLevel; @Getter private int maxPlayerLevel;
private int buyLimit; @Getter private int buyLimit;
@Getter
@SerializedName( @SerializedName(
value = "subTabId", value = "subTabId",
alternate = {"secondarySheetId"}) alternate = {"secondarySheetId"})
@ -32,7 +34,7 @@ public class ShopGoodsData extends GameResource {
private String refreshType; private String refreshType;
private transient ShopInfo.ShopRefreshType refreshTypeEnum; private transient ShopInfo.ShopRefreshType refreshTypeEnum;
private int refreshParam; @Getter private int refreshParam;
@Override @Override
public void onLoad() { public void onLoad() {
@ -53,59 +55,7 @@ public class ShopGoodsData extends GameResource {
return getGoodsId(); return getGoodsId();
} }
public int getGoodsId() {
return goodsId;
}
public int getShopType() {
return shopType;
}
public int getItemId() {
return itemId;
}
public int getItemCount() {
return itemCount;
}
public int getCostScoin() {
return costScoin;
}
public int getCostHcoin() {
return costHcoin;
}
public int getCostMcoin() {
return costMcoin;
}
public List<ItemParamData> getCostItems() {
return costItems;
}
public int getMinPlayerLevel() {
return minPlayerLevel;
}
public int getMaxPlayerLevel() {
return maxPlayerLevel;
}
public int getBuyLimit() {
return buyLimit;
}
public int getSubTabId() {
return subTabId;
}
public ShopInfo.ShopRefreshType getRefreshType() { public ShopInfo.ShopRefreshType getRefreshType() {
return refreshTypeEnum; return refreshTypeEnum;
} }
public int getRefreshParam() {
return refreshParam;
}
} }

View File

@ -4,13 +4,15 @@ import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData; import emu.grasscutter.data.common.ItemParamData;
import lombok.*; import lombok.*;
@Setter
@Getter
@ResourceType(name = "StatuePromoteExcelConfigData.json") @ResourceType(name = "StatuePromoteExcelConfigData.json")
public class StatuePromoteData extends GameResource { public class StatuePromoteData extends GameResource {
@Getter @Setter private int level; private int level;
@Getter @Setter private int cityId; private int cityId;
@Getter @Setter private ItemParamData[] costItems; private ItemParamData[] costItems;
@Getter @Setter private int[] rewardIdList; private int[] rewardIdList;
@Getter @Setter private int stamina; private int stamina;
@Override @Override
public int getId() { public int getId() {

View File

@ -14,7 +14,7 @@ public class AchievementData extends GameResource {
private static final AtomicBoolean isDivided = new AtomicBoolean(); private static final AtomicBoolean isDivided = new AtomicBoolean();
private int goalId; private int goalId;
private int preStageAchievementId; private int preStageAchievementId;
private Set<Integer> groupAchievementIdList = new HashSet<>(); private final Set<Integer> groupAchievementIdList = new HashSet<>();
private boolean isParent; private boolean isParent;
private long titleTextMapHash; private long titleTextMapHash;
private long descTextMapHash; private long descTextMapHash;

View File

@ -15,9 +15,10 @@ public class ActivityCondExcelConfigData extends GameResource {
LogicType condComb; LogicType condComb;
List<ActivityConfigCondition> cond; List<ActivityConfigCondition> cond;
@Getter
public static class ActivityConfigCondition { public static class ActivityConfigCondition {
@Getter private ActivityConditions type; private ActivityConditions type;
@Getter private List<Integer> param; private List<Integer> param;
public int[] paramArray() { public int[] paramArray() {
return param.stream().mapToInt(Integer::intValue).toArray(); return param.stream().mapToInt(Integer::intValue).toArray();

View File

@ -5,11 +5,12 @@ import emu.grasscutter.game.shop.ShopType;
import java.util.List; import java.util.List;
import lombok.Getter; import lombok.Getter;
@Getter
@ResourceType(name = "ActivityShopOverallExcelConfigData.json") @ResourceType(name = "ActivityShopOverallExcelConfigData.json")
public class ActivityShopData extends GameResource { public class ActivityShopData extends GameResource {
@Getter private int scheduleId; private int scheduleId;
@Getter private ShopType shopType; private ShopType shopType;
@Getter private List<Integer> sheetList; private List<Integer> sheetList;
@Override @Override
public int getId() { public int getId() {

View File

@ -2,33 +2,22 @@ package emu.grasscutter.data.excels.avatar;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@ResourceType(name = "AvatarCostumeExcelConfigData.json") @ResourceType(name = "AvatarCostumeExcelConfigData.json")
public class AvatarCostumeData extends GameResource { public class AvatarCostumeData extends GameResource {
@SerializedName(value = "skinId", alternate = "costumeId") @SerializedName(value = "skinId", alternate = "costumeId")
private int skinId; private int skinId;
private int itemId; @Getter private int itemId;
private int characterId; @Getter private int characterId;
private int quality; @Getter private int quality;
@Override @Override
public int getId() { public int getId() {
return this.skinId; return this.skinId;
} }
public int getItemId() {
return this.itemId;
}
public int getCharacterId() {
return characterId;
}
public int getQuality() {
return quality;
}
@Override @Override
public void onLoad() { public void onLoad() {
GameData.getAvatarCostumeDataItemIdMap().put(this.getItemId(), this); GameData.getAvatarCostumeDataItemIdMap().put(this.getItemId(), this);

View File

@ -4,10 +4,11 @@ import emu.grasscutter.data.*;
import emu.grasscutter.data.common.CurveInfo; import emu.grasscutter.data.common.CurveInfo;
import java.util.*; import java.util.*;
import java.util.stream.Stream; import java.util.stream.Stream;
import lombok.Getter;
@ResourceType(name = "AvatarCurveExcelConfigData.json") @ResourceType(name = "AvatarCurveExcelConfigData.json")
public class AvatarCurveData extends GameResource { public class AvatarCurveData extends GameResource {
private int level; @Getter private int level;
private CurveInfo[] curveInfos; private CurveInfo[] curveInfos;
private Map<String, Float> curveInfoMap; private Map<String, Float> curveInfoMap;
@ -17,10 +18,6 @@ public class AvatarCurveData extends GameResource {
return this.level; return this.level;
} }
public int getLevel() {
return level;
}
public Map<String, Float> getCurveInfos() { public Map<String, Float> getCurveInfos() {
return curveInfoMap; return curveInfoMap;
} }

View File

@ -55,7 +55,7 @@ public class AvatarData extends GameResource {
@Getter @Getter
private IntList abilities; private IntList abilities;
@Getter @Getter
private List<String> abilitieNames = new ArrayList<>(); private final List<String> abilitieNames = new ArrayList<>();
@Getter @Getter
private List<Integer> fetters; private List<Integer> fetters;

View File

@ -1,21 +1,18 @@
package emu.grasscutter.data.excels.avatar; package emu.grasscutter.data.excels.avatar;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@ResourceType(name = "AvatarFlycloakExcelConfigData.json") @ResourceType(name = "AvatarFlycloakExcelConfigData.json")
public class AvatarFlycloakData extends GameResource { public class AvatarFlycloakData extends GameResource {
private int flycloakId; private int flycloakId;
private long nameTextMapHash; @Getter private long nameTextMapHash;
@Override @Override
public int getId() { public int getId() {
return this.flycloakId; return this.flycloakId;
} }
public long getNameTextMapHash() {
return nameTextMapHash;
}
@Override @Override
public void onLoad() {} public void onLoad() {}
} }

View File

@ -1,7 +1,9 @@
package emu.grasscutter.data.excels.avatar; package emu.grasscutter.data.excels.avatar;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@Getter
@ResourceType(name = "AvatarLevelExcelConfigData.json") @ResourceType(name = "AvatarLevelExcelConfigData.json")
public class AvatarLevelData extends GameResource { public class AvatarLevelData extends GameResource {
private int level; private int level;
@ -11,12 +13,4 @@ public class AvatarLevelData extends GameResource {
public int getId() { public int getId() {
return this.level; return this.level;
} }
public int getLevel() {
return level;
}
public int getExp() {
return exp;
}
} }

View File

@ -3,51 +3,28 @@ package emu.grasscutter.data.excels.avatar;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import emu.grasscutter.data.common.*; import emu.grasscutter.data.common.*;
import java.util.ArrayList; import java.util.ArrayList;
import lombok.Getter;
@ResourceType(name = "AvatarPromoteExcelConfigData.json") @ResourceType(name = "AvatarPromoteExcelConfigData.json")
public class AvatarPromoteData extends GameResource { public class AvatarPromoteData extends GameResource {
private int avatarPromoteId; @Getter private int avatarPromoteId;
private int promoteLevel; @Getter private int promoteLevel;
private int scoinCost; private int scoinCost;
private ItemParamData[] costItems; @Getter private ItemParamData[] costItems;
private int unlockMaxLevel; @Getter private int unlockMaxLevel;
private FightPropData[] addProps; @Getter private FightPropData[] addProps;
private int requiredPlayerLevel; @Getter private int requiredPlayerLevel;
@Override @Override
public int getId() { public int getId() {
return (avatarPromoteId << 8) + promoteLevel; return (avatarPromoteId << 8) + promoteLevel;
} }
public int getAvatarPromoteId() {
return avatarPromoteId;
}
public int getPromoteLevel() {
return promoteLevel;
}
public ItemParamData[] getCostItems() {
return costItems;
}
public int getCoinCost() { public int getCoinCost() {
return scoinCost; return scoinCost;
} }
public FightPropData[] getAddProps() {
return addProps;
}
public int getUnlockMaxLevel() {
return unlockMaxLevel;
}
public int getRequiredPlayerLevel() {
return requiredPlayerLevel;
}
@Override @Override
public void onLoad() { public void onLoad() {
// Trim item params // Trim item params

View File

@ -52,7 +52,7 @@ public class AvatarSkillDepotData extends GameResource {
this.elementType = ElementType.None; this.elementType = ElementType.None;
} }
// Set embryo abilities (if player skill depot) // Set embryo abilities (if player skill depot)
if (getSkillDepotAbilityGroup() != null && getSkillDepotAbilityGroup().length() > 0) { if (getSkillDepotAbilityGroup() != null && !getSkillDepotAbilityGroup().isEmpty()) {
AvatarConfig config = GameDepot.getPlayerAbilities().get(getSkillDepotAbilityGroup()); AvatarConfig config = GameDepot.getPlayerAbilities().get(getSkillDepotAbilityGroup());
if (config != null) { if (config != null) {
@ -67,7 +67,7 @@ public class AvatarSkillDepotData extends GameResource {
Optional.ofNullable(this.talents) Optional.ofNullable(this.talents)
.map(talents -> talents.get(0)) .map(talents -> talents.get(0))
.map(i -> GameData.getAvatarTalentDataMap().get((int) i)) .map(i -> GameData.getAvatarTalentDataMap().get((int) i))
.map(talentData -> talentData.getMainCostItemId()) .map(AvatarTalentData::getMainCostItemId)
.ifPresent(itemId -> this.talentCostItemId = itemId); .ifPresent(itemId -> this.talentCostItemId = itemId);
} }

View File

@ -4,18 +4,19 @@ import emu.grasscutter.data.*;
import emu.grasscutter.data.ResourceType.LoadPriority; import emu.grasscutter.data.ResourceType.LoadPriority;
import emu.grasscutter.data.common.FightPropData; import emu.grasscutter.data.common.FightPropData;
import java.util.ArrayList; import java.util.ArrayList;
import lombok.Getter;
@ResourceType(name = "AvatarTalentExcelConfigData.json", loadPriority = LoadPriority.HIGHEST) @ResourceType(name = "AvatarTalentExcelConfigData.json", loadPriority = LoadPriority.HIGHEST)
public class AvatarTalentData extends GameResource { public class AvatarTalentData extends GameResource {
private int talentId; private int talentId;
private int prevTalent; private int prevTalent;
private long nameTextMapHash; @Getter private long nameTextMapHash;
private String icon; @Getter private String icon;
private int mainCostItemId; @Getter private int mainCostItemId;
private int mainCostItemCount; @Getter private int mainCostItemCount;
private String openConfig; @Getter private String openConfig;
private FightPropData[] addProps; @Getter private FightPropData[] addProps;
private float[] paramList; @Getter private float[] paramList;
@Override @Override
public int getId() { public int getId() {
@ -26,37 +27,9 @@ public class AvatarTalentData extends GameResource {
return prevTalent; return prevTalent;
} }
public long getNameTextMapHash() {
return nameTextMapHash;
}
public String getIcon() {
return icon;
}
public int getMainCostItemId() {
return mainCostItemId;
}
public int getMainCostItemCount() {
return mainCostItemCount;
}
public String getOpenConfig() {
return openConfig;
}
public FightPropData[] getAddProps() {
return addProps;
}
public float[] getParamList() {
return paramList;
}
@Override @Override
public void onLoad() { public void onLoad() {
ArrayList<FightPropData> parsed = new ArrayList<FightPropData>(getAddProps().length); ArrayList<FightPropData> parsed = new ArrayList<>(getAddProps().length);
for (FightPropData prop : getAddProps()) { for (FightPropData prop : getAddProps()) {
if (prop.getPropType() != null || prop.getValue() == 0f) { if (prop.getPropType() != null || prop.getValue() == 0f) {
prop.onLoad(); prop.onLoad();

View File

@ -1,25 +1,15 @@
package emu.grasscutter.data.excels.codex; package emu.grasscutter.data.excels.codex;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@Getter
@ResourceType(name = {"MaterialCodexExcelConfigData.json"}) @ResourceType(name = {"MaterialCodexExcelConfigData.json"})
public class CodexMaterialData extends GameResource { public class CodexMaterialData extends GameResource {
private int Id; private int Id;
private int materialId; private int materialId;
private int sortOrder; private int sortOrder;
public int getSortOrder() {
return sortOrder;
}
public int getMaterialId() {
return materialId;
}
public int getId() {
return Id;
}
@Override @Override
public void onLoad() { public void onLoad() {
GameData.getCodexMaterialDataIdMap().put(this.getMaterialId(), this); GameData.getCodexMaterialDataIdMap().put(this.getMaterialId(), this);

View File

@ -1,31 +1,16 @@
package emu.grasscutter.data.excels.codex; package emu.grasscutter.data.excels.codex;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@ResourceType(name = {"QuestCodexExcelConfigData.json"}) @ResourceType(name = {"QuestCodexExcelConfigData.json"})
public class CodexQuestData extends GameResource { public class CodexQuestData extends GameResource {
private int Id; @Getter private int Id;
private int parentQuestId; @Getter private int parentQuestId;
private int chapterId; @Getter private int chapterId;
private int sortOrder; @Getter private int sortOrder;
private boolean isDisuse; private boolean isDisuse;
public int getParentQuestId() {
return parentQuestId;
}
public int getId() {
return Id;
}
public int getChapterId() {
return chapterId;
}
public int getSortOrder() {
return sortOrder;
}
public boolean getIsDisuse() { public boolean getIsDisuse() {
return isDisuse; return isDisuse;
} }

View File

@ -1,30 +1,19 @@
package emu.grasscutter.data.excels.codex; package emu.grasscutter.data.excels.codex;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@ResourceType(name = {"WeaponCodexExcelConfigData.json"}) @ResourceType(name = {"WeaponCodexExcelConfigData.json"})
public class CodexWeaponData extends GameResource { public class CodexWeaponData extends GameResource {
private int Id; @Getter private int Id;
private int weaponId; @Getter private int weaponId;
private int gadgetId; private int gadgetId;
private int sortOrder; @Getter private int sortOrder;
public int getSortOrder() {
return sortOrder;
}
public int getWeaponId() {
return weaponId;
}
public int getGadgetId() { public int getGadgetId() {
return weaponId; return weaponId;
} }
public int getId() {
return Id;
}
@Override @Override
public void onLoad() { public void onLoad() {
GameData.getCodexWeaponDataIdMap().put(this.getWeaponId(), this); GameData.getCodexWeaponDataIdMap().put(this.getWeaponId(), this);

View File

@ -9,7 +9,7 @@ import lombok.Getter;
@Getter @Getter
@ResourceType(name = "DungeonChallengeConfigData.json") @ResourceType(name = "DungeonChallengeConfigData.json")
public class DungeonChallengeConfigData extends GameResource { public class DungeonChallengeConfigData extends GameResource {
private int id; @Getter private int id;
private ChallengeType challengeType; private ChallengeType challengeType;
private boolean noSuccessHint; private boolean noSuccessHint;
private boolean noFailHint; private boolean noFailHint;
@ -42,10 +42,6 @@ public class DungeonChallengeConfigData extends GameResource {
alternate = {"NJBJIKAIENN"}) alternate = {"NJBJIKAIENN"})
private AllowAnimationType animationOnSubFail; private AllowAnimationType animationOnSubFail;
public int getId() {
return id;
}
public enum InterruptButtonType { public enum InterruptButtonType {
INTERRUPT_BUTTON_TYPE_NONE, INTERRUPT_BUTTON_TYPE_NONE,
INTERRUPT_BUTTON_TYPE_HOST, INTERRUPT_BUTTON_TYPE_HOST,

View File

@ -6,15 +6,17 @@ import emu.grasscutter.game.quest.enums.LogicType;
import java.util.List; import java.util.List;
import lombok.*; import lombok.*;
@Getter
@ResourceType(name = "DungeonPassExcelConfigData.json") @ResourceType(name = "DungeonPassExcelConfigData.json")
public class DungeonPassConfigData extends GameResource { public class DungeonPassConfigData extends GameResource {
@Getter private int id; private int id;
@Getter private LogicType logicType; private LogicType logicType;
@Getter @Setter private List<DungeonPassCondition> conds; @Setter private List<DungeonPassCondition> conds;
@Getter
public static class DungeonPassCondition { public static class DungeonPassCondition {
@Getter private DungeonPassConditionType condType; private DungeonPassConditionType condType;
@Getter int[] param; int[] param;
} }
@Override @Override

View File

@ -11,32 +11,32 @@ import javax.annotation.*;
import lombok.*; import lombok.*;
import lombok.experimental.FieldDefaults; import lombok.experimental.FieldDefaults;
@ResourceType(name = "QuestExcelConfigData.json")
@Getter @Getter
@ResourceType(name = "QuestExcelConfigData.json")
@ToString @ToString
public class QuestData extends GameResource { public class QuestData extends GameResource {
@Getter private int subId; private int subId;
@Getter private int mainId; private int mainId;
@Getter private int order; private int order;
@Getter private long descTextMapHash; private long descTextMapHash;
@Getter private boolean finishParent; private boolean finishParent;
@Getter private boolean isRewind; private boolean isRewind;
@Getter private LogicType acceptCondComb; private LogicType acceptCondComb;
@Getter private LogicType finishCondComb; private LogicType finishCondComb;
@Getter private LogicType failCondComb; private LogicType failCondComb;
@Getter private List<QuestAcceptCondition> acceptCond; private List<QuestAcceptCondition> acceptCond;
@Getter private List<QuestContentCondition> finishCond; private List<QuestContentCondition> finishCond;
@Getter private List<QuestContentCondition> failCond; private List<QuestContentCondition> failCond;
@Getter private List<QuestExecParam> beginExec; private List<QuestExecParam> beginExec;
@Getter private List<QuestExecParam> finishExec; private List<QuestExecParam> finishExec;
@Getter private List<QuestExecParam> failExec; private List<QuestExecParam> failExec;
@Getter private Guide guide; private Guide guide;
@Getter private List<Integer> trialAvatarList; private List<Integer> trialAvatarList;
@Getter private List<ItemParamData> gainItems; private List<ItemParamData> gainItems;
public static String questConditionKey( public static String questConditionKey(
@Nonnull Enum<?> type, int firstParam, @Nullable String paramsStr) { @Nonnull Enum<?> type, int firstParam, @Nullable String paramsStr) {

View File

@ -8,7 +8,7 @@ import lombok.Getter;
@ResourceType(name = "ReliquaryMainPropExcelConfigData.json") @ResourceType(name = "ReliquaryMainPropExcelConfigData.json")
@Getter @Getter
public class ReliquaryMainPropData extends GameResource { public class ReliquaryMainPropData extends GameResource {
@Getter(onMethod_ = @Override) @Getter(onMethod = @__(@Override))
private int id; private int id;
private int propDepotId; private int propDepotId;

View File

@ -2,12 +2,14 @@ package emu.grasscutter.data.excels.reliquary;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@ResourceType(name = "ReliquarySetExcelConfigData.json") @ResourceType(name = "ReliquarySetExcelConfigData.json")
public class ReliquarySetData extends GameResource { public class ReliquarySetData extends GameResource {
private int setId; private int setId;
private int[] setNeedNum; @Getter private int[] setNeedNum;
@Getter
@SerializedName( @SerializedName(
value = "equipAffixId", value = "equipAffixId",
alternate = {"EquipAffixId"}) alternate = {"EquipAffixId"})
@ -18,14 +20,6 @@ public class ReliquarySetData extends GameResource {
return setId; return setId;
} }
public int[] getSetNeedNum() {
return setNeedNum;
}
public int getEquipAffixId() {
return equipAffixId;
}
@Override @Override
public void onLoad() {} public void onLoad() {}
} }

View File

@ -9,7 +9,7 @@ import lombok.Getter;
@ResourceType(name = "SceneExcelConfigData.json") @ResourceType(name = "SceneExcelConfigData.json")
@Getter @Getter
public final class SceneData extends GameResource { public final class SceneData extends GameResource {
@Getter(onMethod_ = @Override) @Getter(onMethod = @__(@Override))
private int id; private int id;
@SerializedName("type") @SerializedName("type")

View File

@ -8,7 +8,7 @@ import lombok.Getter;
@ResourceType(name = "SceneTagConfigData.json") @ResourceType(name = "SceneTagConfigData.json")
@Getter @Getter
public final class SceneTagData extends GameResource { public final class SceneTagData extends GameResource {
@Getter(onMethod_ = @Override) @Getter(onMethod = @__(@Override))
private int id; private int id;
@SerializedName("DJCOAOBDIHP") @SerializedName("DJCOAOBDIHP")

View File

@ -30,8 +30,8 @@ public class TowerLevelData extends GameResource {
// Just packaging condition parameters for convenience. // Just packaging condition parameters for convenience.
@Getter @Getter
public class TowerCondTimeParams { public class TowerCondTimeParams {
private int param1; private final int param1;
private int minimumTimeInSeconds; private final int minimumTimeInSeconds;
public TowerCondTimeParams(int param1, int minimumTimeInSeconds) { public TowerCondTimeParams(int param1, int minimumTimeInSeconds) {
this.param1 = param1; this.param1 = param1;
@ -41,9 +41,9 @@ public class TowerLevelData extends GameResource {
@Getter @Getter
public class TowerCondHpParams { public class TowerCondHpParams {
private int sceneId; private final int sceneId;
private int configId; private final int configId;
private int minimumHpPercentage; private final int minimumHpPercentage;
public TowerCondHpParams(int sceneId, int configId, int minimumHpPercentage) { public TowerCondHpParams(int sceneId, int configId, int minimumHpPercentage) {
this.sceneId = sceneId; this.sceneId = sceneId;

View File

@ -2,7 +2,9 @@ package emu.grasscutter.data.excels.tower;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import java.util.List; import java.util.List;
import lombok.Getter;
@Getter
@ResourceType(name = "TowerScheduleExcelConfigData.json") @ResourceType(name = "TowerScheduleExcelConfigData.json")
public class TowerScheduleData extends GameResource { public class TowerScheduleData extends GameResource {
private int scheduleId; private int scheduleId;
@ -19,30 +21,11 @@ public class TowerScheduleData extends GameResource {
public void onLoad() { public void onLoad() {
super.onLoad(); super.onLoad();
this.schedules = this.schedules =
this.schedules.stream().filter(item -> item.getFloorList().size() > 0).toList(); this.schedules.stream().filter(item -> !item.getFloorList().isEmpty()).toList();
}
public int getScheduleId() {
return scheduleId;
}
public List<Integer> getEntranceFloorId() {
return entranceFloorId;
}
public List<ScheduleDetail> getSchedules() {
return schedules;
}
public int getMonthlyLevelConfigId() {
return monthlyLevelConfigId;
} }
@Getter
public static class ScheduleDetail { public static class ScheduleDetail {
private List<Integer> floorList; private List<Integer> floorList;
public List<Integer> getFloorList() {
return floorList;
}
} }
} }

View File

@ -10,7 +10,7 @@ import lombok.experimental.FieldDefaults;
@Data @Data
@FieldDefaults(level = AccessLevel.PRIVATE) @FieldDefaults(level = AccessLevel.PRIVATE)
public class TrialAvatarActivityDataData extends GameResource { public class TrialAvatarActivityDataData extends GameResource {
@Getter(onMethod_ = @Override) @Getter(onMethod = @__({@Override}))
private int id; private int id;
private int trialAvatarIndexId; private int trialAvatarIndexId;

View File

@ -1,7 +1,9 @@
package emu.grasscutter.data.excels.weapon; package emu.grasscutter.data.excels.weapon;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@Getter
@ResourceType(name = "WeaponLevelExcelConfigData.json") @ResourceType(name = "WeaponLevelExcelConfigData.json")
public class WeaponLevelData extends GameResource { public class WeaponLevelData extends GameResource {
private int level; private int level;
@ -11,12 +13,4 @@ public class WeaponLevelData extends GameResource {
public int getId() { public int getId() {
return this.level; return this.level;
} }
public int getLevel() {
return level;
}
public int[] getRequiredExps() {
return requiredExps;
}
} }

View File

@ -3,7 +3,9 @@ package emu.grasscutter.data.excels.weapon;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import emu.grasscutter.data.common.*; import emu.grasscutter.data.common.*;
import java.util.ArrayList; import java.util.ArrayList;
import lombok.Getter;
@Getter
@ResourceType(name = "WeaponPromoteExcelConfigData.json") @ResourceType(name = "WeaponPromoteExcelConfigData.json")
public class WeaponPromoteData extends GameResource { public class WeaponPromoteData extends GameResource {
@ -20,34 +22,6 @@ public class WeaponPromoteData extends GameResource {
return (weaponPromoteId << 8) + promoteLevel; return (weaponPromoteId << 8) + promoteLevel;
} }
public int getWeaponPromoteId() {
return weaponPromoteId;
}
public int getPromoteLevel() {
return promoteLevel;
}
public ItemParamData[] getCostItems() {
return costItems;
}
public int getCoinCost() {
return coinCost;
}
public FightPropData[] getAddProps() {
return addProps;
}
public int getUnlockMaxLevel() {
return unlockMaxLevel;
}
public int getRequiredPlayerLevel() {
return requiredPlayerLevel;
}
@Override @Override
public void onLoad() { public void onLoad() {
// Trim item params // Trim item params

View File

@ -4,19 +4,20 @@ import emu.grasscutter.data.*;
import emu.grasscutter.game.props.ClimateType; import emu.grasscutter.game.props.ClimateType;
import lombok.Getter; import lombok.Getter;
@Getter
@ResourceType(name = "WeatherExcelConfigData.json") @ResourceType(name = "WeatherExcelConfigData.json")
public class WeatherData extends GameResource { public class WeatherData extends GameResource {
@Getter private int areaID; private int areaID;
@Getter private int weatherAreaId; private int weatherAreaId;
@Getter private String maxHeightStr; private String maxHeightStr;
@Getter private int gadgetID; private int gadgetID;
@Getter private boolean isDefaultValid; private boolean isDefaultValid;
@Getter private String templateName; private String templateName;
@Getter private int priority; private int priority;
@Getter private String profileName; private String profileName;
@Getter private ClimateType defaultClimate; private ClimateType defaultClimate;
@Getter private boolean isUseDefault; private boolean isUseDefault;
@Getter private int sceneID; private int sceneID;
@Override @Override
public int getId() { public int getId() {

View File

@ -1,21 +1,18 @@
package emu.grasscutter.data.excels.world; package emu.grasscutter.data.excels.world;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import lombok.Getter;
@ResourceType(name = "WorldLevelExcelConfigData.json") @ResourceType(name = "WorldLevelExcelConfigData.json")
public class WorldLevelData extends GameResource { public class WorldLevelData extends GameResource {
private int level; private int level;
private int monsterLevel; @Getter private int monsterLevel;
@Override @Override
public int getId() { public int getId() {
return this.level; return this.level;
} }
public int getMonsterLevel() {
return monsterLevel;
}
@Override @Override
public void onLoad() {} public void onLoad() {}
} }

View File

@ -6,12 +6,18 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.world.*; import emu.grasscutter.game.world.*;
import emu.grasscutter.scripts.SceneIndexManager; import emu.grasscutter.scripts.SceneIndexManager;
import java.util.*; import java.util.*;
import lombok.Getter;
public class Grid { public class Grid {
public transient RTree<Map.Entry<GridPosition, Set<Integer>>, Geometry> gridOptimized = null; public transient RTree<Map.Entry<GridPosition, Set<Integer>>, Geometry> gridOptimized = null;
private transient Set<Integer> nearbyGroups = new HashSet<>(100); private final transient Set<Integer> nearbyGroups = new HashSet<>(100);
public Map<GridPosition, Set<Integer>> grid = new LinkedHashMap<>(); /**
* -- GETTER --
*
* @return The correctly loaded grid map.
*/
@Getter public Map<GridPosition, Set<Integer>> grid = new LinkedHashMap<>();
/** Creates an optimized cache of the grid. */ /** Creates an optimized cache of the grid. */
private void optimize() { private void optimize() {
@ -23,13 +29,6 @@ public class Grid {
} }
} }
/**
* @return The correctly loaded grid map.
*/
public Map<GridPosition, Set<Integer>> getGrid() {
return this.grid;
}
public Set<Integer> getNearbyGroups(int vision_level, Position position) { public Set<Integer> getNearbyGroups(int vision_level, Position position) {
this.optimize(); // Check to see if the grid is optimized. this.optimize(); // Check to see if the grid is optimized.

View File

@ -550,7 +550,7 @@ public final class DatabaseHelper {
.first(); .first();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Grasscutter.getLogger() Grasscutter.getLogger()
.debug("Error occurred while getting uid " + uid + "'s achievement data", e); .debug("Error occurred while getting uid {}'s achievement data", uid, e);
DatabaseManager.getGameDatabase().getCollection("achievements").deleteMany(eq("uid", uid)); DatabaseManager.getGameDatabase().getCollection("achievements").deleteMany(eq("uid", uid));
return null; return null;
} }

View File

@ -11,15 +11,12 @@ import dev.morphia.query.experimental.filters.Filters;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.Grasscutter.ServerRunMode; import emu.grasscutter.Grasscutter.ServerRunMode;
import emu.grasscutter.game.Account; import emu.grasscutter.game.Account;
import lombok.Getter;
public final class DatabaseManager { public final class DatabaseManager {
private static Datastore gameDatastore; @Getter private static Datastore gameDatastore;
private static Datastore dispatchDatastore; private static Datastore dispatchDatastore;
public static Datastore getGameDatastore() {
return gameDatastore;
}
public static Datastore getAccountDatastore() { public static Datastore getAccountDatastore() {
if (Grasscutter.getRunMode() == ServerRunMode.HYBRID) return gameDatastore; if (Grasscutter.getRunMode() == ServerRunMode.HYBRID) return gameDatastore;
else return dispatchDatastore; else return dispatchDatastore;

View File

@ -7,29 +7,35 @@ import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.utils.*; import emu.grasscutter.utils.*;
import java.util.*; import java.util.*;
import java.util.stream.Stream; import java.util.stream.Stream;
import lombok.Getter;
import lombok.Setter;
import org.bson.Document; import org.bson.Document;
@Entity(value = "accounts", useDiscriminator = false) @Entity(value = "accounts", useDiscriminator = false)
public class Account { public class Account {
@Id private String id; @Setter @Getter @Id private String id;
@Setter
@Getter
@Indexed(options = @IndexOptions(unique = true)) @Indexed(options = @IndexOptions(unique = true))
@Collation(locale = "simple", caseLevel = true) @Collation(locale = "simple", caseLevel = true)
private String username; private String username;
private String password; // Unused for now @Setter @Getter private String password; // Unused for now
private int reservedPlayerId; private int reservedPlayerId;
private String email; @Setter private String email;
private String token; @Setter @Getter private String token;
private String sessionKey; // Session token for dispatch server @Getter private String sessionKey; // Session token for dispatch server
private List<String> permissions; /** -- GETTER -- The collection of a player's permissions. */
private Locale locale; @Getter private final List<String> permissions;
private String banReason; @Setter @Getter private Locale locale;
private int banEndTime;
private int banStartTime; @Setter @Getter private String banReason;
@Setter @Getter private int banEndTime;
@Setter @Getter private int banStartTime;
private boolean isBanned; private boolean isBanned;
@Deprecated @Deprecated
@ -64,38 +70,6 @@ public class Account {
return (wildcardParts.length == permissionParts.length); return (wildcardParts.length == permissionParts.length);
} }
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public int getReservedPlayerUid() { public int getReservedPlayerUid() {
return this.reservedPlayerId; return this.reservedPlayerId;
} }
@ -113,52 +87,12 @@ public class Account {
} }
} }
public void setEmail(String email) {
this.email = email;
}
public String getSessionKey() {
return this.sessionKey;
}
public String generateSessionKey() { public String generateSessionKey() {
this.sessionKey = Utils.bytesToHex(Crypto.createSessionKey(32)); this.sessionKey = Utils.bytesToHex(Crypto.createSessionKey(32));
this.save(); this.save();
return this.sessionKey; return this.sessionKey;
} }
public Locale getLocale() {
return locale;
}
public void setLocale(Locale locale) {
this.locale = locale;
}
public String getBanReason() {
return banReason;
}
public void setBanReason(String banReason) {
this.banReason = banReason;
}
public int getBanEndTime() {
return banEndTime;
}
public void setBanEndTime(int banEndTime) {
this.banEndTime = banEndTime;
}
public int getBanStartTime() {
return banStartTime;
}
public void setBanStartTime(int banStartTime) {
this.banStartTime = banStartTime;
}
public boolean isBanned() { public boolean isBanned() {
if (banEndTime > 0 && banEndTime < System.currentTimeMillis() / 1000) { if (banEndTime > 0 && banEndTime < System.currentTimeMillis() / 1000) {
this.isBanned = false; this.isBanned = false;
@ -175,11 +109,6 @@ public class Account {
this.isBanned = isBanned; this.isBanned = isBanned;
} }
/** The collection of a player's permissions. */
public List<String> getPermissions() {
return this.permissions;
}
public boolean addPermission(String permission) { public boolean addPermission(String permission) {
if (this.permissions.contains(permission)) return false; if (this.permissions.contains(permission)) return false;
this.permissions.add(permission); this.permissions.add(permission);

View File

@ -1,7 +1,9 @@
package emu.grasscutter.game; package emu.grasscutter.game;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import lombok.Getter;
@Getter
public class CoopRequest { public class CoopRequest {
private final Player requester; private final Player requester;
private final long requestTime; private final long requestTime;
@ -13,18 +15,6 @@ public class CoopRequest {
this.expireTime = this.requestTime + 10000; this.expireTime = this.requestTime + 10000;
} }
public Player getRequester() {
return requester;
}
public long getRequestTime() {
return requestTime;
}
public long getExpireTime() {
return expireTime;
}
public boolean isExpired() { public boolean isExpired() {
return System.currentTimeMillis() > getExpireTime(); return System.currentTimeMillis() > getExpireTime();
} }

View File

@ -12,20 +12,21 @@ import java.util.*;
import lombok.Getter; import lombok.Getter;
public class Ability { public class Ability {
@Getter private AbilityData data; @Getter private final AbilityData data;
@Getter private GameEntity owner; @Getter private final GameEntity owner;
@Getter private Player playerOwner; @Getter private final Player playerOwner;
@Getter private AbilityManager manager; @Getter private final AbilityManager manager;
@Getter private Map<String, AbilityModifierController> modifiers = new HashMap<>(); @Getter private final Map<String, AbilityModifierController> modifiers = new HashMap<>();
@Getter private Object2FloatMap<String> abilitySpecials = new Object2FloatOpenHashMap<>(); @Getter private final Object2FloatMap<String> abilitySpecials = new Object2FloatOpenHashMap<>();
@Getter @Getter
private static Map<String, Object2FloatMap<String>> abilitySpecialsModified = new HashMap<>(); private static final Map<String, Object2FloatMap<String>> abilitySpecialsModified =
new HashMap<>();
@Getter private int hash; @Getter private final int hash;
@Getter private Set<Integer> avatarSkillStartIds; @Getter private final Set<Integer> avatarSkillStartIds;
public Ability(AbilityData data, GameEntity owner, Player playerOwner) { public Ability(AbilityData data, GameEntity owner, Player playerOwner) {
this.data = data; this.data = data;

Some files were not shown because too many files have changed in this diff Show More