More gui work.

This commit is contained in:
Brianna 2019-08-25 15:37:33 -04:00
parent a3ad5bbfc9
commit 8429efd738
6 changed files with 40 additions and 15 deletions

View File

@ -9,22 +9,24 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.spigotmc:spigot:1.14.4" level="project" />
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.13-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
<orderEntry type="library" name="Maven: com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.3.2" level="project" />
<orderEntry type="library" name="Maven: com.sainttx.holograms:Holograms:2.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.tnemc:Reserve:0.1.3.0" level="project" />
<orderEntry type="library" name="Maven: org.black_ixx:playerpoints:2.1.4" level="project" />
<orderEntry type="library" name="Maven: net.milkbowl:vault:1.7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl:VaultAPI:1.7.2" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-nop:1.7.25" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.2.0" level="project" />
<orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.23.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-bukkit:7.0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.14.4-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-core:7.0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard.worldguard-libs:core:7.0.1-SNAPSHOT" level="project" />

View File

@ -117,7 +117,7 @@ public class SongodaCore {
private void update(PluginInfo plugin) {
try {
URL url = new URL("http://update.songoda.com/index.php?plugin=" + plugin.getSongodaId()
URL url = new URL("https://update.songoda.com/index.php?plugin=" + plugin.getSongodaId()
+ "&version=" + plugin.getJavaPlugin().getDescription().getVersion()
+ "&updaterVersion=" + updaterVersion);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

View File

@ -157,7 +157,7 @@ public class Config {
for (String settingStr : fileConfiguration.getConfigurationSection(categoryStr).getKeys(true)) {
Object object = fileConfiguration.get(categoryStr + "." + settingStr);
if (!(object instanceof MemorySection))
category.addSetting(settingStr, object);
category.addSetting(settingStr, object);
}
addCategory(category);
}
@ -308,6 +308,8 @@ public class Config {
} catch (IOException e) {
e.printStackTrace();
}
reload();
}
public FileConfiguration getFileConfiguration() {

View File

@ -1,10 +1,12 @@
package com.songoda.core.library.settings.editor;
import com.songoda.core.library.compatibility.LegacyMaterials;
import com.songoda.core.library.settings.Category;
import com.songoda.core.library.settings.Config;
import com.songoda.core.utils.gui.AbstractGUI;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.Arrays;
@ -12,19 +14,30 @@ import java.util.List;
public class ConfigCategoriesGUI extends AbstractGUI {
private final JavaPlugin plugin;
private final Config config;
private final ConfigSelectionGUI selection;
public ConfigCategoriesGUI(Player player, Config config) {
public ConfigCategoriesGUI(JavaPlugin plugin, Player player, Config config, ConfigSelectionGUI selection) {
super(player);
this.plugin = plugin;
this.config = config;
this.selection = selection;
init("test", 54);
}
@Override
protected void constructGUI() {
for (int i = 0; i < config.getCategories().size(); i++) {
Category category = config.getCategories().get(i);
createButton(0, LegacyMaterials.getMaterial("OAK_FENCE_GATE").getMaterial(), "Back");
registerClickable(0, ((player1, inventory1, cursor, slot, type) ->
selection.init("test", selection.getInventory().getSize())));
for (int i = 9; i - 9 < config.getCategories().size(); i++) {
Category category = config.getCategories().get(i - 9);
createButton(i, Material.STONE, category.getKey());
registerClickable(i, ((player1, inventory1, cursor, slot, type) -> {
new ConfigEditorGUI(plugin, player, category, null, this);
}));
}
}
@ -37,4 +50,8 @@ public class ConfigCategoriesGUI extends AbstractGUI {
protected void registerOnCloses() {
}
public Config getConfig() {
return config;
}
}

View File

@ -105,6 +105,7 @@ public class ConfigEditorGUI extends AbstractGUI {
j++;
}
}
categories.getConfig().save();
}
@Override

View File

@ -4,6 +4,7 @@ import com.songoda.core.library.settings.Config;
import com.songoda.core.utils.gui.AbstractGUI;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.Arrays;
@ -11,10 +12,13 @@ import java.util.List;
public class ConfigSelectionGUI extends AbstractGUI {
private final JavaPlugin plugin;
private final List<Config> configs = new ArrayList<>();
public ConfigSelectionGUI(Player player, Config... configs) {
public ConfigSelectionGUI(JavaPlugin plugin, Player player, Config... configs) {
super(player);
this.plugin = plugin;
this.configs.addAll(Arrays.asList(configs));
init("test", 54);
}
@ -24,9 +28,8 @@ public class ConfigSelectionGUI extends AbstractGUI {
for (int i = 0; i < configs.size(); i++) {
Config config = configs.get(i);
createButton(i, Material.STONE, config.getConfigName());
registerClickable(i, ((player1, inventory1, cursor, slot, type) -> {
new ConfigCategoriesGUI(player, config);
}));
registerClickable(i, ((player1, inventory1, cursor, slot, type) ->
new ConfigCategoriesGUI(plugin, player, config, this)));
}
}