-
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.
persist nether sprint count; update watcher message spacing
- Loading branch information
Showing
11 changed files
with
129 additions
and
33 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
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
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
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
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
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
57 changes: 57 additions & 0 deletions
57
src/main/java/city/thefloating/floatyplugin/soul/Otzar.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,57 @@ | ||
package city.thefloating.floatyplugin.soul; | ||
|
||
import city.thefloating.floatyplugin.config.HoconConfigurateWrapper; | ||
import com.google.inject.Inject; | ||
import com.google.inject.name.Named; | ||
import dev.tehbrian.tehlib.configurate.AbstractDataConfig; | ||
import org.spongepowered.configurate.CommentedConfigurationNode; | ||
import org.spongepowered.configurate.ConfigurateException; | ||
import org.spongepowered.configurate.hocon.HoconConfigurationLoader; | ||
import org.spongepowered.configurate.objectmapping.ConfigSerializable; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.UUID; | ||
|
||
/** | ||
* Stores persistent data for souls via a YAML config. | ||
* <p> | ||
* <a href="https://en.wikipedia.org/wiki/Guf">If you're curious about the name.</a> | ||
*/ | ||
public final class Otzar extends AbstractDataConfig<HoconConfigurateWrapper, Otzar.Data> { | ||
|
||
@Inject | ||
public Otzar(final @Named("dataFolder") Path dataFolder) { | ||
super(new HoconConfigurateWrapper(dataFolder.resolve("otzar.conf"), HoconConfigurationLoader.builder() | ||
.path(dataFolder.resolve("otzar.conf")) | ||
.defaultOptions(opts -> opts.implicitInitialization(true)) | ||
.build())); | ||
} | ||
|
||
public void save() throws ConfigurateException { | ||
final CommentedConfigurationNode rootNode = Objects.requireNonNull(this.configurateWrapper.get()); | ||
rootNode.set(this.getDataClass(), this.data); | ||
this.configurateWrapper.save(); | ||
} | ||
|
||
public Map<UUID, Data.Spirit> spirits() { | ||
return this.data().spirits(); | ||
} | ||
|
||
@Override | ||
protected Class<Otzar.Data> getDataClass() { | ||
return Otzar.Data.class; | ||
} | ||
|
||
@ConfigSerializable | ||
public record Data(Map<UUID, Spirit> spirits) { | ||
|
||
@ConfigSerializable | ||
public record Spirit(int netherInfractions) { | ||
|
||
} | ||
|
||
} | ||
|
||
} |
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
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
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
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