forked from Crazy-Crew/CrazyCrates
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci-skip] stash dev environment features
- Loading branch information
1 parent
75999df
commit 206e42d
Showing
6 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
|
||
public enum Environment { | ||
PRODUCTION, | ||
ENVIRONMENT | ||
DEVELOPMENT | ||
} |
16 changes: 16 additions & 0 deletions
16
common/src/main/java/com/badbones69/crazycrates/common/interfaces/Manifest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.badbones69.crazycrates.common.interfaces; | ||
|
||
import com.badbones69.crazycrates.common.enums.Environment; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Manifest { | ||
|
||
Environment environment(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
paper/src/main/java/com/badbones69/crazycrates/managers/storage/StorageManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.badbones69.crazycrates.managers.storage; | ||
|
||
import com.badbones69.crazycrates.common.enums.Environment; | ||
import com.badbones69.crazycrates.common.interfaces.Manifest; | ||
|
||
@Manifest(environment = Environment.DEVELOPMENT) | ||
public class StorageManager { | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
paper/src/main/java/com/badbones69/crazycrates/managers/storage/interfaces/Storage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.badbones69.crazycrates.managers.storage.interfaces; | ||
|
||
import com.badbones69.crazycrates.common.enums.Environment; | ||
import com.badbones69.crazycrates.common.interfaces.Manifest; | ||
import java.io.File; | ||
|
||
@Manifest(environment = Environment.DEVELOPMENT) | ||
public interface Storage<T> { | ||
|
||
T getAccess(); | ||
|
||
default void start() {} | ||
|
||
default void save() {} | ||
|
||
default void reload() {} | ||
|
||
File getFile(); | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
paper/src/main/java/com/badbones69/crazycrates/managers/storage/interfaces/YamlStorage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.badbones69.crazycrates.managers.storage.interfaces; | ||
|
||
import com.badbones69.crazycrates.CrazyCrates; | ||
import com.badbones69.crazycrates.common.enums.Environment; | ||
import com.badbones69.crazycrates.common.interfaces.Manifest; | ||
import com.ryderbelserion.vital.paper.api.files.FileManager; | ||
import org.bukkit.configuration.file.YamlConfiguration; | ||
|
||
@Manifest(environment = Environment.DEVELOPMENT) | ||
public abstract class YamlStorage implements Storage<YamlConfiguration> { | ||
|
||
protected CrazyCrates plugin = CrazyCrates.getPlugin(); | ||
protected FileManager fileManager = this.plugin.getFileManager(); | ||
|
||
@Override | ||
public void start() { | ||
this.fileManager.addFile(getFile()); | ||
} | ||
|
||
@Override | ||
public void save() { | ||
this.fileManager.saveFile(getFile().getName()); | ||
} | ||
|
||
@Override | ||
public void reload() { | ||
this.fileManager.addFile(getFile()); | ||
} | ||
|
||
@Override | ||
public final YamlConfiguration getAccess() { | ||
return this.fileManager.getFile(getFile().getName()).getConfiguration(); | ||
} | ||
} |