Neary full functional Inventory module.
This commit is contained in:
parent
672befc658
commit
771d2a01f9
9 changed files with 198 additions and 31 deletions
|
@ -1,5 +1,6 @@
|
||||||
basic.loaded.worldguard: Successfully loaded with WorldGuard-Integration
|
basic.loaded.worldguard: Successfully loaded with WorldGuard-Integration
|
||||||
basic.loaded.no_worldguard: Successfully loaded (without WorldGuard)
|
basic.loaded.no_worldguard: Successfully loaded (without WorldGuard)
|
||||||
|
basic.loaded.module: Module loaded.
|
||||||
basic.feature.store: separated inventories
|
basic.feature.store: separated inventories
|
||||||
basic.feature.limit: creative restrictions
|
basic.feature.limit: creative restrictions
|
||||||
basic.feature.region: creative regions
|
basic.feature.region: creative regions
|
||||||
|
|
55
lang/messages_de.properties
Normal file
55
lang/messages_de.properties
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
basic.loaded.worldguard: Erfolgreich mit WorldGuard-Integration geladen
|
||||||
|
basic.loaded.no_worldguard: Erfolgreich geladen (ohne WorldGuard)
|
||||||
|
basic.loaded.module: Modul geladen.
|
||||||
|
basic.feature.store: Getrennte Inventare
|
||||||
|
basic.feature.limit: Kreativ-Einschränkungen
|
||||||
|
basic.feature.region: Kreativ-Regionen
|
||||||
|
basic.conflict: Wegen eines Konfliktes mit {0} ist die Funktion {1} deaktiviert
|
||||||
|
basic.warning.worldguard_not_found: WorldGuard wurd enicht gefunde, dahier ist die Funktion {0} deaktiviert
|
||||||
|
|
||||||
|
command.player: Spieler
|
||||||
|
command.switch.survival: Ändert den Spiel-Modus des Charakters zu überleben
|
||||||
|
command.switch.creative: Ändert den Spiel-Modus des Charakters zu Kreativ
|
||||||
|
command.switch.adventure: Ändert den Spiel-Modus des Charakters zu Abenteuer
|
||||||
|
command.switch.config.overview: "[Einstellung] - liste durch weglassen"
|
||||||
|
command.switch.config.settings: "Verfügbare Einstellungen: "
|
||||||
|
command.switch.config.reload: Lädt das Plugin neu (funktioniert nur teilweise)
|
||||||
|
command.gamemode.changed: "{0}'s Spiel-Modus wurde geändert"
|
||||||
|
command.gamemode.no_change: Bereits in diesem Spiel-Modus
|
||||||
|
command.option.done: Option geändert.
|
||||||
|
command.worldguard.alias: Alias für den //region-Befehl
|
||||||
|
command.worldguard.unknown_flag: Unbekanntes Attribut
|
||||||
|
command.worldguard.available_flags: Verfügbare Attribute
|
||||||
|
command.worldguard.region_not_found: Keine Region mit dieser ID gefunden
|
||||||
|
command.worldguard.world_not_found: Es konnte keine Welt mit diesem Namen gefunden werden
|
||||||
|
command.worldguard.no_flag_given: Es muss ein Attribut angegeben werden, dass gesetzt werden soll
|
||||||
|
command.worldguard.no_integration: Der worldguard-Befehl ist nicht verfügbar, da WorldGuard nicht gefunden wurde
|
||||||
|
command.worldguard.flag_set: "Das Attribut {0} wurde gesetzt"
|
||||||
|
command.worldguard.additional_flags: Zusätzliche Attribute
|
||||||
|
|
||||||
|
cmdblock.blocked: Dieser Befehl ist im Kreativ-Modus blockiert.
|
||||||
|
|
||||||
|
exception.command.lackingpermission: Kein Zugriff auf diesen Befehl
|
||||||
|
exception.command.toomuchparameter: Zuviele Argumente angegeben
|
||||||
|
exception.command.missingparameter: Nicht genügen Argumente angegeben
|
||||||
|
exception.command.playernotfound: Spieler nicht gefunden
|
||||||
|
exception.command.invalidoption: Unbkeannte Option
|
||||||
|
exception.config.savefail: Die Konfiguration konnte nicht gespeichert werden
|
||||||
|
exception.config.material_not_found: (Konfiguration) Material mit Name/ID "{0}" wurde nicht gefunden.
|
||||||
|
exception.storage.load: Fehler beim Laden des Inventars. Bitte einen Admin die Option "UnsafeStorege" in LimitedCreative zu aktivieren um ungültig verzauberte Gegenstände zu erlauben
|
||||||
|
exception.region.not_optional: "In dieser Region kannst du nicht im folgenden Modus sein: {0}"
|
||||||
|
|
||||||
|
blocked.chest: Zugriff auf Truhen ist im Kreativ-Modus nicht erlaubt
|
||||||
|
blocked.sign: Im Kreativ-Modus kann nicht mit Schildern interagiert werden
|
||||||
|
blocked.button: Im Kreativ-Modus kann nicht mit Buttons interagiert werden
|
||||||
|
blocked.lever: Im Kreativ-Modus kann nicht mit Schaltern interagiert werden
|
||||||
|
blocked.survival_flying: Du solltest auf dem Boden stehen wenn du Kreativ-Regionen verlässt
|
||||||
|
blocked.outside_place: Du kannst keine Blöcke auÿerhalb von Spiel-Modus-Regionen setzen
|
||||||
|
blocked.outside_break: Du kannst keine Blöcke auÿerhalb von Spiel-Modus-Regionen zerstören
|
||||||
|
blocked.inside_place: Du kannst keine Blöcke innerhalb von Spiel-Modus-Regionen setzen
|
||||||
|
blocked.inside_break: Du kannst keine Blöcke innerhalb von Spiel-Modus-Regionen zerstören
|
||||||
|
blocked.use: Du darfst diese Art von Gegenständen im Kreativ-Modus verwenden
|
||||||
|
blocked.place: Du darfst diese Art von Blöcken im Kreativ-Modus nicht setzen
|
||||||
|
blocked.break: Du darfst diese Art von Blöcken im Kreativ-Modus nicht zerstören
|
||||||
|
blocked.piston: Verschieben von Block {0} aus einer Spiel-Modus-Region bei {1} wurde blockiert
|
||||||
|
blocked.piston_in: Verschieben von Block {0} in eine Spiel-Modus-Region bei {1} wurde blockiert
|
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
import de.jaschastarke.bukkit.lib.Core;
|
import de.jaschastarke.bukkit.lib.Core;
|
||||||
import de.jaschastarke.bukkit.lib.configuration.PluginConfiguration;
|
import de.jaschastarke.bukkit.lib.configuration.PluginConfiguration;
|
||||||
|
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
|
||||||
import de.jaschastarke.maven.ArchiveDocComments;
|
import de.jaschastarke.maven.ArchiveDocComments;
|
||||||
import de.jaschastarke.utils.ClassDescriptorStorage;
|
import de.jaschastarke.utils.ClassDescriptorStorage;
|
||||||
|
|
||||||
|
@ -17,7 +18,6 @@ public class Config extends PluginConfiguration {
|
||||||
public Config(Core plugin) {
|
public Config(Core plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save() {
|
public void save() {
|
||||||
try {
|
try {
|
||||||
|
@ -27,5 +27,12 @@ public class Config extends PluginConfiguration {
|
||||||
}
|
}
|
||||||
super.save();
|
super.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug
|
||||||
|
*/
|
||||||
|
@IsConfigurationNode(order = 9999)
|
||||||
|
public boolean getDebug() {
|
||||||
|
return config.getBoolean("debug", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package de.jaschastarke.minecraft.limitedcreative;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import de.jaschastarke.hooking.BooleanHooker;
|
import de.jaschastarke.hooking.BooleanHooker;
|
||||||
|
import de.jaschastarke.hooking.GetHooker;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.hooks.AuthMeHooks;
|
import de.jaschastarke.minecraft.limitedcreative.hooks.AuthMeHooks;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.hooks.MultiVerseHooks;
|
import de.jaschastarke.minecraft.limitedcreative.hooks.MultiVerseHooks;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.hooks.PlayerCheckHooker;
|
import de.jaschastarke.minecraft.limitedcreative.hooks.PlayerCheckHooker;
|
||||||
|
@ -13,6 +14,7 @@ public final class Hooks {
|
||||||
public static PlayerCheckHooker IsLoggedIn = new PlayerCheckHooker(true);
|
public static PlayerCheckHooker IsLoggedIn = new PlayerCheckHooker(true);
|
||||||
public static WorldTypeHooker DefaultWorldGameMode = new WorldTypeHooker();
|
public static WorldTypeHooker DefaultWorldGameMode = new WorldTypeHooker();
|
||||||
public static BooleanHooker IsMultiVerse = new BooleanHooker(false);
|
public static BooleanHooker IsMultiVerse = new BooleanHooker(false);
|
||||||
|
public static GetHooker<String> InventoryIncompatible = new GetHooker<String>();
|
||||||
|
|
||||||
public static boolean isPluginEnabled(String pluginName) {
|
public static boolean isPluginEnabled(String pluginName) {
|
||||||
return Bukkit.getServer().getPluginManager().isPluginEnabled(pluginName);
|
return Bukkit.getServer().getPluginManager().isPluginEnabled(pluginName);
|
||||||
|
@ -22,6 +24,7 @@ public final class Hooks {
|
||||||
IsLoggedIn.clearHooks();
|
IsLoggedIn.clearHooks();
|
||||||
DefaultWorldGameMode.clearHooks();
|
DefaultWorldGameMode.clearHooks();
|
||||||
IsMultiVerse.clearHooks();
|
IsMultiVerse.clearHooks();
|
||||||
|
InventoryIncompatible.clearHooks();
|
||||||
|
|
||||||
if (isPluginEnabled("AuthMe")) {
|
if (isPluginEnabled("AuthMe")) {
|
||||||
new AuthMeHooks(plugin);
|
new AuthMeHooks(plugin);
|
||||||
|
@ -32,5 +35,16 @@ public final class Hooks {
|
||||||
if (isPluginEnabled("Multiverse-Core")) {
|
if (isPluginEnabled("Multiverse-Core")) {
|
||||||
new MultiVerseHooks(plugin);
|
new MultiVerseHooks(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InventoryIncompatible.register(new GetHooker.Check<String>() {
|
||||||
|
@Override
|
||||||
|
public String test() {
|
||||||
|
if (isPluginEnabled("MultiInv"))
|
||||||
|
return "MultiInv";
|
||||||
|
if (isPluginEnabled("Multiverse-Inventories"))
|
||||||
|
return "Multiverse-Inventories";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.jaschastarke.minecraft.limitedcreative;
|
||||||
|
|
||||||
import de.jaschastarke.i18n;
|
import de.jaschastarke.i18n;
|
||||||
import de.jaschastarke.bukkit.lib.Core;
|
import de.jaschastarke.bukkit.lib.Core;
|
||||||
|
import de.jaschastarke.bukkit.lib.PluginLang;
|
||||||
|
|
||||||
public class LimitedCreative extends Core {
|
public class LimitedCreative extends Core {
|
||||||
private i18n lang;
|
private i18n lang;
|
||||||
|
@ -9,13 +10,18 @@ public class LimitedCreative extends Core {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnInitialize() {
|
public void OnInitialize() {
|
||||||
|
super.OnInitialize();
|
||||||
config = new Config(this);
|
config = new Config(this);
|
||||||
lang = new i18n("lang/messages");
|
this.debug = config.getDebug();
|
||||||
|
|
||||||
|
lang = new PluginLang("lang/messages", this);
|
||||||
|
|
||||||
|
Hooks.inizializeHooks(this);
|
||||||
|
|
||||||
addModule(new ModInventories(this));
|
addModule(new ModInventories(this));
|
||||||
addModule(new ModCreativeLimits(this));
|
addModule(new ModCreativeLimits(this));
|
||||||
addModule(new ModRegions(this));
|
addModule(new ModRegions(this));
|
||||||
addModule(new ModCmdBlocker(this));
|
addModule(new ModCmdBlocker(this));
|
||||||
Hooks.inizializeHooks(this);
|
|
||||||
|
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,10 @@ public class ModInventories extends CoreModule<LimitedCreative> {
|
||||||
public ModInventories(LimitedCreative plugin) {
|
public ModInventories(LimitedCreative plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Inventory";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Initialize(ModuleEntry<IModule> entry) {
|
public void Initialize(ModuleEntry<IModule> entry) {
|
||||||
|
@ -37,12 +41,18 @@ public class ModInventories extends CoreModule<LimitedCreative> {
|
||||||
listeners.addListener(new PlayerListener(this));
|
listeners.addListener(new PlayerListener(this));
|
||||||
config = plugin.getPluginConfig().registerSection(new InventoryConfig(this));
|
config = plugin.getPluginConfig().registerSection(new InventoryConfig(this));
|
||||||
armor_config = config.registerSection(new ArmoryConfig(this));
|
armor_config = config.registerSection(new ArmoryConfig(this));
|
||||||
|
|
||||||
|
String incomp = Hooks.InventoryIncompatible.test();
|
||||||
|
if (incomp != null) {
|
||||||
|
getLog().warn(plugin.getLocale().trans("basic.conflict", incomp, this.getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void OnEnable() {
|
public void OnEnable() {
|
||||||
super.OnEnable();
|
super.OnEnable();
|
||||||
storage = new InvYamlStorage(this, new File(plugin.getDataFolder(), config.getFolder()));
|
storage = new InvYamlStorage(this, new File(plugin.getDataFolder(), config.getFolder()));
|
||||||
inventories = new WeakHashMap<Player, Inventory>();
|
inventories = new WeakHashMap<Player, Inventory>();
|
||||||
|
getLog().info(plugin.getLocale().trans("basic.loaded.module"));
|
||||||
}
|
}
|
||||||
public InventoryConfig getConfig() {
|
public InventoryConfig getConfig() {
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
/**
|
||||||
|
* This package contains Hookers and Hooks to integrate with other Plugins.
|
||||||
|
*
|
||||||
|
* Hookers are base classes to describe functions to test again. They are simple event manager, which hooks can register
|
||||||
|
* thru. So they should be only instantiated once in a global class.
|
||||||
|
* de.jaschastarke.minecraft.limitedcreative.Hooks in this case.
|
||||||
|
*
|
||||||
|
* Hooks are the implemented event listeners which will be registered to the static hooker-instances. The first hook
|
||||||
|
* sorted by priority which gives an answer will be returned. The exact behavior of multiple hooks are described by
|
||||||
|
* the hooker.
|
||||||
|
*
|
||||||
|
* As the plugins itself doesn't register the hooks it is done by the static
|
||||||
|
* de.jaschastarke.minecraft.limitedcreative.Hooks-initializer.
|
||||||
|
*/
|
||||||
|
package de.jaschastarke.minecraft.limitedcreative.hooks;
|
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.material.MaterialData;
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
import de.jaschastarke.bukkit.lib.ModuleLogger;
|
import de.jaschastarke.bukkit.lib.ModuleLogger;
|
||||||
|
@ -11,14 +12,14 @@ import de.jaschastarke.bukkit.lib.configuration.Configuration;
|
||||||
import de.jaschastarke.bukkit.lib.items.MaterialDataNotRecognizedException;
|
import de.jaschastarke.bukkit.lib.items.MaterialDataNotRecognizedException;
|
||||||
import de.jaschastarke.bukkit.lib.items.MaterilNotRecognizedException;
|
import de.jaschastarke.bukkit.lib.items.MaterilNotRecognizedException;
|
||||||
import de.jaschastarke.bukkit.lib.items.Utils;
|
import de.jaschastarke.bukkit.lib.items.Utils;
|
||||||
import de.jaschastarke.configuration.annotations.IConfigurationSubGroup;
|
import de.jaschastarke.configuration.IConfigurationSubGroup;
|
||||||
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
|
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
|
||||||
import de.jaschastarke.maven.ArchiveDocComments;
|
import de.jaschastarke.maven.ArchiveDocComments;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.LimitedCreative;
|
import de.jaschastarke.minecraft.limitedcreative.LimitedCreative;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.ModInventories;
|
import de.jaschastarke.minecraft.limitedcreative.ModInventories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CreativeArmor
|
* InventoryCreativeArmor
|
||||||
*
|
*
|
||||||
* When set, all creative Player automatically wears the given items as Armor. So they are better seen by other Players.
|
* When set, all creative Player automatically wears the given items as Armor. So they are better seen by other Players.
|
||||||
*/
|
*/
|
||||||
|
@ -29,14 +30,28 @@ public class ArmoryConfig extends Configuration implements IConfigurationSubGrou
|
||||||
mod = modInventories;
|
mod = modInventories;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getNodeName() {
|
public void setValues(ConfigurationSection sect) {
|
||||||
return "armor";
|
if (sect == null || sect.getValues(false).size() == 0) {
|
||||||
|
ConfigurationSection parent_sect = mod.getConfig().getValues();
|
||||||
|
if (parent_sect.contains("armor")) {
|
||||||
|
sect = parent_sect.createSection(this.getName(), parent_sect.getConfigurationSection("armor").getValues(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.setValues(sect);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "creativeArmor";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CreativeArmorEnabled
|
* InventoryCreativeArmorEnabled
|
||||||
*
|
*
|
||||||
* When disabled, the players Armor isn't swapped
|
* When disabled, the players Armor isn't changed.
|
||||||
*
|
*
|
||||||
* default: true
|
* default: true
|
||||||
*/
|
*/
|
||||||
|
@ -44,14 +59,6 @@ public class ArmoryConfig extends Configuration implements IConfigurationSubGrou
|
||||||
public boolean getEnabled() {
|
public boolean getEnabled() {
|
||||||
return config.getBoolean("enabled", true);
|
return config.getBoolean("enabled", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* CreativeArmor-Items
|
|
||||||
*
|
|
||||||
* Allows changing of the "Creative-Armor" to be wear when in creative mode
|
|
||||||
*
|
|
||||||
* *see Blacklist for details on Item-Types
|
|
||||||
*/
|
|
||||||
public Map<String, MaterialData> getCreativeArmor() {
|
public Map<String, MaterialData> getCreativeArmor() {
|
||||||
if (getEnabled()) {
|
if (getEnabled()) {
|
||||||
Map<String, MaterialData> armor = new HashMap<String, MaterialData>();
|
Map<String, MaterialData> armor = new HashMap<String, MaterialData>();
|
||||||
|
@ -74,6 +81,30 @@ public class ArmoryConfig extends Configuration implements IConfigurationSubGrou
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InventoryCreativeArmorItems
|
||||||
|
*
|
||||||
|
* Allows changing of the "Creative-Armor" to be wear when in creative mode
|
||||||
|
*
|
||||||
|
* *see Blacklist for details on Item-Types
|
||||||
|
*/
|
||||||
|
@IsConfigurationNode(order = 500)
|
||||||
|
public String getHead() {
|
||||||
|
return config.getString("head", "CHAINMAIL_HELMET");
|
||||||
|
}
|
||||||
|
@IsConfigurationNode(order = 501)
|
||||||
|
public String getChest() {
|
||||||
|
return config.getString("chest", "CHAINMAIL_CHESTPLATE");
|
||||||
|
}
|
||||||
|
@IsConfigurationNode(order = 502)
|
||||||
|
public String getLegs() {
|
||||||
|
return config.getString("legs", "CHAINMAIL_LEGGINGS");
|
||||||
|
}
|
||||||
|
@IsConfigurationNode(order = 503)
|
||||||
|
public String getFeet() {
|
||||||
|
return config.getString("feet", "CHAINMAIL_BOOTS");
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public String L(String msg, Object... objects) {
|
public String L(String msg, Object... objects) {
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
package de.jaschastarke.minecraft.limitedcreative.inventories;
|
package de.jaschastarke.minecraft.limitedcreative.inventories;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
import de.jaschastarke.bukkit.lib.configuration.Configuration;
|
import de.jaschastarke.bukkit.lib.configuration.Configuration;
|
||||||
import de.jaschastarke.configuration.annotations.IConfigurationSubGroup;
|
import de.jaschastarke.configuration.IConfigurationSubGroup;
|
||||||
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
|
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
|
||||||
import de.jaschastarke.maven.ArchiveDocComments;
|
import de.jaschastarke.maven.ArchiveDocComments;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.ModInventories;
|
import de.jaschastarke.minecraft.limitedcreative.ModInventories;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inventory-Feature
|
||||||
|
*
|
||||||
|
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/inventory/
|
||||||
|
*/
|
||||||
@ArchiveDocComments
|
@ArchiveDocComments
|
||||||
public class InventoryConfig extends Configuration implements IConfigurationSubGroup {
|
public class InventoryConfig extends Configuration implements IConfigurationSubGroup {
|
||||||
protected ModInventories mod;
|
protected ModInventories mod;
|
||||||
|
@ -13,46 +20,67 @@ public class InventoryConfig extends Configuration implements IConfigurationSubG
|
||||||
mod = modInventories;
|
mod = modInventories;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getNodeName() {
|
public void setValues(ConfigurationSection sect) {
|
||||||
return "store";
|
if (sect == null || sect.getValues(false).size() == 0) {
|
||||||
|
ConfigurationSection parent_sect = mod.getPlugin().getPluginConfig().getValues();
|
||||||
|
if (parent_sect.contains("store")) {
|
||||||
|
sect = parent_sect.createSection(this.getName(), parent_sect.getConfigurationSection("store").getValues(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.setValues(sect);
|
||||||
|
// Config Upgrade
|
||||||
|
if (!sect.contains("storeCreative") && sect.contains("creative"))
|
||||||
|
sect.set("storeCreative", sect.getBoolean("creative"));
|
||||||
|
if (!sect.contains("separateAdventure") && sect.contains("adventure"))
|
||||||
|
sect.set("separateAdventure", sect.getBoolean("adventure"));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "inventory";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SeparatedInventoryEnabled
|
* InventoryEnabled
|
||||||
*
|
*
|
||||||
* Use this option to disable the separated inventories feature, for the case you only need the other features.
|
* Use this option to disable the separated inventories feature, for example if you use another Plugin handling
|
||||||
|
* the inventories, like Multiverse-Inventories.
|
||||||
*
|
*
|
||||||
* default: true
|
* default: true
|
||||||
*/
|
*/
|
||||||
@IsConfigurationNode
|
@IsConfigurationNode(order = 100)
|
||||||
public boolean getEnabled() {
|
public boolean getEnabled() {
|
||||||
return config.getBoolean("enabled", true);
|
return config.getBoolean("enabled", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StoreCreative
|
* InventoryStoreCreative
|
||||||
*
|
*
|
||||||
* Should the creative-inventory also be stored on disk, when switching to survival?
|
* Should the creative-inventory also be stored on disk, when switching to survival?
|
||||||
* If disabled, the inventory gets cleared every time on switching to creative.
|
* If disabled, the inventory gets cleared every time on switching to creative.
|
||||||
*
|
*
|
||||||
* default: true
|
* default: true
|
||||||
*/
|
*/
|
||||||
@IsConfigurationNode
|
@IsConfigurationNode(order = 200)
|
||||||
public boolean getStoreCreative() {
|
public boolean getStoreCreative() {
|
||||||
return config.getBoolean("storeCreative", config.getBoolean("creative", true));
|
return config.getBoolean("storeCreative", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SeparateAdventureInventory
|
* InventorySeparateAdventure
|
||||||
*
|
*
|
||||||
* When true, your players get a separate inventory when switching to adventure gamemode (2). Otherwise
|
* When true, your players get a separate inventory when switching to adventure gamemode (2). Otherwise
|
||||||
* they have the default survival inventory while in adventure gamemode.
|
* they have the default survival inventory while in adventure gamemode.
|
||||||
*
|
*
|
||||||
* default: false
|
* default: false
|
||||||
*/
|
*/
|
||||||
@IsConfigurationNode
|
@IsConfigurationNode(order = 300)
|
||||||
public boolean getSeparateAdventure() {
|
public boolean getSeparateAdventure() {
|
||||||
return config.getBoolean("separateAdventure", config.getBoolean("adventure", true));
|
return config.getBoolean("separateAdventure", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +91,7 @@ public class InventoryConfig extends Configuration implements IConfigurationSubG
|
||||||
*
|
*
|
||||||
* default: "inventories"
|
* default: "inventories"
|
||||||
*/
|
*/
|
||||||
@IsConfigurationNode
|
@IsConfigurationNode(order = 400)
|
||||||
public String getFolder() {
|
public String getFolder() {
|
||||||
return config.getString("folder", "inventories");
|
return config.getString("folder", "inventories");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue