-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add default poll duration & threshold to config
Signed-off-by: applenick <[email protected]>
- Loading branch information
Showing
4 changed files
with
43 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
package dev.pgm.community.polls; | ||
|
||
import static tc.oc.pgm.util.text.TextParser.parseDuration; | ||
|
||
import dev.pgm.community.feature.config.FeatureConfigImpl; | ||
import java.time.Duration; | ||
import org.bukkit.configuration.Configuration; | ||
|
||
public class PollConfig extends FeatureConfigImpl { | ||
|
||
private static final String KEY = "polls"; | ||
|
||
private Duration duration; | ||
private PollThreshold threshold; | ||
|
||
public PollConfig(Configuration config) { | ||
super(KEY, config); | ||
} | ||
|
||
public Duration getDuration() { | ||
return duration; | ||
} | ||
|
||
public PollThreshold getThreshold() { | ||
return threshold; | ||
} | ||
|
||
@Override | ||
public void reload(Configuration config) { | ||
super.reload(config); | ||
this.duration = parseDuration(config.getString(KEY + ".duration")); | ||
this.threshold = PollThreshold.valueOf(config.getString(KEY + ".threshold").toUpperCase()); | ||
} | ||
} |
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