Skip to content

Commit f94e8aa

Browse files
author
Francisco Solis
committed
Removed Translation Downloader & Updates
* Removed Translation Downloader * Updated maven workflow * Updated dependency reduced
1 parent 5a0b750 commit f94e8aa

File tree

6 files changed

+12
-49
lines changed

6 files changed

+12
-49
lines changed

.github/workflows/maven.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ jobs:
4949
- name: Build, Test & Deoploy with Maven
5050
run: mvn -B clean package test deploy --file pom.xml
5151
# Now we store the artifact in the action
52-
- name: Store Artifact
53-
- run: mkdir -p ./artifacts
54-
- run: cp target/SuperCoreAPI.jar ./artifacts/
52+
- name: Create & Copy artifact
53+
- run: mkdir -p ./artifacts && cp target/SuperCoreAPI.jar ./artifacts/
5554
- uses: actions/upload-artifact@v2
5655
with:
5756
name: SuperCoreAPI

dependency-reduced-pom.xml

Lines changed: 1 addition & 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>5.2.2-SNAPSHOT</version>
7+
<version>5.2.2</version>
88
<description>The best way to create a plugin.</description>
99
<url>https://github.com/TheProgramSrc/SuperCoreAPI</url>
1010
<build>

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ public enum Base implements TranslationPack{
6262
GENERAL_SET_PREFIX_NAME("GUI.GeneralSettings.Items.Prefix.Name","&aSet Prefix"),
6363
GENERAL_SET_PREFIX_DESCRIPTION("GUI.GeneralSettings.Items.Prefix.Lore","&7Current Prefix: &r{Prefix}"),
6464

65-
GENERAL_TOGGLE_TRANSLATION_DOWNLOADER_NAME("GUI.GeneralSettings.Items.TranslationDownloader.Name","&aToggle Translation Downloader"),
66-
GENERAL_TOGGLE_TRANSLATION_DOWNLOADER_DESCRIPTION("GUI.GeneralSettings.Items.TranslationDownloader.Lore","&7Current Status: &9{Status}"),
67-
6865
SETTINGS_TOGGLE_UPDATER_NAME("GUI.GeneralSettings.Items.ToggleUpdater.Name","&aToggle Updater"),
6966
SETTINGS_TOGGLE_UPDATER_DESCRIPTION("GUI.GeneralSettings.Items.ToggleUpdater.Lore","&7Current Status: &9{Status}"),
7067

src/main/java/xyz/theprogramsrc/supercoreapi/global/translations/TranslationDownloader.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package xyz.theprogramsrc.supercoreapi.global.translations;
22

3+
import java.io.File;
4+
35
import com.google.gson.JsonArray;
46
import com.google.gson.JsonElement;
57
import com.google.gson.JsonObject;
68
import com.google.gson.JsonParser;
9+
710
import xyz.theprogramsrc.supercoreapi.SuperPlugin;
811
import xyz.theprogramsrc.supercoreapi.global.utils.Utils;
912
import xyz.theprogramsrc.supercoreapi.global.utils.files.FileUtils;
1013

11-
import java.io.File;
12-
1314
public class TranslationDownloader {
1415

1516
/**
@@ -18,8 +19,9 @@ public class TranslationDownloader {
1819
* @param username The GitHub Username
1920
* @param repository The GitHub Repository
2021
* @param folder The folder of the Translations
22+
* @deprecated due to new translation system
2123
*/
22-
public static void downloadFromGitHub(final SuperPlugin<?> core, final String username, final String repository, final String folder){
24+
@Deprecated public static void downloadFromGitHub(final SuperPlugin<?> core, final String username, final String repository, final String folder){
2325
JsonParser parser = new JsonParser();
2426
try{
2527
String url = "https://api.github.com/repos/{Username}/{Repository}/contents/{Folder}";
@@ -52,8 +54,9 @@ public static void downloadFromGitHub(final SuperPlugin<?> core, final String us
5254
* @param core The Plugin
5355
* @param directUrl The DirectURl (This API doesn't support redirection)
5456
* @param fileName The name of the file to save
57+
* @deprecated due to new translation system
5558
*/
56-
public static void downloadTranslation(final SuperPlugin<?> core, String directUrl, String fileName){
59+
@Deprecated public static void downloadTranslation(final SuperPlugin<?> core, String directUrl, String fileName){
5760
try{
5861
File file = new File(core.getTranslationsFolder(), fileName.endsWith(".lang") ? fileName : (fileName+".lang"));
5962
file.delete();

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/precreated/settings/precreated/GeneralConfigurationSettingPane.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
import com.cryptomorin.xseries.XMaterial;
44

55
import xyz.theprogramsrc.supercoreapi.global.translations.Base;
6-
import xyz.theprogramsrc.supercoreapi.global.utils.Utils;
76
import xyz.theprogramsrc.supercoreapi.spigot.dialog.Dialog;
87
import xyz.theprogramsrc.supercoreapi.spigot.gui.objets.GuiEntry;
98
import xyz.theprogramsrc.supercoreapi.spigot.gui.precreated.settings.SettingPane;
109
import xyz.theprogramsrc.supercoreapi.spigot.items.SimpleItem;
1110

1211
public class GeneralConfigurationSettingPane extends SettingPane {
1312

14-
private final boolean hasDownloader = this.getPlugin().getPluginDataStorage().contains("TranslationDownloader");
15-
1613
@Override
1714
public String getDisplayName() {
1815
return Base.GENERAL.toString();
@@ -31,27 +28,13 @@ public SimpleItem getDisplayItem() {
3128
@Override
3229
public GuiEntry[] getButtons() {
3330
return new GuiEntry[]{
34-
this.getToggleTranslationButton(),
3531
this.getChangePrefixButton()
3632
};
3733
}
3834

3935
@Override
4036
public int[] getContainerSlots() {
41-
return this.hasDownloader ? new int[]{12,14} : new int[]{13};
42-
}
43-
44-
private GuiEntry getToggleTranslationButton(){
45-
SimpleItem item = new SimpleItem(XMaterial.ANVIL)
46-
.setDisplayName("&a" + Base.GENERAL_TOGGLE_TRANSLATION_DOWNLOADER_NAME)
47-
.setLore(
48-
"&7",
49-
"&7" + Base.GENERAL_TOGGLE_TRANSLATION_DOWNLOADER_DESCRIPTION
50-
).addPlaceholder("{Status}", Utils.parseEnabledBoolean(this.getPlugin().getPluginDataStorage().getBoolean("TranslationDownloader")));
51-
return new GuiEntry(item, a-> {
52-
this.getPlugin().getPluginDataStorage().set("TranslationDownloader", !this.hasDownloader);
53-
a.gui.open();
54-
});
37+
return new int[]{13};
5538
}
5639

5740
private GuiEntry getChangePrefixButton(){

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/guis/precreated/settings/precreated/GeneralConfigurationSettingPane.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.cryptomorin.xseries.XMaterial;
66

77
import xyz.theprogramsrc.supercoreapi.global.translations.Base;
8-
import xyz.theprogramsrc.supercoreapi.global.utils.Utils;
98
import xyz.theprogramsrc.supercoreapi.spigot.dialog.Dialog;
109
import xyz.theprogramsrc.supercoreapi.spigot.guis.GUIButton;
1110
import xyz.theprogramsrc.supercoreapi.spigot.guis.objects.GUIRows;
@@ -17,8 +16,6 @@
1716
*/
1817
@Deprecated public class GeneralConfigurationSettingPane extends SettingPane {
1918

20-
private final boolean hasDownloader = this.getPlugin().getPluginDataStorage().contains("TranslationDownloader");
21-
2219
@Override
2320
public String getDisplayName() {
2421
return Base.GENERAL.toString();
@@ -37,36 +34,20 @@ public SimpleItem getDisplayItem() {
3734
@Override
3835
public GUIButton[] getButtons() {
3936
LinkedList<GUIButton> buttons = new LinkedList<>();
40-
if(this.hasDownloader){
41-
buttons.add(this.getToggleTranslationDownloaderButton());
42-
}
4337
buttons.add(this.getChangePrefixButton());
4438
return buttons.toArray(new GUIButton[0]);
4539
}
4640

4741
@Override
4842
public int[] getContainerSlots() {
49-
return this.hasDownloader ? new int[]{12,14} : new int[]{13};
43+
return new int[]{13};
5044
}
5145

5246
@Override
5347
public GUIRows getRows() {
5448
return GUIRows.THREE;
5549
}
5650

57-
private GUIButton getToggleTranslationDownloaderButton(){
58-
SimpleItem item = new SimpleItem(XMaterial.ANVIL)
59-
.setDisplayName("&a" + Base.GENERAL_TOGGLE_TRANSLATION_DOWNLOADER_NAME)
60-
.setLore(
61-
"&7",
62-
"&7" + Base.GENERAL_TOGGLE_TRANSLATION_DOWNLOADER_DESCRIPTION
63-
).addPlaceholder("{Status}", Utils.parseEnabledBoolean(this.getPlugin().getPluginDataStorage().getBoolean("TranslationDownloader")));
64-
return new GUIButton(item, a->{
65-
this.getPlugin().getPluginDataStorage().toggle("TranslationDownloader");
66-
a.openGUI();
67-
});
68-
}
69-
7051
private GUIButton getChangePrefixButton(){
7152
SimpleItem item = new SimpleItem(XMaterial.NAME_TAG)
7253
.setDisplayName("&a" + Base.GENERAL_SET_PREFIX_NAME)

0 commit comments

Comments
 (0)