Skip to content

Commit e64be02

Browse files
author
Im-Fran
committed
v4.3.0 Changelog:
+ Added Placeholder Manager with PlaceholderAPI Support + Added pre-created command SuperCoreAPICommand + Added methods to give and drop a SimpleItem - Removed TimerEvent to fix Lag issues * Fixed Compatibility Issues * Fixed some issues
1 parent e2fa64a commit e64be02

26 files changed

+1239
-1027
lines changed

SuperCoreAPI.iml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
1414
<output url="file://$MODULE_DIR$/target/classes" />
1515
<output-test url="file://$MODULE_DIR$/target/test-classes" />
16+
<javadoc-paths>
17+
<root url="https://hub.spigotmc.org/javadocs/spigot" />
18+
</javadoc-paths>
1619
<content url="file://$MODULE_DIR$">
1720
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
1821
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
@@ -22,7 +25,7 @@
2225
</content>
2326
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
2427
<orderEntry type="sourceFolder" forTests="false" />
25-
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.3-R0.1-SNAPSHOT" level="project" />
28+
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT" level="project" />
2629
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
2730
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
2831
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
@@ -40,7 +43,7 @@
4043
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-buffer:4.1.49.Final" level="project" />
4144
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport:4.1.49.Final" level="project" />
4245
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver:4.1.49.Final" level="project" />
43-
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.16.3-R0.1-SNAPSHOT" level="project" />
46+
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.16.4-R0.1-SNAPSHOT" level="project" />
4447
<orderEntry type="library" name="Maven: org.slf4j:slf4j-nop:1.7.30" level="project" />
4548
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
4649
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.6" level="project" />
@@ -50,5 +53,7 @@
5053
<orderEntry type="library" scope="PROVIDED" name="Maven: org.xerial:sqlite-jdbc:3.25.2" level="project" />
5154
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.13.2" level="project" />
5255
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.13.2" level="project" />
56+
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.10.9" level="project" />
57+
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:19.0.0" level="project" />
5358
</component>
5459
</module>

dependency-reduced-pom.xml

Lines changed: 19 additions & 3 deletions
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.2.10_BETA4</version>
7+
<version>4.3.0</version>
88
<build>
99
<sourceDirectory>src/main/java</sourceDirectory>
1010
<defaultGoal>clean package</defaultGoal>
@@ -55,6 +55,10 @@
5555
<id>CodeMC</id>
5656
<url>https://repo.codemc.org/repository/maven-public</url>
5757
</repository>
58+
<repository>
59+
<id>placeholderapi</id>
60+
<url>https://repo.extendedclip.com/content/repositories/placeholderapi</url>
61+
</repository>
5862
<repository>
5963
<id>sonatype</id>
6064
<url>https://oss.sonatype.org/content/groups/public/</url>
@@ -64,7 +68,7 @@
6468
<dependency>
6569
<groupId>org.spigotmc</groupId>
6670
<artifactId>spigot-api</artifactId>
67-
<version>1.16.3-R0.1-SNAPSHOT</version>
71+
<version>1.16.4-R0.1-SNAPSHOT</version>
6872
<scope>provided</scope>
6973
<exclusions>
7074
<exclusion>
@@ -124,7 +128,7 @@
124128
<dependency>
125129
<groupId>org.spigotmc</groupId>
126130
<artifactId>spigot</artifactId>
127-
<version>1.16.3-R0.1-20201003.002207-3</version>
131+
<version>1.16.4-R0.1-20201104.085205-3</version>
128132
<scope>provided</scope>
129133
</dependency>
130134
<dependency>
@@ -151,6 +155,18 @@
151155
</exclusion>
152156
</exclusions>
153157
</dependency>
158+
<dependency>
159+
<groupId>me.clip</groupId>
160+
<artifactId>placeholderapi</artifactId>
161+
<version>2.10.9</version>
162+
<scope>provided</scope>
163+
<exclusions>
164+
<exclusion>
165+
<artifactId>annotations</artifactId>
166+
<groupId>org.jetbrains</groupId>
167+
</exclusion>
168+
</exclusions>
169+
</dependency>
154170
</dependencies>
155171
<distributionManagement>
156172
<repository>

pom.xml

Lines changed: 15 additions & 3 deletions
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.2.13</version>
9+
<version>4.3.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SuperCoreAPI</name>
@@ -84,6 +84,11 @@
8484
<id>CodeMC</id>
8585
<url>https://repo.codemc.org/repository/maven-public</url>
8686
</repository>
87+
<!-- PlaceholderAPI -->
88+
<repository>
89+
<id>placeholderapi</id>
90+
<url>https://repo.extendedclip.com/content/repositories/placeholderapi</url>
91+
</repository>
8792
<!-- Sonatype -->
8893
<repository>
8994
<id>sonatype</id>
@@ -96,7 +101,7 @@
96101
<dependency>
97102
<groupId>org.spigotmc</groupId>
98103
<artifactId>spigot-api</artifactId>
99-
<version>1.16.3-R0.1-SNAPSHOT</version>
104+
<version>1.16.4-R0.1-SNAPSHOT</version>
100105
<scope>provided</scope>
101106
</dependency>
102107
<!-- BUNGEE -->
@@ -110,7 +115,7 @@
110115
<dependency>
111116
<groupId>org.spigotmc</groupId>
112117
<artifactId>spigot</artifactId>
113-
<version>1.16.3-R0.1-20201017.075927-4</version>
118+
<version>1.16.4-R0.1-20201104.085205-3</version>
114119
<scope>provided</scope>
115120
</dependency>
116121
<!-- SLF4J -->
@@ -165,5 +170,12 @@
165170
<version>2.13.2</version>
166171
<scope>provided</scope>
167172
</dependency>
173+
<!-- PlaceholderAPI -->
174+
<dependency>
175+
<groupId>me.clip</groupId>
176+
<artifactId>placeholderapi</artifactId>
177+
<version>2.10.9</version>
178+
<scope>provided</scope>
179+
</dependency>
168180
</dependencies>
169181
</project>

src/main/java/xyz/theprogramsrc/supercoreapi/Base.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
import xyz.theprogramsrc.supercoreapi.global.updater.SongodaUpdateChecker;
55

66
/**
7-
* This is a set of utils that need to be loaded
7+
* This is a set of utils that need to be loaded before everything
88
*/
99
public class Base {
1010

1111
private final SuperPlugin<?> plugin;
1212

1313
public Base(SuperPlugin<?> plugin){
1414
this.plugin = plugin;
15-
this.loadUpdateChecker();
15+
this.updateChecker();
1616
}
1717

18-
private void loadUpdateChecker(){
18+
public void updateChecker(){
1919
new SongodaUpdateChecker("supercoreapi-the-best-way-to-create-a-plugin"){
2020
@Override
2121
public void onFailCheck() {
@@ -24,12 +24,24 @@ public void onFailCheck() {
2424

2525
@Override
2626
public void onSuccessCheck(String lastVersion) {
27-
int latest = Integer.parseInt(lastVersion.split(" ")[0].replaceAll("\\.", "").replaceAll("[a-zA-Z]", ""));
28-
int current = Integer.parseInt(Base.this.plugin.getPluginVersion().split(" ")[0].replaceAll("\\.", "").replaceAll("[a-zA-Z]", ""));
29-
if(latest > current){
27+
StringBuilder latest = new StringBuilder(lastVersion.split(" ")[0].replaceAll("\\.", "").replaceAll("[a-zA-Z]", "")),
28+
current = new StringBuilder(Base.this.plugin.SUPER_CORE_API_VERSION.split(" ")[0].replaceAll("\\.", "").replaceAll("[a-zA-Z]", ""));
29+
if(latest.length() > current.length()){
30+
int amount = latest.length() - current.length();
31+
for(int i = 0; i < amount; ++i){
32+
current.append("0");
33+
}
34+
}else if(current.length() > latest.length()){
35+
int amount = current.length() - latest.length();
36+
for(int i = 0; i < amount; ++i){
37+
latest.append("0");
38+
}
39+
}
40+
int l = Integer.parseInt(latest.toString()), c = Integer.parseInt(current.toString());
41+
if(l > c){
3042
Base.this.plugin.log("&cNew update available for &3SuperCoreAPI &7("+lastVersion+")");
3143
Base.this.plugin.log("&cIf you're the developer of the plugin update the API, if you're a customer of a plugin using &3SuperCoreAPI&c please notify to the Developer.");
32-
}else if(latest < current){
44+
}else if(l < c){
3345
Base.this.plugin.log("&cIt seems like you're running a non-release version of &3SuperCoreAPI");
3446
Base.this.plugin.log("&cUnless you're the developer, you must use the version &7" + lastVersion);
3547
}

src/main/java/xyz/theprogramsrc/supercoreapi/SuperModule.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ protected File getTranslationsFolder(){
6767
return this.plugin.getTranslationsFolder();
6868
}
6969

70-
/**
71-
* Gets the plugin utils
72-
* @return plugin utils
73-
*/
74-
protected SuperUtils getSuperUtils(){
75-
return this.plugin.getSuperUtils();
76-
}
77-
7870
/**
7971
* Gets the plugin version
8072
* @return plugin version

src/main/java/xyz/theprogramsrc/supercoreapi/SuperPlugin.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
*/
1616
public interface SuperPlugin<PLUGIN> {
1717

18+
/*
19+
* This need to be updated on every new release
20+
*/
21+
String SUPER_CORE_API_VERSION = "4.3.0";
22+
1823
/**
1924
* Gets if this plugin is paid, By default is set to true, but is recommended to change it if your plugin is free.
2025
* @return Whether the plugin is paid or not
@@ -37,12 +42,6 @@ default void log(String message){
3742
*/
3843
void sendConsoleMessage(String message);
3944

40-
/**
41-
* Gets a SuperUtils that only works on a specific server software
42-
* @return Super Utils
43-
*/
44-
SuperUtils getSuperUtils();
45-
4645
/**
4746
* Gets the plugin name from the Plugin.yml in Bukkit/Spigot/Paper Servers and Bungee.yml in Proxies
4847
* @return The name of the plugin
@@ -170,11 +169,23 @@ default void addDisableHook(Runnable runnable){
170169
*/
171170
void addError(Exception e);
172171

172+
/**
173+
* Removes an error from the errors list
174+
* @param i the index to delete
175+
*/
176+
void removeError(int i);
177+
173178
default Exception getLastError(){
174179
if(getLastErrors().isEmpty()){
175180
return null;
176181
}else{
177182
return getLastErrors().getLast();
178183
}
179184
}
185+
186+
/**
187+
* Gets if the current plugin is running on a bungeecord instance
188+
* @return true if it's running in bungeecord, false otherwise
189+
*/
190+
boolean isBungeeInstance();
180191
}

src/main/java/xyz/theprogramsrc/supercoreapi/SuperUtils.java

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package xyz.theprogramsrc.supercoreapi;
22

3-
import org.bukkit.command.defaults.BukkitCommand;
3+
import net.md_5.bungee.api.ChatColor;
44

55
import java.util.Arrays;
66
import java.util.Collection;
@@ -17,7 +17,7 @@ public interface SuperUtils {
1717
* @param hex The color in hex
1818
* @return the hex color as ChatColor
1919
*/
20-
net.md_5.bungee.api.ChatColor parseHex(String hex);
20+
ChatColor parseHex(String hex);
2121

2222
/**
2323
* Translates the message into minecraft coloured message
@@ -68,38 +68,4 @@ default String[] removeColor(String... strings){
6868
default Collection<String> removeColor(Collection<String> strings){
6969
return strings.stream().map(this::removeColor).collect(Collectors.toList());
7070
}
71-
72-
/**
73-
* Unregisters a command using Reflection
74-
* @param command Command to unregister
75-
*/
76-
default void unregisterCommand(String command){
77-
throw new RuntimeException("The operation unregisterCommand(String) is not supported yet");
78-
}
79-
80-
/**
81-
* Register a command using Reflection
82-
* @param command Command to register
83-
*/
84-
default void registerBukkitCommand(BukkitCommand command){
85-
throw new RuntimeException("The operation registerBukkitCommand(BukkitCommand) is not supported yet");
86-
}
87-
88-
/**
89-
* Send a message
90-
* @param sender Sender to send the message
91-
* @param message Message to send
92-
*/
93-
default void sendMessage(org.bukkit.command.CommandSender sender, String message){
94-
throw new RuntimeException("The operation sendMessage(CommandSender, String) is not supported yet");
95-
}
96-
97-
/**
98-
* Send a message
99-
* @param sender Sender to send the message
100-
* @param message Message to send
101-
*/
102-
default void sendMessage(net.md_5.bungee.api.CommandSender sender, String message){
103-
throw new RuntimeException("The operation sendMessage(CommandSender, String) is not supported yet");
104-
}
10571
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import net.md_5.bungee.api.plugin.Listener;
55
import xyz.theprogramsrc.supercoreapi.SuperModule;
66
import xyz.theprogramsrc.supercoreapi.bungee.storage.Settings;
7+
import xyz.theprogramsrc.supercoreapi.bungee.utils.BungeeUtils;
78
import xyz.theprogramsrc.supercoreapi.bungee.utils.tasks.BungeeTasks;
89

910
public class BungeeModule extends SuperModule<Listener> implements Listener {
@@ -50,4 +51,11 @@ protected BungeeTasks getBungeeTasks(){
5051
return this.bungeePlugin.getBungeeTasks();
5152
}
5253

54+
/**
55+
* Gets the Bungee Utils
56+
* @return the Bungee Utils
57+
*/
58+
protected BungeeUtils getSuperUtils(){
59+
return this.bungeePlugin.getSuperUtils();
60+
}
5361
}

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

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import xyz.theprogramsrc.supercoreapi.global.dependencies.DependencyManager;
1515
import xyz.theprogramsrc.supercoreapi.global.dependencies.classloader.PluginClassLoader;
1616
import xyz.theprogramsrc.supercoreapi.global.dependencies.classloader.ReflectionClassLoader;
17+
import xyz.theprogramsrc.supercoreapi.global.placeholders.BungeePlaceholderManager;
1718
import xyz.theprogramsrc.supercoreapi.global.translations.Base;
1819
import xyz.theprogramsrc.supercoreapi.global.translations.TranslationManager;
1920
import xyz.theprogramsrc.supercoreapi.global.utils.Utils;
@@ -72,10 +73,10 @@ public void onEnable() {
7273
this.onPluginEnable();
7374
this.log("Enabled plugin");
7475
if(this.isFirstStart()){
75-
if(this.isPaid()){
76-
this.log("Thanks for buying this plugin from &3" + this.getPluginAuthor());
77-
}else{
76+
if(!this.isPaid()){
7877
this.log("Thanks for downloading this plugin from &3" + this.getPluginAuthor());
78+
}else{
79+
this.log("Thanks for buying this plugin from &3" + this.getPluginAuthor());
7980
}
8081
this.log("If you need help you can contact the developer");
8182
this.log("Consider leaving a positive rating");
@@ -96,8 +97,7 @@ public void sendConsoleMessage(String message) {
9697
this.getProxy().getConsole().sendMessage(new TextComponent(this.getSuperUtils().color(message)));
9798
}
9899

99-
@Override
100-
public SuperUtils getSuperUtils() {
100+
public BungeeUtils getSuperUtils() {
101101
return new BungeeUtils();
102102
}
103103

@@ -215,4 +215,24 @@ public LinkedList<Exception> getLastErrors() {
215215
public void addError(Exception e){
216216
this.errors.add(e);
217217
}
218+
219+
@Override
220+
public void removeError(int i) {
221+
if(i <= this.errors.size()){
222+
this.errors.remove(i);
223+
}
224+
}
225+
226+
/**
227+
* Gets the {@link BungeePlaceholderManager}
228+
* @return the {@link BungeePlaceholderManager}
229+
*/
230+
public BungeePlaceholderManager getPlaceholderManager(){
231+
return new BungeePlaceholderManager();
232+
}
233+
234+
@Override
235+
public boolean isBungeeInstance() {
236+
return true;
237+
}
218238
}

0 commit comments

Comments
 (0)