Skip to content

Commit c928033

Browse files
committed
Merge branch 'civ14' of github.com:Civclassic/CivModCore into civ14
2 parents 83be12b + b97a80f commit c928033

File tree

12 files changed

+47
-37
lines changed

12 files changed

+47
-37
lines changed

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ CivModCore
33

44
Versions:
55

6+
* 1.7.5 - Spigot 1.14.4 (No explicit support for 1.14 prior to 1.14.4)
7+
68
* 1.7.0 - Spigot 1.13.2 (No explicit support for 1.13 or 1.13.1)
79

810
* 1.6.1 - Spigot 1.12 (Mercury Removed -- incompatible with plugins that rely on Mercury hooks)
@@ -25,16 +27,10 @@ To use CivModCore, your Main Plugin class must extend ACivMod:
2527
{
2628

2729
}
28-
29-
In addition to that, you must override getPluginName for log messages:
30-
31-
protected String getPluginName() {
32-
return "MyPluginsName";
33-
}
3430

3531
CivModCore implements onEnable/onLoad, and as such an extending plugin must Override and call super:
3632

37-
https://github.com/Bergecraft/CivModCore/blob/master/src/vg/civcraft/mc/civmodcore/ACivMod.java#L108
33+
https://github.com/DevotedMC/CivModCore/blob/master/src/main/java/vg/civcraft/mc/civmodcore/ACivMod.java#L34
3834

3935
@Override
4036
public void onEnable()

src/main/java/vg/civcraft/mc/civmodcore/ACivMod.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public void info(String message, Object... vars) {
122122
}
123123

124124
/**
125-
* Live activatable debug message (using {@link Config#DebugLog} to decide) at
125+
* Live activatable debug message (using plugin's config.yml top level debug tag to decide) at
126126
* INFO level.
127127
*
128128
* Skipped if DebugLog is false.
@@ -134,7 +134,7 @@ public void debug(String message) {
134134
}
135135

136136
/**
137-
* Live activatable debug message (using {@link Config#DebugLog} to decide) at
137+
* Live activatable debug message (using plugin's config.yml top level debug tag to decide) at
138138
* INFO level with ellipsis notation shorcut for defered injection argument
139139
* array.
140140
*

src/main/java/vg/civcraft/mc/civmodcore/dao/ConnectionPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class ConnectionPool {
3737
* @param database
3838
* The database to use
3939
* @param poolSize
40-
* The maximum size of the connection pool (< 10 recommended)
40+
* The maximum size of the connection pool (under 10 recommended)
4141
* @param connectionTimeout
4242
* The longest a query can run until timeout occurs (1-5s recommended)
4343
* @param idleTimeout

src/main/java/vg/civcraft/mc/civmodcore/dao/ManagedDatasource.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,36 @@
3333
*
3434
* To convert existing plugins, do the following:
3535
*
36-
* 1. Take existing database version code and refactor it. a. Any CREATE, UPDATE, ALTER, or similar statements, convert
36+
* <ol><li> Take existing database version code and refactor it.
37+
* <ol><li> Any CREATE, UPDATE, ALTER, or similar statements, convert
3738
* to a List of Strings and pass them into ManagedDatasource as a Migration using
38-
* {@link #registerMigration(Integer, boolean, String...)} b. Find your prepared statements. Convert the string
39-
* resources as static final in your plugin's DAO layer. c. Remove any "is database alive" check code. It's not needed.
40-
* d. Remove any version management code that remains e. DO react to the results of the {@link #upgradeDatabase} call.
41-
* i. If false is returned, terminate your plugin. ii. If false is returned and your plugin is critical to a host of
42-
* other plugins, terminate the server. iii. If an Exception is thrown, I strongly recommend you consider it a "false"
43-
* return value and react accordingly. f. Note: Create a "first" migration at index -1 that ignores errors and copies
39+
* {@link #registerMigration(int, boolean, String...)}</li>
40+
* <li>Find your prepared statements. Convert the string resources as static final in your plugin's DAO layer.</li>
41+
* <li>Remove any "is database alive" check code. It's not needed.</li>
42+
* <li>Remove any version management code that remains</li>
43+
* <li>DO react to the results of the {@link #updateDatabase} call.
44+
* <ol><li> If false is returned, terminate your plugin. <li>
45+
* <li>If false is returned and your plugin is critical to a host of other plugins, terminate the server.</li>
46+
* <li>If an Exception is thrown, I strongly recommend you consider it a "false" return value and react
47+
* accordingly.</li></ol></li>
48+
* <li>Note: Create a "first" migration at index -1 that ignores errors and copies
4449
* any "current" migration state data from the db_version or equivalent table into the <code>managed_plugin_data</code>
45-
* table. 2. Throughout your plugin, ensure that PreparedStatements are "created" new each request and against a newly
50+
* table.</li></ol></li>
51+
* <li>Throughout your plugin, ensure that PreparedStatements are "created" new each request and against a newly
4652
* retrieved Connection (using {@link #getConnection()} of this class). Don't worry about PrepareStatements. The driver
47-
* will manage caching them efficiently. 3. Make sure you release Connections using {@link Connection#close()} as soon
48-
* as you can (when done with them). a. Don't hold on to Connections. b. Close them. c. Use "try-with-resources"
49-
* where-ever possible so that they are auto-closed. 4. If you have loops to insert a bunch of similar records, convert
50-
* it to a batch. Find instructions in {@link #ManagedDatasource}. 5. If you have special needs like atomic
53+
* will manage caching them efficiently.</li>
54+
* <li>Make sure you release Connections using {@link Connection#close()} as soon as you can
55+
* (when done with them).
56+
* <ol><li>Don't hold on to Connections.</li>
57+
* <li>Close them.</li>
58+
* <li>Use "try-with-resources" where-ever possible so that they are auto-closed.</li></ol></li>
59+
* <li>If you have loops to insert a bunch of similar records, convert
60+
* it to a batch. Find instructions in {@link #ManagedDatasource}.</li>
61+
* <li>If you have special needs like atomic
5162
* multi-statement, do all your work on a single Connection and return it to a clean state when you are done. (turn
52-
* auto-commit back on, ensure all transactions are committed, etc.)
63+
* auto-commit back on, ensure all transactions are committed, etc.)</li></ol>
5364
*
54-
* That should cover most cases. Note that points 2 & 3 are critical. Point 1 is required. Point 4 and 5 are highly
65+
* That should cover most cases. Note that points 2 and 3 are critical. Point 1 is required. Point 4 and 5 are highly
5566
* recommended.
5667
*
5768
* @author ProgrammerDan

src/main/java/vg/civcraft/mc/civmodcore/dao/package-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
*
44
* Wraps HikariCP for easy connection pooling.
55
*
6-
* Plugins should use the {@lnk ManagedDatasource} class.
6+
* Plugins should use the {@link ManagedDatasource} class.
77
*
88
* If you know what you're doing and know that the Managed class isn't fit for you,
99
* you can directly leverage {@link ConnectionPool}.
1010
*
1111
* @author ProgrammerDan
1212
*
1313
*/
14-
package vg.civcraft.mc.civmodcore.dao;
14+
package vg.civcraft.mc.civmodcore.dao;

src/main/java/vg/civcraft/mc/civmodcore/locations/chunkmeta/ChunkMeta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public World getWorld() {
9494
* Sets the cache state, which specifies whether this instance has changed since
9595
* it was last synced with the database and needs to be written back there
9696
*
97-
* @param dirty New dirty state
97+
* @param state New dirty state
9898
*/
9999
public void setCacheState(CacheState state) {
100100
this.cacheState = this.cacheState.progress(state);

src/main/java/vg/civcraft/mc/civmodcore/locations/chunkmeta/api/ChunkMetaAPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public class ChunkMetaAPI {
2828
*
2929
* @param <T> BlockBasedChunkMeta subclass
3030
* @param <D> BlockDataObject subclass
31+
* @param <S> StorageEngine subclass
3132
* @param plugin Your plugin
32-
* @param chunkMetaClass BlockBasedChunkMeta subclass class object
3333
* @param emptyChunkCreator Lambda supplying new empty instances of your
3434
* BlockBasedChunkMeta class
3535
* @return API access object for block based chunk metadata

src/main/java/vg/civcraft/mc/civmodcore/locations/chunkmeta/api/ChunkMetaView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public T getChunkMeta(Chunk chunk) {
9595
* Retrieves chunk metadata for the given chunk with the given for this specific
9696
* plugin
9797
*
98-
* @param chunk Chunk to get metadata for
98+
* @param location Location of the chunk to get metadata for
9999
* @return ChunkMeta for the requested chunk owned by this plugin, possibly null
100100
* if no such data exists yet
101101
*/

src/main/java/vg/civcraft/mc/civmodcore/locations/chunkmeta/block/BlockBasedChunkMeta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public final void put(Location location, D blockData) {
233233
/**
234234
* Removes the entry at the given block if one exists and returns it
235235
*
236-
* @param location Block to remove data from, may not be null
236+
* @param block Block to remove data from, may not be null
237237
*/
238238
public final D remove(Block block) {
239239
if (block == null) {

src/main/java/vg/civcraft/mc/civmodcore/ratelimiting/RateLimiter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public boolean pullToken(UUID uuid) {
5050
/**
5151
* Attempts to pull a token for the player with the given UUID
5252
*
53-
* @param uuid UUID of the player
53+
* @param player Bukkit Player object for the player
5454
* @return True if a token was available and successfully consumed, false
5555
* otherwise
5656
*/

0 commit comments

Comments
 (0)