mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-22 11:55:12 +01:00
That's enough accidentally using this import.
This commit is contained in:
parent
27582743d3
commit
453c77f192
@ -5,7 +5,7 @@ import com.badbones69.crazyauctions.frame.storage.enums.StorageType;
|
|||||||
import com.badbones69.crazyauctions.frame.storage.types.file.FileLoader;
|
import com.badbones69.crazyauctions.frame.storage.types.file.FileLoader;
|
||||||
import com.badbones69.crazyauctions.frame.storage.types.file.yaml.keys.Comment;
|
import com.badbones69.crazyauctions.frame.storage.types.file.yaml.keys.Comment;
|
||||||
import com.badbones69.crazyauctions.frame.storage.types.file.yaml.keys.Header;
|
import com.badbones69.crazyauctions.frame.storage.types.file.yaml.keys.Header;
|
||||||
import com.badbones69.crazyauctions.frame.storage.types.file.yaml.keys.Path;
|
import com.badbones69.crazyauctions.frame.storage.types.file.yaml.keys.FilePath;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.simpleyaml.configuration.comments.CommentType;
|
import org.simpleyaml.configuration.comments.CommentType;
|
||||||
import org.simpleyaml.configuration.file.YamlFile;
|
import org.simpleyaml.configuration.file.YamlFile;
|
||||||
@ -54,12 +54,12 @@ public class YamlLoader implements FileLoader {
|
|||||||
for (Field field : this.getClass().getDeclaredFields()) {
|
for (Field field : this.getClass().getDeclaredFields()) {
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
|
|
||||||
Path path = field.getDeclaredAnnotation(Path.class);
|
FilePath filePath = field.getDeclaredAnnotation(FilePath.class);
|
||||||
Comment comment = field.getDeclaredAnnotation(Comment.class);
|
Comment comment = field.getDeclaredAnnotation(Comment.class);
|
||||||
|
|
||||||
if (path == null) return;
|
if (filePath == null) return;
|
||||||
|
|
||||||
Object pathValue = getValue(path.value(), comment.value());
|
Object pathValue = getValue(filePath.value(), comment.value());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
field.set(this.fileExtension, pathValue instanceof String stringValue ? stringValue.translateEscapes() : pathValue);
|
field.set(this.fileExtension, pathValue instanceof String stringValue ? stringValue.translateEscapes() : pathValue);
|
||||||
@ -67,7 +67,7 @@ public class YamlLoader implements FileLoader {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
setComments(path.value(), comment.value());
|
setComments(filePath.value(), comment.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
Header header = this.fileExtension.getClass().getDeclaredAnnotation(Header.class);
|
Header header = this.fileExtension.getClass().getDeclaredAnnotation(Header.class);
|
||||||
|
@ -9,7 +9,7 @@ import java.lang.annotation.Target;
|
|||||||
|
|
||||||
@Target(ElementType.FIELD)
|
@Target(ElementType.FIELD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Path {
|
public @interface FilePath {
|
||||||
|
|
||||||
@NotNull String value();
|
@NotNull String value();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user