forked from alkarinv/BattleArena
-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Competitions with players are prioritized now when running /<arena> join without specifying a map - Added option to config to allow for /<arena> join without a map to randomly select a map - Added a config updater to automatically include new config options to old configs whenever they are added
- Loading branch information
Showing
10 changed files
with
207 additions
and
14 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
25 changes: 25 additions & 0 deletions
25
plugin/src/main/java/org/battleplugins/arena/config/Updater.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,25 @@ | ||
package org.battleplugins.arena.config; | ||
|
||
import org.battleplugins.arena.config.updater.ConfigUpdater; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* An annotation used over a configurable class to specify | ||
* which updater should be used to update the configuration | ||
* across versions. | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Updater { | ||
|
||
/** | ||
* The class of the updater. | ||
* | ||
* @return the class of the updater | ||
*/ | ||
Class<? extends ConfigUpdater<?>> value(); | ||
} |
20 changes: 20 additions & 0 deletions
20
plugin/src/main/java/org/battleplugins/arena/config/updater/ConfigUpdater.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 org.battleplugins.arena.config.updater; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* An updater for updating a config file across versions. | ||
*/ | ||
public interface ConfigUpdater<T> { | ||
|
||
/** | ||
* Builds the updater for the config file. | ||
* <p> | ||
* The key of the map will be the version to update | ||
* to, and the value will be the updater step to update | ||
* the config file. | ||
* | ||
* @return the updater for the config file | ||
*/ | ||
Map<String, UpdaterStep<T>> buildUpdaters(); | ||
} |
17 changes: 17 additions & 0 deletions
17
plugin/src/main/java/org/battleplugins/arena/config/updater/UpdaterStep.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,17 @@ | ||
package org.battleplugins.arena.config.updater; | ||
|
||
import org.bukkit.configuration.ConfigurationSection; | ||
|
||
/** | ||
* An updater step for updating a config file across versions. | ||
*/ | ||
public interface UpdaterStep<T> { | ||
|
||
/** | ||
* Updates the config file to the specified version. | ||
* | ||
* @param config the config | ||
* @param instance the config instance | ||
*/ | ||
void update(ConfigurationSection config, T instance); | ||
} |
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