Skip to content

Commit 9cb6466

Browse files
committed
First major work on 6.0.0
1 parent a2affaf commit 9cb6466

File tree

23 files changed

+578
-490
lines changed

23 files changed

+578
-490
lines changed

build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ plugins{
1111

1212
def ver = new Version(major: 5, minor: 2, revision: 3)
1313

14+
allprojects {
15+
apply plugin: 'com.jfrog.bintray'
16+
apply plugin: 'maven-publish'
17+
apply plugin: 'java-library'
18+
apply plugin: 'com.github.johnrengelman.shadow'
19+
20+
group = "org.botblock"
21+
version = "$ver"
22+
23+
repositories {
24+
mavenCentral()
25+
jcenter()
26+
}
27+
28+
dependencies {
29+
api group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.7.2'
30+
api group: 'org.json', name: 'json', version: '20200518'
31+
api group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '2.8.0'
32+
api group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
33+
}
34+
}
35+
1436
group = "org.botblock"
1537
version = "$ver"
1638

core/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
plugins {
2+
id 'java'
3+
}

src/main/java/org/botblock/javabotblockapi/BotBlockAPI.java renamed to core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,23 @@
1515
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
1616
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
18-
package org.botblock.javabotblockapi;
1918

20-
import org.botblock.javabotblockapi.requests.CheckUtil;
21-
import org.botblock.javabotblockapi.requests.PostAction;
19+
package org.botblock.javabotblockapi.core;
20+
21+
import org.botblock.javabotblockapi.core.requests.CheckUtil;
2222

2323
import javax.annotation.Nonnull;
2424
import java.util.HashMap;
2525
import java.util.Map;
2626

2727
/**
2828
* Class used to define the auth-tokens used for the different sites.
29-
* <br>The instance of this class will be used in the {@link PostAction PostAction} class.
30-
*
31-
* <p>Use the {@link org.botblock.javabotblockapi.BotBlockAPI.Builder BotBlockAPI.Builder} class for easy creation.
29+
*
30+
* <p>Use the {@link org.botblock.javabotblockapi.core.BotBlockAPI.Builder BotBlockAPI.Builder} class for easy creation.
3231
*/
3332
public class BotBlockAPI{
3433
public static final int DEFAULT_DELAY = 30;
35-
34+
3635
private final Map<String, String> tokens;
3736
private final int updateDelay;
3837

@@ -46,33 +45,33 @@ private BotBlockAPI(@Nonnull Map<String, String> tokens, int updateDelay){
4645
this.tokens = tokens;
4746
this.updateDelay = updateDelay;
4847
}
49-
48+
5049
public Map<String, String> getTokens(){
5150
return tokens;
5251
}
53-
52+
5453
public int getUpdateDelay(){
5554
return updateDelay;
5655
}
57-
56+
5857
/**
59-
* Builder class to create an instance of {@link org.botblock.javabotblockapi.BotBlockAPI BotBlockAPI}
58+
* Builder class to create an instance of {@link org.botblock.javabotblockapi.core.BotBlockAPI BotBlockAPI}
6059
*/
6160
public static class Builder{
6261
private Map<String, String> tokens = new HashMap<>();
6362
private int updateDelay = DEFAULT_DELAY;
64-
63+
6564
/**
6665
* Empty constructor to get the class.
6766
*/
6867
public Builder(){}
69-
68+
7069
/**
71-
* Adds the provided {@link org.botblock.javabotblockapi.Site Site name} and token to the Map.
70+
* Adds the provided {@link org.botblock.javabotblockapi.core.Site Site name} and token to the Map.
7271
* <br>Entries with the same key will be overwritten.
7372
*
7473
* @param site
75-
* The {@link org.botblock.javabotblockapi.Site Site} to get the name from.
74+
* The {@link org.botblock.javabotblockapi.core.Site Site} to get the name from.
7675
* @param token
7776
* The API token from the corresponding bot list. May not be null or empty.
7877
* <br>You may receive the API token from the bot list.
@@ -86,12 +85,12 @@ public Builder(){}
8685
*/
8786
public Builder addAuthToken(@Nonnull Site site, @Nonnull String token){
8887
CheckUtil.notEmpty(token, "Token");
89-
88+
9089
tokens.put(site.getSite(), token);
91-
90+
9291
return this;
9392
}
94-
93+
9594
/**
9695
* Adds the provided Site name and token to the Map.
9796
* <br>Entries with the same key will be overwritten.
@@ -113,10 +112,10 @@ public Builder addAuthToken(@Nonnull String site, @Nonnull String token){
113112
CheckUtil.notEmpty(token, "Token");
114113

115114
tokens.put(site, token);
116-
115+
117116
return this;
118117
}
119-
118+
120119
/**
121120
* Sets the provided Map as the new Map.
122121
* <br><b>This will overwrite every previously set entry!</b>
@@ -131,9 +130,9 @@ public Builder addAuthToken(@Nonnull String site, @Nonnull String token){
131130
*/
132131
public Builder setAuthTokens(@Nonnull Map<String, String> tokens){
133132
CheckUtil.notEmpty(tokens, "Tokens");
134-
133+
135134
this.tokens = tokens;
136-
135+
137136
return this;
138137
}
139138

@@ -151,19 +150,19 @@ public Builder setAuthTokens(@Nonnull Map<String, String> tokens){
151150
*/
152151
public Builder setUpdateDelay(@Nonnull Integer updateDelay){
153152
CheckUtil.condition(updateDelay < 2, "UpdateDelay may not be less than 2.");
154-
153+
155154
this.updateDelay = updateDelay;
156-
155+
157156
return this;
158157
}
159-
158+
160159
/**
161-
* Builds the instance of {@link org.botblock.javabotblockapi.BotBlockAPI BotBlockAPI}.
162-
*
160+
* Builds the instance of {@link org.botblock.javabotblockapi.core.BotBlockAPI BotBlockAPI}.
161+
*
163162
* @throws java.lang.NullPointerException
164163
* When the Tokens Map is empty.
165164
*
166-
* @return The built, usable {@link org.botblock.javabotblockapi.BotBlockAPI BotBlockAPI}.
165+
* @return The built, usable {@link org.botblock.javabotblockapi.core.BotBlockAPI BotBlockAPI}.
167166
*/
168167
public BotBlockAPI build(){
169168
CheckUtil.notEmpty(tokens, "Tokens");

src/main/java/org/botblock/javabotblockapi/Site.java renamed to core/src/main/java/org/botblock/javabotblockapi/core/Site.java

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,14 @@
1515
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
1616
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
18-
package org.botblock.javabotblockapi;
18+
package org.botblock.javabotblockapi.core;
1919

20-
import org.botblock.javabotblockapi.annotations.DeprecatedSince;
21-
import org.botblock.javabotblockapi.annotations.PlannedRemoval;
20+
import org.botblock.javabotblockapi.core.annotations.DeprecatedSince;
21+
import org.botblock.javabotblockapi.core.annotations.PlannedRemoval;
2222

2323
/**
2424
* Enum class containing all sites currently supported by BotBlock.org.
25-
*
26-
* <p>The fields can be used in:
27-
* <ul>
28-
* <li>{@link org.botblock.javabotblockapi.requests.GetBotAction GetBotAction}</li>
29-
* <li>{@link org.botblock.javabotblockapi.requests.GetListAction GetListAction} or</li>
30-
* <li>{@link org.botblock.javabotblockapi.BotBlockAPI.Builder BotBlockAPI.Builder}</li>
31-
* </ul>
32-
*
25+
*
3326
* @since 2.1.0
3427
*/
3528
public enum Site {
@@ -81,7 +74,7 @@ public enum Site {
8174

8275
/**
8376
* <a href="https://discordbots.co" target="_blank">discordbots.co</a>
84-
*
77+
*
8578
* @since 5.2.3
8679
*/
8780
DISCORDBOTS_CO("discordbots.co"),
@@ -98,7 +91,7 @@ public enum Site {
9891

9992
/**
10093
* <a href="https://discordextremelist.xyz" target="_blank">discordextremelist.xyz</a>
101-
*
94+
*
10295
* @since 2.3.3
10396
*/
10497
DISCORDEXTREMELIST_XYZ("discordextremelist.xyz"),
@@ -110,7 +103,7 @@ public enum Site {
110103

111104
/**
112105
* <a href="https://discordlistology.com" target="_blank">discordlistology.com</a>
113-
*
106+
*
114107
* @since 5.2.1
115108
*/
116109
DISCORDLISTOLOGY_COM("discordlistology.com"),
@@ -132,9 +125,9 @@ public enum Site {
132125

133126
/**
134127
* <a href="https://vultrex.io" target="_blank">vultrex.io</a>
135-
*
128+
*
136129
* @since 5.2.1
137-
*
130+
*
138131
* @deprecated Renamed to {@link #DISCORDBOTS_CO DISCORDBOTS_CO}
139132
* <br>Planned removal in v5.2.5
140133
*/
@@ -150,17 +143,17 @@ public enum Site {
150143

151144
/**
152145
* <a href="https://yabl.xyz" target="_blank">yabl.xyz</a>
153-
*
146+
*
154147
* @since 2.1.1
155148
*/
156149
YABL_XYZ("yabl.xyz");
157-
150+
158151
private final String site;
159-
152+
160153
Site(String site){
161154
this.site = site;
162155
}
163-
156+
164157
/**
165158
* Gives the ID of the selected site, which is used as ID in the BotBlock.org API.
166159
*

src/main/java/org/botblock/javabotblockapi/annotations/DeprecatedSince.java renamed to core/src/main/java/org/botblock/javabotblockapi/core/annotations/DeprecatedSince.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
1818

19-
package org.botblock.javabotblockapi.annotations;
19+
package org.botblock.javabotblockapi.core.annotations;
2020

2121
import java.lang.annotation.*;
2222

2323
/**
2424
* Annotation used to indicate since when an Object is deprecated.
25-
* <br>This is always paired with the {@link java.lang.Deprecated @Deprecated} annotation.
25+
* <br>This is always paired with the {@link Deprecated @Deprecated} annotation.
2626
*
2727
* <p>A replacement may be mentioned with the {@link #replacements() replacements String array} but is not guaranteed.
2828
* <br>Anything annotated with this should be avoided as it may be removed in a future release.

src/main/java/org/botblock/javabotblockapi/annotations/PlannedRemoval.java renamed to core/src/main/java/org/botblock/javabotblockapi/core/annotations/PlannedRemoval.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
1818

19-
package org.botblock.javabotblockapi.annotations;
19+
package org.botblock.javabotblockapi.core.annotations;
2020

2121
import java.lang.annotation.*;
2222

2323
/**
2424
* Annotation to mark an Object to be planned for removal.
25-
* <br>This is often paired with the {@link java.lang.Deprecated Deprecated} and {@link org.botblock.javabotblockapi.annotations.DeprecatedSince DeprecatedSince}
25+
* <br>This is often paired with the {@link Deprecated Deprecated} and {@link DeprecatedSince DeprecatedSince}
2626
* annotations.
2727
*
2828
* <p>This annotation will always contain {@link #version() the version} in which the annotated Object will be removed.

src/main/java/org/botblock/javabotblockapi/annotations/package-info.java renamed to core/src/main/java/org/botblock/javabotblockapi/core/annotations/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
/**
2020
* The different annotations used to mark various Objects with it.
2121
*/
22-
package org.botblock.javabotblockapi.annotations;
22+
package org.botblock.javabotblockapi.core.annotations;

src/main/java/org/botblock/javabotblockapi/exceptions/RatelimitedException.java renamed to core/src/main/java/org/botblock/javabotblockapi/core/exceptions/RatelimitedException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
1616
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
18-
package org.botblock.javabotblockapi.exceptions;
18+
package org.botblock.javabotblockapi.core.exceptions;
1919

2020
import org.json.JSONObject;
2121

src/main/java/org/botblock/javabotblockapi/exceptions/package-info.java renamed to core/src/main/java/org/botblock/javabotblockapi/core/exceptions/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
/**
2020
* Contsins custom exceptions this API may throw.
2121
*/
22-
package org.botblock.javabotblockapi.exceptions;
22+
package org.botblock.javabotblockapi.core.exceptions;

src/main/java/org/botblock/javabotblockapi/requests/CheckUtil.java renamed to core/src/main/java/org/botblock/javabotblockapi/core/requests/CheckUtil.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
1818

19-
package org.botblock.javabotblockapi.requests;
19+
package org.botblock.javabotblockapi.core.requests;
2020

2121
import java.util.Map;
2222

@@ -36,5 +36,4 @@ public static void condition(boolean check, String message){
3636
if(check)
3737
throw new IllegalStateException(message);
3838
}
39-
4039
}

0 commit comments

Comments
 (0)