Skip to content

Commit c7da7e7

Browse files
author
BadAccuracyID
committed
Bump version (0.5.2-RELEASE):
- Update dependencies - Enabled support for 1.13-1.16(untested)
1 parent 16d74f0 commit c7da7e7

File tree

14 files changed

+20
-163
lines changed

14 files changed

+20
-163
lines changed
Binary file not shown.
Binary file not shown.

.gradle/7.1/fileHashes/fileHashes.bin

50 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
646 Bytes
Binary file not shown.
Binary file not shown.
18 Bytes
Binary file not shown.

.gradle/checksums/checksums.lock

0 Bytes
Binary file not shown.

.gradle/checksums/md5-checksums.bin

0 Bytes
Binary file not shown.

.gradle/checksums/sha1-checksums.bin

0 Bytes
Binary file not shown.

plugin/build.gradle

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

77
def pluginName = 'LuckyEssentials'
88
group 'id.luckynetwork.dev.lyrams.lej'
9-
version '0.5.1-RELEASE'
9+
version '0.5.2-RELEASE'
1010

1111
repositories {
1212
mavenCentral()

plugin/src/main/java/id/luckynetwork/dev/lyrams/lej/LuckyEssentials.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,18 @@ private void loadVersionSupport() {
179179
this.getLogger().info("Loaded version support v1_12_R1");
180180
break;
181181
}
182+
case "v1_13_R1": {
183+
support = Class.forName("id.luckynetwork.dev.lyrams.lej.versionsupport.v1_13_R1.v1_13_R1");
184+
this.getLogger().info("Loaded version support v1_13_R1");
185+
break;
186+
}
187+
case "v1_14_R1":
188+
case "v1_15_R1":
189+
case "v1_16_R1": {
190+
support = Class.forName("id.luckynetwork.dev.lyrams.lej.versionsupport.v1_16_R1.v1_16_R1");
191+
this.getLogger().info("Loaded version support v1_16_R1");
192+
break;
193+
}
182194
default: {
183195
this.getLogger().severe("Unsupported server version!");
184196
Bukkit.getPluginManager().disablePlugin(this);

plugin/src/main/java/id/luckynetwork/dev/lyrams/lej/dependency/DependencyHelper.java

Lines changed: 3 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
* credit to Alviann (https://github.com/Alviannn/DependencyHelper)
1616
*/
1717
public class DependencyHelper {
18+
1819
private final ClassLoader classLoader;
1920

2021
public DependencyHelper(ClassLoader classLoader) {
2122
this.classLoader = classLoader;
2223
}
2324

24-
public DependencyHelper(Class<?> clazz) {
25-
this.classLoader = clazz.getClassLoader();
26-
}
27-
2825
/**
2926
* downloads a dependency file
3027
*
@@ -55,89 +52,11 @@ public void download(String fileName, String fileUrl, Path dirPath) throws IOExc
5552
}
5653
}
5754

58-
/**
59-
* downloads a dependency file
60-
* <p>
61-
* without file name parameter, it will automatically take the name from the URL (might not work sometimes)
62-
*
63-
* @param fileUrl the file url
64-
* @param dirPath the directory path
65-
* @throws IOException if the download fails
66-
*/
67-
@Deprecated
68-
@SuppressWarnings("ResultOfMethodCallIgnored")
69-
public void download(String fileUrl, Path dirPath) throws IOException {
70-
File dir = dirPath.toFile();
71-
if (!dir.exists()) {
72-
dir.mkdir();
73-
}
74-
75-
String[] strArray = fileUrl.split("/");
76-
String fileName = strArray[strArray.length - 1];
77-
78-
File file = new File(dir, fileName);
79-
if (file.exists()) {
80-
return;
81-
}
82-
83-
try {
84-
URL url = new URL(fileUrl);
85-
try (InputStream stream = url.openStream()) {
86-
Files.copy(stream, file.toPath());
87-
}
88-
} catch (Exception e) {
89-
throw new IOException("Failed to download " + fileName);
90-
}
91-
}
92-
93-
/**
94-
* loads the dependency file
95-
*
96-
* @param fileName the name
97-
* @param fileUrl the file url
98-
* @param dirPath the directory path
99-
* @throws IOException if the dependency file doesn't exists
100-
* @throws IllegalAccessException if the dependency file isn't a .jar
101-
*/
102-
public void load(String fileName, String fileUrl, Path dirPath) throws IOException, IllegalAccessException {
103-
File dir = dirPath.toFile();
104-
if (!dir.exists()) {
105-
return;
106-
}
107-
108-
File file = new File(dir, fileName);
109-
if (!file.exists()) {
110-
throw new FileNotFoundException("Cannot file " + fileName + "!");
111-
}
112-
if (!file.getName().endsWith(".jar")) {
113-
throw new IllegalAccessException("Cannot load file that aren't .jar(s)!");
114-
}
115-
116-
ClassLoader previousLoader = Thread.currentThread().getContextClassLoader();
117-
Thread.currentThread().setContextClassLoader(classLoader);
118-
119-
if (classLoader instanceof URLClassLoader) {
120-
URLClassLoader loader = (URLClassLoader) classLoader;
121-
try {
122-
Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
123-
addURL.setAccessible(true);
124-
addURL.invoke(loader, file.toURI().toURL());
125-
} catch (Exception e) {
126-
Thread.currentThread().setContextClassLoader(previousLoader);
127-
throw new RuntimeException("Failed to load " + fileName + "!");
128-
}
129-
} else {
130-
Thread.currentThread().setContextClassLoader(previousLoader);
131-
throw new RuntimeException("Failed to cast class loader!");
132-
}
133-
Thread.currentThread().setContextClassLoader(previousLoader);
134-
}
135-
13655
/**
13756
* loads the dependency file
13857
*
13958
* @param file the file
140-
* @throws IOException if the dependency file doesn't exists
59+
* @throws IOException if the dependency file doesn't exist
14160
* @throws IllegalAccessException if the dependency file isn't a .jar
14261
*/
14362
public void load(File file) throws IOException, IllegalAccessException {
@@ -172,7 +91,7 @@ public void load(File file) throws IOException, IllegalAccessException {
17291
* loads all dependencies on a specific directory
17392
*
17493
* @param dirPath the directory path
175-
* @throws IOException if the dependency file doesn't exists
94+
* @throws IOException if the dependency file doesn't exist
17695
* @throws IllegalAccessException if the dependency file isn't a .jar
17796
*/
17897
@SuppressWarnings("ConstantConditions")
@@ -190,20 +109,6 @@ public void loadDir(Path dirPath) throws IOException, IllegalAccessException {
190109
}
191110
}
192111

193-
/**
194-
* loads the dependencies
195-
*
196-
* @param dependencies the dependencies
197-
* @param dirPath the directory path
198-
* @throws IOException if the dependency file doesn't exists
199-
* @throws IllegalAccessException if the dependency file isn't a .jar
200-
*/
201-
public void load(Map<String, String> dependencies, Path dirPath) throws IOException, IllegalAccessException {
202-
for (Map.Entry<String, String> entry : dependencies.entrySet()) {
203-
this.load(entry.getKey(), entry.getValue(), dirPath);
204-
}
205-
}
206-
207112
/**
208113
* downloads the dependencies
209114
*

plugin/src/main/resources/dependencies.json

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,19 @@
44
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-annotations/1.5.0/cloud-annotations-1.5.0.jar"
55
},
66
{
7-
"name": "cloud-bukkit-1.5.0.jar",
8-
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-bukkit/1.5.0/cloud-bukkit-1.5.0.jar"
7+
"name": "cloud-paper-1.5.0.jar",
8+
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-paper/1.5.0/cloud-paper-1.5.0.jar"
99
},
1010
{
1111
"name": "cloud-core-1.5.0.jar",
1212
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-core/1.5.0/cloud-core-1.5.0.jar"
1313
},
14-
{
15-
"name": "cloud-brigadier-1.5.0.jar",
16-
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-brigadier/1.5.0/cloud-brigadier-1.5.0.jar"
17-
},
1814
{
1915
"name": "cloud-minecraft-extras-1.5.0.jar",
2016
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-minecraft-extras/1.5.0/cloud-minecraft-extras-1.5.0.jar"
2117
},
2218
{
23-
"name": "cloud-paper-1.5.0.jar",
24-
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-paper/1.5.0/cloud-paper-1.5.0.jar"
25-
},
26-
{
27-
"name": "cloud-services-1.5.0.jar",
28-
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-services/1.5.0/cloud-services-1.5.0.jar"
29-
},
30-
{
31-
"name": "cloud-tasks-1.5.0.jar",
32-
"url": "https://search.maven.org/remotecontent?filepath=cloud/commandframework/cloud-tasks/1.5.0/cloud-tasks-1.5.0.jar"
33-
},
34-
{
35-
"name": "adventure-api-4.7.0.jar",
36-
"url": "https://search.maven.org/remotecontent?filepath=net/kyori/adventure-api/4.7.0/adventure-api-4.7.0.jar"
37-
},
38-
{
39-
"name": "adventure-platform-api-4.0.0-SNAPSHOT.jar",
40-
"url": "https://github.com/Lucky-Development-Department/Jar-Repository/raw/master/repo/kyori/adventure-platform-api/adventure-platform-api-4.0.0-SNAPSHOT.jar"
41-
},
42-
{
43-
"name": "adventure-platform-facet-4.0.0-SNAPSHOT.jar",
44-
"url": "https://github.com/Lucky-Development-Department/Jar-Repository/raw/master/repo/kyori/adventure-platform-facet/adventure-platform-facet-4.0.0-SNAPSHOT.jar"
45-
},
46-
{
47-
"name": "adventure-platform-bukkit-4.0.0-SNAPSHOT.jar",
48-
"url": "https://github.com/Lucky-Development-Department/Jar-Repository/raw/master/repo/kyori/adventure-platform-bukkit/adventure-platform-bukkit-4.0.0-SNAPSHOT.jar"
49-
},
50-
{
51-
"name": "adventure-text-serializer-craftbukkit-4.0.0-SNAPSHOT.jar",
52-
"url": "https://github.com/Lucky-Development-Department/Jar-Repository/raw/master/repo/kyori/adventure-text-serializer-craftbukkit/adventure-text-serializer-craftbukkit-4.0.0-SNAPSHOT.jar"
53-
},
54-
{
55-
"name": "adventure-text-serializer-legacy-4.7.0.jar",
56-
"url": "https://github.com/Lucky-Development-Department/Jar-Repository/raw/master/repo/kyori/adventure-text-serializer-legacy/adventure-text-serializer-legacy-4.7.0.jar"
57-
},
58-
{
59-
"name": "adventure-text-serializer-gson-4.7.0.jar",
60-
"url": "https://search.maven.org/remotecontent?filepath=net/kyori/adventure-text-serializer-gson/4.7.0/adventure-text-serializer-gson-4.7.0.jar"
61-
},
62-
{
63-
"name": "adventure-text-serializer-gson-legacy-impl-4.7.0.jar",
64-
"url": "https://search.maven.org/remotecontent?filepath=net/kyori/adventure-text-serializer-gson-legacy-impl/4.7.0/adventure-text-serializer-gson-legacy-impl-4.7.0.jar"
65-
},
66-
{
67-
"name": "adventure-nbt-4.7.0.jar",
68-
"url": "https://search.maven.org/remotecontent?filepath=net/kyori/adventure-nbt/4.7.0/adventure-nbt-4.7.0.jar"
69-
},
70-
{
71-
"name": "adventure-key-4.7.0.jar",
72-
"url": "https://search.maven.org/remotecontent?filepath=net/kyori/adventure-key/4.7.0/adventure-key-4.7.0.jar"
73-
},
74-
{
75-
"name": "examination-api-1.1.0.jar",
76-
"url": "https://search.maven.org/remotecontent?filepath=net/kyori/examination-api/1.1.0/examination-api-1.1.0.jar"
77-
},
78-
{
79-
"name": "geantyref-1.3.11.jar",
80-
"url": "https://search.maven.org/remotecontent?filepath=io/leangen/geantyref/geantyref/1.3.11/geantyref-1.3.11.jar"
19+
"name": "adventure-platform-bukkit-4.0.0.jar",
20+
"url": "https://repo1.maven.org/maven2/net/kyori/adventure-platform-bukkit/4.0.0/adventure-platform-bukkit-4.0.0.jar"
8121
}
8222
]

0 commit comments

Comments
 (0)