Skip to content

Commit b1ee388

Browse files
committed
More stuff
1 parent c82100e commit b1ee388

File tree

6 files changed

+137
-8
lines changed

6 files changed

+137
-8
lines changed

build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,19 @@ allprojects {
5757
def opt = it as StandardJavadocDocletOptions
5858

5959
opt.links(
60+
// JSON Lib
6061
"https://stleary.github.io/JSON-java/",
62+
63+
// Discord Libs
6164
"https://ci.dv8tion.net/job/JDA/javadoc/",
65+
66+
// Java 8
6267
"https://docs.oracle.com/javase/8/docs/api/",
68+
69+
// BotBlock Docs
6370
"https://docs.botblock.org/JavaBotBlockAPI/core/",
6471
"https://docs.botblock.org/JavaBotBlockAPI/jda/",
72+
//"https://docs.botblock.org/JavaBotBlockAPI/javacord/",
6573
"https://docs.botblock.org/JavaBotBlockAPI/request/"
6674
)
6775

core/src/main/java/org/botblock/javabotblockapi/core/CheckUtil.java

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,47 @@
2020

2121
import java.util.Map;
2222

23+
/**
24+
* Util class to perform basic checks.
25+
*/
2326
public class CheckUtil{
2427

28+
/**
29+
* Will throw a {@link java.lang.NullPointerException NullPointerException} when the provided String is empty.
30+
*
31+
* @param value
32+
* The String to check.
33+
* @param name
34+
* The name of the parameter checked.
35+
*/
2536
public static void notEmpty(String value, String name){
2637
if(value.isEmpty())
2738
throw new NullPointerException(name + " may not be empty.");
2839
}
2940

41+
/**
42+
* Will throw a {@link java.lang.NullPointerException NullPointerException} when the provided Map is empty.
43+
*
44+
* @param value
45+
* The Map to check.
46+
* @param name
47+
* The name of the parameter checked.
48+
*/
3049
public static void notEmpty(Map<?, ?> value, String name){
3150
if(value.isEmpty())
3251
throw new NullPointerException(name + " may not be empty.");
3352
}
3453

35-
public static void condition(boolean check, String message){
36-
if(check)
54+
/**
55+
* Will throw a {@link java.lang.IllegalStateException IllegalStateException} when the provided expression returns true.
56+
*
57+
* @param expression
58+
* The expression to check against.
59+
* @param message
60+
* The message to print in the Exception when thrown.
61+
*/
62+
public static void condition(boolean expression, String message){
63+
if(expression)
3764
throw new IllegalStateException(message);
3865
}
3966
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
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
25+
* <br>This is paired with the {@link java.lang.Deprecated Deprecated} and
2626
* {@link org.botblock.javabotblockapi.core.annotations.DeprecatedSince DeprecatedSince} annotations.
2727
*
2828
* <p>This annotation will always contain {@link #version() the version} in which the annotated Object will be removed.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ public String toString(){
9191
}
9292

9393
/**
94-
* Returns a formatted message displaying the various information returned in this exception.
95-
* <br>This essentially returns the same value as {@link #toString() toString()} does.
94+
* Returns a message informing us about {@link #getRoute() where} we got rate limited, {@link #getDelay() for how long} and
95+
* on what {@link #getBotId() bot id} and {@link #getIp() ip}.
9696
*
97-
* @return Formatted String containing the provided information from the response. Same format as {@link #toString() toString()}.
97+
* @return String containing a message with route, delay, bot id and IP.
9898
*/
9999
@Override
100100
public String getMessage(){
101-
return toString();
101+
return "Got rate limited on route" + route + " for " + delay + "ms with bot id " + botId + " (ip: " + ip + ")";
102102
}
103103
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright 2019 - 2020 Andre601
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
6+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7+
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8+
*
9+
* The above copyright notice and this permission notice shall be included in all copies or substantial
10+
* portions of the Software.
11+
*
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
14+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
15+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
16+
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17+
*/
18+
19+
/**
20+
* This is the Javacord module which is used to provide support for the Javacord Library.
21+
* <br>Make sure to install both the request library and the core library for this one to work!
22+
*
23+
* <h1>Installation</h1>
24+
* Please replace {@code API_VERSION} with the latest release on Bintray.
25+
*
26+
* <h2>Gradle (recommended)</h2>
27+
*
28+
* <pre><code>
29+
* repositories{
30+
* maven{ url = 'https://dl.bintray.com/andre601/maven' }
31+
* }
32+
*
33+
* dependencies{
34+
* // Those two are required
35+
* compile 'org.botblock:JavaBotBlockAPI-core:API_VERSION'
36+
* compile 'org.botblock:JavaBotBlockAPI-request:API_VERSION'
37+
*
38+
* compile 'org.botblock:JavaBotBlockAPI-javacord:API_VERSION'
39+
* }
40+
* </code></pre>
41+
*
42+
* <h2>Maven</h2>
43+
*
44+
* <pre><code>{@literal
45+
* <repositories>
46+
* <repository>
47+
* <id>jcenter</id>
48+
* <name>jcenter-bintray</name>
49+
* <url>https://dl.bintray.com/andre601/maven</url>
50+
* </repository>
51+
* </repositories>
52+
*
53+
* <dependencies>
54+
* <!-- Those two are required -->
55+
* <dependency>
56+
* <groupId>org.botblock</groupId>
57+
* <artifactId>JavaBotBlockAPI-core</artifactId>
58+
* <version>API_VERSION</version>
59+
* </dependency>
60+
* <dependency>
61+
* <groupId>org.botblock</groupId>
62+
* <artifactId>JavaBotBlockAPI-request</artifactId>
63+
* <version>API_VERSION</version>
64+
* </dependency>
65+
*
66+
* <dependency>
67+
* <groupId>org.botblock</groupId>
68+
* <artifactId>JavaBotBlockAPI-javacord</artifactId>
69+
* <version>API_VERSION</version>
70+
* </dependency>
71+
* </dependencies>
72+
* }</code></pre>
73+
*
74+
* <h2>Manual</h2>
75+
* We do not recommend using jar files directly and instead use one of the above dependency management systems.
76+
*
77+
* <p>If you still want to do it manually, or can't use one of the other option, head over to the
78+
* <a target="_blank" href="https://github.com/botblock/JavaBotBlockAPI/releases/latest">GitHub releases page</a> or to
79+
* the <a target="_blank" href="https://bintray.com/beta/#/andre601/maven/JavaBotBlockAPI?tab=overview">Bintray release page</a>
80+
* and download the jar files from there.
81+
*
82+
* <p>Note that you will not receive any support when using this method.
83+
*/
84+
package org.botblock.javabotblockapi.javacord;

jda/src/main/java/org/botblock/javabotblockapi/jda/package-info.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@
3232
* }
3333
*
3434
* dependencies{
35+
* // Those two are required
3536
* compile 'org.botblock:JavaBotBlockAPI-core:API_VERSION'
36-
* compile 'org.botblock:JavaBotBlockAPI-jda:API_VERSION
37+
* compile 'org.botblock.JavaBotBlockAPI-request:API_VERSION'
38+
*
39+
* compile 'org.botblock:JavaBotBlockAPI-jda:API_VERSION'
3740
* }
3841
* </code></pre>
3942
*
@@ -49,13 +52,20 @@
4952
* </repositories>
5053
*
5154
* <dependencies>
55+
* <!-- Those two are required -->
5256
* <dependency>
5357
* <groupId>org.botblock</groupId>
5458
* <artifactId>JavaBotBlockAPI-core</artifactId>
5559
* <version>API_VERSION</version>
5660
* </dependency>
5761
* <dependency>
5862
* <groupId>org.botblock</groupId>
63+
* <artifactId>JavaBotBlockAPI-request</artifactId>
64+
* <version>API_VERSION</version>
65+
* </dependency>
66+
*
67+
* <dependency>
68+
* <groupId>org.botblock</groupId>
5969
* <artifactId>JavaBotBlockAPI-jda</artifactId>
6070
* <version>API_VERSION</version>
6171
* </dependency>

0 commit comments

Comments
 (0)