Skip to content

Commit b2cc711

Browse files
author
TheProgramSrc
committed
Change Log:
+ Re-Added TimerEvent due to fixes with GUI Creators * Changed RecurringTask package * MaterialBrowser Fixes * SimpleItem Improvements * SkinTexture Improvements * Added GitHub Heads DataBase * Added SpigotPlugin Field to SpigotModule * Code Improvements * Bug Fixes
1 parent 1e4170a commit b2cc711

File tree

22 files changed

+409
-198
lines changed

22 files changed

+409
-198
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## v4.1.0 ChangeLog:
2+
```
3+
+ Re-Added TimerEvent due to fixes with GUI Creators
4+
* Changed RecurringTask package
5+
* MaterialBrowser Fixes
6+
* SimpleItem Improvements
7+
* SkinTexture Improvements
8+
* Added GitHub Heads DataBase
9+
* Added SpigotPlugin Field to SpigotModule
10+
* Code Improvements
11+
* Bug Fixes
12+
```

SuperCoreAPI.iml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@
2323
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
2424
<orderEntry type="sourceFolder" forTests="false" />
2525
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" level="project" />
26-
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
27-
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
28-
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-api:1.16-R0.2" level="project" />
29-
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-config:1.16-R0.2" level="project" />
30-
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-event:1.16-R0.2" level="project" />
31-
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-protocol:1.16-R0.2" level="project" />
32-
<orderEntry type="library" scope="PROVIDED" name="Maven: se.llbit:jo-nbt:1.3.0" level="project" />
33-
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" level="project" />
3426
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
3527
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
3628
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
@@ -58,5 +50,13 @@
5850
<orderEntry type="library" scope="PROVIDED" name="Maven: org.xerial:sqlite-jdbc:3.25.2" level="project" />
5951
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.13.2" level="project" />
6052
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.13.2" level="project" />
53+
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.7.0-M1" level="project" />
54+
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.0-M1" level="project" />
55+
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
56+
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
57+
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.0-M1" level="project" />
58+
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.0-M1" level="project" />
59+
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.0-M1" level="project" />
60+
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.0-M1" level="project" />
6161
</component>
6262
</module>

dependency-reduced-pom.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>xyz.theprogramsrc</groupId>
55
<artifactId>SuperCoreAPI</artifactId>
66
<name>SuperCoreAPI</name>
7-
<version>4.0.0_BETA1</version>
7+
<version>4.0.0</version>
88
<build>
99
<sourceDirectory>src/main/java</sourceDirectory>
1010
<defaultGoal>clean package</defaultGoal>
@@ -151,6 +151,26 @@
151151
</exclusion>
152152
</exclusions>
153153
</dependency>
154+
<dependency>
155+
<groupId>org.junit.jupiter</groupId>
156+
<artifactId>junit-jupiter</artifactId>
157+
<version>RELEASE</version>
158+
<scope>test</scope>
159+
<exclusions>
160+
<exclusion>
161+
<artifactId>junit-jupiter-api</artifactId>
162+
<groupId>org.junit.jupiter</groupId>
163+
</exclusion>
164+
<exclusion>
165+
<artifactId>junit-jupiter-params</artifactId>
166+
<groupId>org.junit.jupiter</groupId>
167+
</exclusion>
168+
<exclusion>
169+
<artifactId>junit-jupiter-engine</artifactId>
170+
<groupId>org.junit.jupiter</groupId>
171+
</exclusion>
172+
</exclusions>
173+
</dependency>
154174
</dependencies>
155175
<distributionManagement>
156176
<repository>

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>xyz.theprogramsrc</groupId>
88
<artifactId>SuperCoreAPI</artifactId>
9-
<version>4.0.0</version>
9+
<version>4.1.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SuperCoreAPI</name>
@@ -165,5 +165,11 @@
165165
<version>2.13.2</version>
166166
<scope>provided</scope>
167167
</dependency>
168+
<dependency>
169+
<groupId>org.junit.jupiter</groupId>
170+
<artifactId>junit-jupiter</artifactId>
171+
<version>RELEASE</version>
172+
<scope>test</scope>
173+
</dependency>
168174
</dependencies>
169175
</project>

src/main/java/xyz/theprogramsrc/supercoreapi/bungee/BungeeModule.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88

99
public class BungeeModule extends SuperModule<Listener> implements Listener {
1010

11+
protected BungeePlugin bungeePlugin;
12+
1113
public BungeeModule(BungeePlugin plugin, boolean registerListener){
1214
super(plugin);
15+
this.bungeePlugin = plugin;
1316
if(registerListener) this.listener(this);
1417
this.onLoad();
1518
}

src/main/java/xyz/theprogramsrc/supercoreapi/bungee/BungeePlugin.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ public abstract class BungeePlugin extends Plugin implements SuperPlugin<Plugin>
3737

3838
private BungeeTasks bungeeTasks;
3939

40+
public static BungeePlugin i;
41+
4042
@Override
4143
public void onLoad() {
4244
long start = System.currentTimeMillis();
45+
i = this;
4346
this.emergencyStop = false;
4447
new xyz.theprogramsrc.Base();
4548
this.log("Loading plugin &3v"+this.getPluginVersion());

src/main/java/xyz/theprogramsrc/supercoreapi/bungee/utils/tasks/BungeeTasks.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import net.md_5.bungee.api.scheduler.TaskScheduler;
55
import xyz.theprogramsrc.supercoreapi.bungee.BungeeModule;
66
import xyz.theprogramsrc.supercoreapi.bungee.BungeePlugin;
7-
import xyz.theprogramsrc.supercoreapi.spigot.utils.tasks.RecurringTask;
7+
import xyz.theprogramsrc.supercoreapi.global.objects.RecurringTask;
88

99
import java.util.concurrent.TimeUnit;
1010

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/utils/tasks/RecurringTask.java renamed to src/main/java/xyz/theprogramsrc/supercoreapi/global/objects/RecurringTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package xyz.theprogramsrc.supercoreapi.spigot.utils.tasks;
1+
package xyz.theprogramsrc.supercoreapi.global.objects;
22

33
public abstract class RecurringTask {
44

src/main/java/xyz/theprogramsrc/supercoreapi/global/utils/Utils.java

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
import org.bukkit.Bukkit;
55
import org.bukkit.plugin.Plugin;
66

7-
import java.io.BufferedReader;
8-
import java.io.File;
9-
import java.io.IOException;
10-
import java.io.InputStreamReader;
7+
import java.io.*;
118
import java.net.URL;
129
import java.net.URLConnection;
1310
import java.net.UnknownHostException;
@@ -279,7 +276,7 @@ public static boolean isConnected() {
279276
conn.connect();
280277
conn.getInputStream().close();
281278
return true;
282-
} catch (Exception var2) {
279+
} catch (IOException var2) {
283280
return false;
284281
}
285282
}
@@ -294,13 +291,31 @@ public static String readWithInputStream(String url) {
294291
URL javaURL = new URL(url);
295292
URLConnection connection = javaURL.openConnection();
296293
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
297-
return new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
298-
}catch (Exception ex){
294+
return new BufferedReader(new InputStreamReader(connection.getInputStream())).lines().collect(Collectors.joining());
295+
}catch (IOException ex){
299296
ex.printStackTrace();
300297
return null;
301298
}
302299
}
303300

301+
/**
302+
* Used to read a whole website returning a list of every line
303+
*
304+
* @param url URL of the website
305+
* @return Content of the website
306+
*/
307+
public static List<String> readLinesWithInputStream(String url){
308+
try{
309+
URL webURL = new URL(url);
310+
URLConnection connection = webURL.openConnection();
311+
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
312+
return reader.lines().collect(Collectors.toList());
313+
}catch (IOException e){
314+
e.printStackTrace();
315+
return new ArrayList<>();
316+
}
317+
}
318+
304319
/* Maths */
305320

306321
/**
@@ -492,48 +507,50 @@ public static File folder(File folder) {
492507
* Used to read a file into string
493508
* @param file File to read
494509
* @return Content of the file
495-
* @throws Exception If occurs any exception on the file reading
510+
* @throws IOException If occurs any exception on the file reading
496511
*/
497-
public static String readFile(File file) throws Exception{
512+
public static String readFile(File file) throws IOException{
498513
return FileUtils.readFileToString(file, Charset.defaultCharset());
499514
}
500515

501516
/**
502517
* Reads all the lines of a file
503518
* @param file File to read lines
504519
* @return Lines of the file
505-
* @throws Exception If occurs any exception on the file reading
520+
* @throws IOException If occurs any exception on the file reading
506521
*/
507-
public static List<String> readLines(File file)throws Exception{
522+
public static List<String> readLines(File file)throws IOException{
508523
return FileUtils.readLines(file, Charset.defaultCharset());
509524
}
510525

511526
/**
512527
* Writes a set of lines into a file
513528
* @param file File to write
514529
* @param data Data to write into the file
515-
* @throws Exception If occurs any exception on the file writing
530+
* @throws IOException If occurs any exception on the file writing
516531
*/
517-
public static void writeFile(File file, Collection<String> data) throws Exception{
532+
public static void writeFile(File file, Collection<String> data) throws IOException{
518533
FileUtils.writeLines(file, data);
519534
}
520535

521536
/**
522537
* Used to write a string into a file
523538
* @param file File to write the data
524539
* @param data Data to write into the file
525-
* @throws Exception If occurs any exception on the file writing
540+
* @throws IOException If occurs any exception during the file writing
526541
*/
527-
public static void writeFile(File file, String data)throws Exception{
542+
public static void writeFile(File file, String data) throws IOException{
528543
FileUtils.write(file, data, Charset.defaultCharset());
529544
}
530545

531546
/**
532547
* Used to destroy files
533548
* @param file File to destroy
534-
* @throws Exception If occurs any exception on file deletion
549+
* @throws NullPointerException if the directory is null
550+
* @throws FileNotFoundException if the file was not found
551+
* @throws IOException in case deletion is unsuccessful
535552
*/
536-
public static void destroyFile(File file) throws Exception{
553+
public static void destroyFile(File file) throws IOException{
537554
FileUtils.forceDelete(file);
538555
}
539556

@@ -543,12 +560,12 @@ public static void destroyFile(File file) throws Exception{
543560
* @param destination File to save the downloaded file
544561
* @throws UnknownHostException if is not connected to internet
545562
* @throws IOException if the URL cannot be opened
546-
* @throws IOException if the is a directory
563+
* @throws IOException if the destination is a directory
547564
* @throws IOException if the destination file cannot be written
548565
* @throws IOException if the destination file needs creating but can't be
549566
* @throws IOException if an IO error occurs during copying
550567
*/
551-
public static void downloadFile(String url, File destination) throws Exception{
568+
public static void downloadFile(String url, File destination) throws IOException {
552569
if(!isConnected()) throw new UnknownHostException("Cannot connect to internet!");
553570
FileUtils.copyURLToFile(new URL(url), destination);
554571
}
@@ -560,12 +577,12 @@ public static void downloadFile(String url, File destination) throws Exception{
560577
* @param fileName Name of the downloaded file
561578
* @throws UnknownHostException if is not connected to internet
562579
* @throws IOException if the URL cannot be opened
563-
* @throws IOException if the is a directory
580+
* @throws IOException if the destination is a directory
564581
* @throws IOException if the destination file cannot be written
565582
* @throws IOException if the destination file needs creating but can't be
566583
* @throws IOException if an IO error occurs during copying
567584
*/
568-
public static void downloadFile(String url, File outputFolder, String fileName)throws Exception{
585+
public static void downloadFile(String url, File outputFolder, String fileName) throws IOException{
569586
downloadFile(url, new File(folder(outputFolder), fileName));
570587
}
571588

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/SpigotModule.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212
public class SpigotModule extends SuperModule<Listener> implements Listener {
1313

14+
protected SpigotPlugin spigotPlugin;
15+
1416
/**
1517
* Creates a new Spigot Module
1618
* @param plugin the plugin
@@ -19,6 +21,7 @@ public class SpigotModule extends SuperModule<Listener> implements Listener {
1921
public SpigotModule(SpigotPlugin plugin, boolean registerListener){
2022
super(plugin);
2123
if(registerListener) this.listener(this);
24+
this.spigotPlugin = plugin;
2225
this.onLoad();
2326
}
2427

0 commit comments

Comments
 (0)