-
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.
Updated status lib and added IRegenerationHelper
- Loading branch information
1 parent
f62f202
commit a5112bc
Showing
7 changed files
with
158 additions
and
71 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
64 changes: 64 additions & 0 deletions
64
...c/main/java/net/sourcewriters/spigot/rwg/legacy/api/regeneration/IRegenerationHelper.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,64 @@ | ||
package net.sourcewriters.spigot.rwg.legacy.api.regeneration; | ||
|
||
import org.bukkit.Chunk; | ||
import org.bukkit.Location; | ||
|
||
import net.sourcewriters.spigot.rwg.legacy.api.util.java.info.IStatus; | ||
|
||
public interface IRegenerationHelper { | ||
|
||
/** | ||
* Regenerates a chunk | ||
* | ||
* @param chunk to be regenerated | ||
* | ||
* @return the current status object to keep track of the process | ||
*/ | ||
IStatus regenerate(Chunk chunk); | ||
|
||
/** | ||
* Regenerates a range of chunks | ||
* | ||
* @param chunks to be regenerated | ||
* | ||
* @return the current status objects to keep track of the process | ||
* | ||
* The status of this method will contain two different status objects. | ||
* The first one is a normal Status object which keeps track of the | ||
* chunk progress while the other object is just a reference which | ||
* passes the values of the current chunk through, basically the second | ||
* one is the same as the one of {@code regenerate(Chunk)} while the | ||
* other one is to keep track how many chunks are done and if the | ||
* process is complete. | ||
*/ | ||
IStatus[] regenerate(Chunk[] chunks); | ||
|
||
/** | ||
* Gets the chunks between two positions | ||
* | ||
* @param first position | ||
* @param second position | ||
* | ||
* @return the chunks between the first and second position | ||
*/ | ||
Chunk[] getChunks(Location first, Location second); | ||
|
||
/** | ||
* Gets the chunks between two positions and merges them with an existing array | ||
* of chunks | ||
* | ||
* @param first position | ||
* @param second position | ||
* @param array the existing array of chunks | ||
* | ||
* @return the chunks between the first and second position | ||
*/ | ||
default Chunk[] getChunksAndMerge(Location first, Location second, Chunk... array) { | ||
Chunk[] current = getChunks(first, second); | ||
Chunk[] output = new Chunk[current.length + array.length]; | ||
System.arraycopy(current, 0, output, 0, current.length); | ||
System.arraycopy(array, 0, output, current.length, array.length); | ||
return output; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
legacy-api/src/main/java/net/sourcewriters/spigot/rwg/legacy/api/util/java/info/IStatus.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,35 @@ | ||
package net.sourcewriters.spigot.rwg.legacy.api.util.java.info; | ||
|
||
public interface IStatus { | ||
|
||
void done(); | ||
|
||
boolean isDone(); | ||
|
||
boolean success(); | ||
|
||
boolean failed(); | ||
|
||
boolean skip(); | ||
|
||
boolean cancel(); | ||
|
||
void add(); | ||
|
||
void add(long amount); | ||
|
||
void add(IStatus status); | ||
|
||
long getTotal(); | ||
|
||
long getMarked(); | ||
|
||
long getFailed(); | ||
|
||
long getSuccess(); | ||
|
||
long getSkipped(); | ||
|
||
long getCancelled(); | ||
|
||
} |
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
Oops, something went wrong.