mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 04:12:54 +08:00
Format code [skip actions]
This commit is contained in:
parent
6080297be9
commit
22e953b636
@ -4,9 +4,8 @@ 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 emu.grasscutter.utils.objects.DropType;
|
import emu.grasscutter.utils.objects.DropType;
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
public class AbilityModifier implements Serializable {
|
public class AbilityModifier implements Serializable {
|
||||||
private static final long serialVersionUID = -2001232313615923575L;
|
private static final long serialVersionUID = -2001232313615923575L;
|
||||||
|
@ -8,11 +8,10 @@ import emu.grasscutter.game.world.*;
|
|||||||
import emu.grasscutter.utils.objects.DropType;
|
import emu.grasscutter.utils.objects.DropType;
|
||||||
import it.unimi.dsi.fastutil.floats.FloatArrayList;
|
import it.unimi.dsi.fastutil.floats.FloatArrayList;
|
||||||
import it.unimi.dsi.fastutil.ints.*;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
import lombok.val;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import lombok.val;
|
||||||
|
|
||||||
public interface JsonAdapters {
|
public interface JsonAdapters {
|
||||||
class DynamicFloatAdapter extends TypeAdapter<DynamicFloat> {
|
class DynamicFloatAdapter extends TypeAdapter<DynamicFloat> {
|
||||||
@ -56,8 +55,7 @@ public interface JsonAdapters {
|
|||||||
class DropTypeAdapter extends TypeAdapter<DropType> {
|
class DropTypeAdapter extends TypeAdapter<DropType> {
|
||||||
@Override
|
@Override
|
||||||
public void write(JsonWriter out, DropType value) throws IOException {
|
public void write(JsonWriter out, DropType value) throws IOException {
|
||||||
if (value.isString())
|
if (value.isString()) out.value(value.getAsString());
|
||||||
out.value(value.getAsString());
|
|
||||||
else out.value(value.getAsInt());
|
else out.value(value.getAsInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import emu.grasscutter.game.world.*;
|
|||||||
import emu.grasscutter.utils.JsonAdapters.*;
|
import emu.grasscutter.utils.JsonAdapters.*;
|
||||||
import emu.grasscutter.utils.objects.*;
|
import emu.grasscutter.utils.objects.*;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
@ -14,7 +14,8 @@ public final class DropType {
|
|||||||
|
|
||||||
public DropType(String value) {
|
public DropType(String value) {
|
||||||
this.raw = value;
|
this.raw = value;
|
||||||
this.value = switch (value) {
|
this.value =
|
||||||
|
switch (value) {
|
||||||
default -> Integer.parseInt(value);
|
default -> Integer.parseInt(value);
|
||||||
case "ForceDrop" -> 2;
|
case "ForceDrop" -> 2;
|
||||||
};
|
};
|
||||||
@ -31,8 +32,7 @@ public final class DropType {
|
|||||||
* @return The drop type value as a string.
|
* @return The drop type value as a string.
|
||||||
*/
|
*/
|
||||||
public String getAsString() {
|
public String getAsString() {
|
||||||
if (this.raw instanceof String)
|
if (this.raw instanceof String) return (String) this.raw;
|
||||||
return (String) this.raw;
|
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,8 +40,7 @@ public final class DropType {
|
|||||||
* @return The drop type value as an integer.
|
* @return The drop type value as an integer.
|
||||||
*/
|
*/
|
||||||
public int getAsInt() {
|
public int getAsInt() {
|
||||||
if (this.raw instanceof Integer)
|
if (this.raw instanceof Integer) return (int) this.raw;
|
||||||
return (int) this.raw;
|
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user