mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-02-03 05:01:27 +01:00
editor
This commit is contained in:
parent
fc5849ae57
commit
24a051fef4
@ -11,7 +11,7 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.spigotmc:spigot:1.14.4" 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-SNAPSHOT" 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" />
|
||||
|
6
pom.xml
6
pom.xml
@ -21,7 +21,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>private</id>
|
||||
<url>http://repo.songoda.com/artifactory/private/</url>
|
||||
<url>https://repo.songoda.com/artifactory/private/</url>
|
||||
</repository>
|
||||
<!-- sk89q-repo and spigot-repo are required for worldguard -->
|
||||
<repository>
|
||||
@ -46,8 +46,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sainttx.holograms</groupId>
|
||||
<artifactId>holograms</artifactId>
|
||||
<version>2.9.1-SNAPSHOT</version>
|
||||
<artifactId>Holograms</artifactId>
|
||||
<version>2.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.tnemc</groupId>
|
||||
|
@ -69,7 +69,8 @@ public class ChatPrompt implements Listener {
|
||||
handler.onChat(chatConfirmEvent);
|
||||
|
||||
if (onClose != null) {
|
||||
onClose.onClose();
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
||||
onClose.onClose(), 0L);
|
||||
}
|
||||
HandlerList.unregisterAll(listener);
|
||||
}
|
||||
|
@ -155,7 +155,9 @@ public class Config {
|
||||
for (String categoryStr : fileConfiguration.getKeys(false)) {
|
||||
Category category = new Category(this, categoryStr);
|
||||
for (String settingStr : fileConfiguration.getConfigurationSection(categoryStr).getKeys(true)) {
|
||||
category.addSetting(settingStr, fileConfiguration.get(categoryStr + "." + settingStr));
|
||||
Object object = fileConfiguration.get(categoryStr + "." + settingStr);
|
||||
if (!(object instanceof MemorySection))
|
||||
category.addSetting(settingStr, object);
|
||||
}
|
||||
addCategory(category);
|
||||
}
|
||||
|
@ -71,6 +71,14 @@ public class Setting {
|
||||
return getConfig().getString(getCompleteKey());
|
||||
}
|
||||
|
||||
public Object getObject() {
|
||||
return getString(null);
|
||||
}
|
||||
|
||||
public Object getObject(Object def) {
|
||||
return getConfig().get(getCompleteKey());
|
||||
}
|
||||
|
||||
public char getChar() {
|
||||
return getChar('0');
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import java.util.*;
|
||||
/**
|
||||
* Created by songoda on 6/4/2017.
|
||||
*/
|
||||
public class SettingsManager implements Listener {
|
||||
public class SettingsManagerOld implements Listener {
|
||||
|
||||
private final JavaPlugin plugin;
|
||||
private final Config config;
|
||||
@ -30,7 +30,7 @@ public class SettingsManager implements Listener {
|
||||
private Map<Player, String> cat = new HashMap<>();
|
||||
private Map<Player, String> current = new HashMap<>();
|
||||
|
||||
public SettingsManager(Config config) {
|
||||
public SettingsManagerOld(Config config) {
|
||||
this.plugin = config.getPlugin();
|
||||
this.config = config;
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.library.settings.editor;
|
||||
|
||||
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 java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigCategoriesGUI extends AbstractGUI {
|
||||
|
||||
private final Config config;
|
||||
|
||||
public ConfigCategoriesGUI(Player player, Config config) {
|
||||
super(player);
|
||||
this.config = config;
|
||||
init("test", 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void constructGUI() {
|
||||
for (int i = 0; i < config.getCategories().size(); i++) {
|
||||
Category category = config.getCategories().get(i);
|
||||
createButton(i, Material.STONE, category.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerClickables() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerOnCloses() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.library.settings.editor;
|
||||
|
||||
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 java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigCategoriesGUI extends AbstractGUI {
|
||||
|
||||
private final Config config;
|
||||
|
||||
public ConfigCategoriesGUI(Player player, Config config) {
|
||||
super(player);
|
||||
this.config = config;
|
||||
init("test", 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void constructGUI() {
|
||||
for (int i = 0; i < config.getCategories().size(); i++) {
|
||||
Category category = config.getCategories().get(i);
|
||||
createButton(i, Material.STONE, category.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerClickables() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerOnCloses() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.songoda.core.library.settings.editor;
|
||||
|
||||
import com.songoda.core.library.settings.Config;
|
||||
import com.songoda.core.utils.gui.AbstractGUI;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigSelectionGUI extends AbstractGUI {
|
||||
|
||||
private final List<Config> configs = new ArrayList<>();
|
||||
|
||||
public ConfigSelectionGUI(Player player, Config... configs) {
|
||||
super(player);
|
||||
this.configs.addAll(Arrays.asList(configs));
|
||||
init("test", 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void constructGUI() {
|
||||
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);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerClickables() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerOnCloses() {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user