forked from Upstream/CommandPanels
Config File Improvements
This commit is contained in:
parent
c48f41f1c3
commit
fe2e7086af
32
resource/config.yml
Normal file
32
resource/config.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# CommandPanels #
|
||||||
|
# Config File #
|
||||||
|
# By RockyHawk #
|
||||||
|
config:
|
||||||
|
version: '3.0'
|
||||||
|
refresh-panels: true
|
||||||
|
panel-blocks: true
|
||||||
|
refresh-delay: '4'
|
||||||
|
stop-sound: true
|
||||||
|
disabled-world-message: true
|
||||||
|
update-notifications: true
|
||||||
|
panel-snooper: false
|
||||||
|
ingame-editor: true
|
||||||
|
input-cancel: cancel
|
||||||
|
input-cancelled: '&cCancelled!'
|
||||||
|
input-message:
|
||||||
|
- '%cp-tag%&aEnter Input for Command'
|
||||||
|
- '&cType &4%cp-args% &cto Cancel the command'
|
||||||
|
format:
|
||||||
|
perms: '&cNo permission.'
|
||||||
|
reload: '&aReloaded.'
|
||||||
|
nopanel: '&cPanel not found.'
|
||||||
|
noitem: '&cPanel doesn''t have clickable item.'
|
||||||
|
notitem: '&cPlayer not found.'
|
||||||
|
error: '&cError found in config at'
|
||||||
|
needmoney: '&cInsufficient Funds!'
|
||||||
|
needitems: '&cInsufficient Items!'
|
||||||
|
bought: '&aSuccessfully Bought For $%cp-args%'
|
||||||
|
sold: '&aSuccessfully Sold For $%cp-args%'
|
||||||
|
tag: '&6[&bCommandPanels&6]'
|
||||||
|
offline: 'Offline'
|
||||||
|
offlineHeadValue: 'eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmU1Mjg2YzQ3MGY2NmZmYTFhMTgzMzFjYmZmYjlhM2MyYTQ0MjRhOGM3MjU5YzQ0MzZmZDJlMzU1ODJhNTIyIn19fQ=='
|
@ -1,3 +1,6 @@
|
|||||||
|
# CommandPanels #
|
||||||
|
# Example File #
|
||||||
|
# By RockyHawk #
|
||||||
panels:
|
panels:
|
||||||
example:
|
example:
|
||||||
perm: default
|
perm: default
|
||||||
@ -6,6 +9,8 @@ panels:
|
|||||||
command: example
|
command: example
|
||||||
sound-on-open: BLOCK_NOTE_BLOCK_CHIME
|
sound-on-open: BLOCK_NOTE_BLOCK_CHIME
|
||||||
empty: BLACK_STAINED_GLASS_PANE
|
empty: BLACK_STAINED_GLASS_PANE
|
||||||
|
disabled-worlds:
|
||||||
|
- 'world_nether'
|
||||||
open-with-item:
|
open-with-item:
|
||||||
material: CLOCK
|
material: CLOCK
|
||||||
name: '&6[&bExample Panel&6]'
|
name: '&6[&bExample Panel&6]'
|
||||||
|
@ -98,34 +98,31 @@ public class commandpanels extends JavaPlugin {
|
|||||||
this.getServer().getPluginManager().registerEvents(new editorUserInput(this), this);
|
this.getServer().getPluginManager().registerEvents(new editorUserInput(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new commandpanelrefresher(this), this);
|
this.getServer().getPluginManager().registerEvents(new commandpanelrefresher(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new panelBlockOnClick(this), this);
|
this.getServer().getPluginManager().registerEvents(new panelBlockOnClick(this), this);
|
||||||
this.config.addDefault("config.version", "3.0");
|
|
||||||
this.config.addDefault("config.refresh-panels", "true");
|
//save the config.yml file
|
||||||
this.config.addDefault("config.panel-blocks", "true");
|
File configFile = new File(this.getDataFolder() + File.separator + "config.yml");
|
||||||
this.config.addDefault("config.refresh-delay", "4");
|
if (!configFile.exists()) {
|
||||||
this.config.addDefault("config.stop-sound", "true");
|
//generate a new config file from internal resources
|
||||||
this.config.addDefault("config.disabled-world-message", "true");
|
try {
|
||||||
this.config.addDefault("config.update-notifications", "true");
|
FileConfiguration configFileConfiguration = YamlConfiguration.loadConfiguration(getReaderFromStream(this.getResource("config.yml")));
|
||||||
this.config.addDefault("config.panel-snooper", "false");
|
configFileConfiguration.save(configFile);
|
||||||
this.config.addDefault("config.ingame-editor", "true");
|
this.config = YamlConfiguration.loadConfiguration(new File(this.getDataFolder() + File.separator + "config.yml"));
|
||||||
this.config.addDefault("config.input-cancel", "cancel");
|
} catch (IOException var11) {
|
||||||
this.config.addDefault("config.input-cancelled", "&cCancelled!");
|
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " WARNING: Could not save the config file!");
|
||||||
List<String> inputMessage = new ArrayList();
|
}
|
||||||
inputMessage.add("%cp-tag%&aEnter Input for Command");
|
}else{
|
||||||
inputMessage.add("&cType &4%cp-args% &cto Cancel the command");
|
//check if the config file has any missing elements
|
||||||
this.config.addDefault("config.input-message", inputMessage);
|
try {
|
||||||
this.config.addDefault("config.format.perms", "&cNo permission.");
|
YamlConfiguration configFileConfiguration = YamlConfiguration.loadConfiguration(getReaderFromStream(this.getResource("config.yml")));
|
||||||
this.config.addDefault("config.format.reload", "&aReloaded.");
|
this.config.addDefaults(configFileConfiguration);
|
||||||
this.config.addDefault("config.format.nopanel", "&cPanel not found.");
|
this.config.options().copyDefaults(true);
|
||||||
this.config.addDefault("config.format.noitem", "&cPanel doesn't have clickable item.");
|
this.config.save(new File(this.getDataFolder() + File.separator + "config.yml"));
|
||||||
this.config.addDefault("config.format.notitem", "&cPlayer not found.");
|
} catch (IOException var10) {
|
||||||
this.config.addDefault("config.format.error", "&cError found in config at");
|
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " WARNING: Could not save the config file!");
|
||||||
this.config.addDefault("config.format.needmoney", "&cInsufficient Funds!");
|
}
|
||||||
this.config.addDefault("config.format.needitems", "&cInsufficient Items!");
|
}
|
||||||
this.config.addDefault("config.format.bought", "&aSuccessfully Bought For $%cp-args%");
|
|
||||||
this.config.addDefault("config.format.sold", "&aSuccessfully Sold For $%cp-args%");
|
//save the example.yml file
|
||||||
this.config.addDefault("config.format.tag", "&6[&bCommandPanels&6]");
|
|
||||||
this.config.addDefault("config.format.offline", "Offline");
|
|
||||||
this.config.addDefault("config.format.offlineHeadValue", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmU1Mjg2YzQ3MGY2NmZmYTFhMTgzMzFjYmZmYjlhM2MyYTQ0MjRhOGM3MjU5YzQ0MzZmZDJlMzU1ODJhNTIyIn19fQ==");
|
|
||||||
if (!this.panelsf.exists() || Objects.requireNonNull(this.panelsf.list()).length == 0) {
|
if (!this.panelsf.exists() || Objects.requireNonNull(this.panelsf.list()).length == 0) {
|
||||||
try {
|
try {
|
||||||
FileConfiguration exampleFileConfiguration = YamlConfiguration.loadConfiguration(getReaderFromStream(this.getResource("example.yml")));
|
FileConfiguration exampleFileConfiguration = YamlConfiguration.loadConfiguration(getReaderFromStream(this.getResource("example.yml")));
|
||||||
@ -135,13 +132,6 @@ public class commandpanels extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.config.options().copyDefaults(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.config.save(new File(this.getDataFolder() + File.separator + "config.yml"));
|
|
||||||
} catch (IOException var10) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " WARNING: Could not save the config file!");
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (!Objects.equals(this.config.getString("config.version"), "3.0")) {
|
if (!Objects.equals(this.config.getString("config.version"), "3.0")) {
|
||||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " WARNING: Config version doesn't match the recommended version. You may run into issues.");
|
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " WARNING: Config version doesn't match the recommended version. You may run into issues.");
|
||||||
|
Loading…
Reference in New Issue
Block a user