mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-16 15:38:14 +01:00
Merge pull request #27 from riking/refactoring
Refactor out initConfig method
This commit is contained in:
commit
406627e404
@ -1,6 +1,8 @@
|
||||
package me.libraryaddict.disguise;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.PacketsManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class DisguiseConfig {
|
||||
private static boolean animationEnabled;
|
||||
@ -346,4 +348,37 @@ public class DisguiseConfig {
|
||||
private DisguiseConfig() {
|
||||
}
|
||||
|
||||
public static void initConfig(ConfigurationSection config) {
|
||||
setSoundsEnabled(config.getBoolean("DisguiseSounds"));
|
||||
setVelocitySent(config.getBoolean("SendVelocity"));
|
||||
setViewDisguises(config.getBoolean("ViewSelfDisguises"));
|
||||
setHearSelfDisguise(config.getBoolean("HearSelfDisguise"));
|
||||
setHideArmorFromSelf(config.getBoolean("RemoveArmor"));
|
||||
setHideHeldItemFromSelf(config.getBoolean("RemoveHeldItem"));
|
||||
setAddEntityAnimations(config.getBoolean("AddEntityAnimations"));
|
||||
setNameOfPlayerShownAboveDisguise(config.getBoolean("ShowNamesAboveDisguises"));
|
||||
setNameAboveHeadAlwaysVisible(config.getBoolean("NameAboveHeadAlwaysVisible"));
|
||||
setModifyBoundingBox(config.getBoolean("ModifyBoundingBox"));
|
||||
setMonstersIgnoreDisguises(config.getBoolean("MonstersIgnoreDisguises"));
|
||||
setDisguiseBlownOnAttack(config.getBoolean("BlowDisguises"));
|
||||
setDisguiseBlownMessage(ChatColor.translateAlternateColorCodes('&',
|
||||
config.getString("BlownDisguiseMessage")));
|
||||
setKeepDisguiseOnPlayerDeath(config.getBoolean("KeepDisguises.PlayerDeath"));
|
||||
setKeepDisguiseOnPlayerLogout(config.getBoolean("KeepDisguises.PlayerLogout"));
|
||||
setKeepDisguiseOnEntityDespawn(config.getBoolean("KeepDisguises.EntityDespawn"));
|
||||
setMiscDisguisesForLivingEnabled(config.getBoolean("MiscDisguisesForLiving"));
|
||||
setMovementPacketsEnabled(config.getBoolean("PacketsEnabled.Movement"));
|
||||
setWitherSkullPacketsEnabled(config.getBoolean("PacketsEnabled.WitherSkull"));
|
||||
setEnquipmentPacketsEnabled(config.getBoolean("PacketsEnabled.Enquipment"));
|
||||
setAnimationPacketsEnabled(config.getBoolean("PacketsEnabled.Animation"));
|
||||
setBedPacketsEnabled(config.getBoolean("PacketsEnabled.Bed"));
|
||||
setRidingPacketsEnabled(config.getBoolean("PacketsEnabled.Riding"));
|
||||
setEntityStatusPacketsEnabled(config.getBoolean("PacketsEnabled.EntityStatus"));
|
||||
setCollectPacketsEnabled(config.getBoolean("PacketsEnabled.Collect"));
|
||||
setMetadataPacketsEnabled(config.getBoolean("PacketsEnabled.Metadata"));
|
||||
setMaxHealthDeterminedByDisguisedEntity(config.getBoolean("MaxHealthDeterminedByEntity"));
|
||||
setDisguiseEntityExpire(config.getInt("DisguiseEntityExpire"));
|
||||
setDisguiseCloneExpire(config.getInt("DisguiseCloneExpire"));
|
||||
setMaxClonedDisguises(config.getInt("DisguiseCloneSize"));
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import me.libraryaddict.disguise.utilities.ReflectionManager;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseValues;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Damageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -89,37 +88,8 @@ public class LibsDisguises extends JavaPlugin {
|
||||
|
||||
PacketsManager.init(this);
|
||||
DisguiseUtilities.init(this);
|
||||
DisguiseConfig.setSoundsEnabled(getConfig().getBoolean("DisguiseSounds"));
|
||||
DisguiseConfig.setVelocitySent(getConfig().getBoolean("SendVelocity"));
|
||||
DisguiseConfig.setViewDisguises(getConfig().getBoolean("ViewSelfDisguises"));
|
||||
DisguiseConfig.setHearSelfDisguise(getConfig().getBoolean("HearSelfDisguise"));
|
||||
DisguiseConfig.setHideArmorFromSelf(getConfig().getBoolean("RemoveArmor"));
|
||||
DisguiseConfig.setHideHeldItemFromSelf(getConfig().getBoolean("RemoveHeldItem"));
|
||||
DisguiseConfig.setAddEntityAnimations(getConfig().getBoolean("AddEntityAnimations"));
|
||||
DisguiseConfig.setNameOfPlayerShownAboveDisguise(getConfig().getBoolean("ShowNamesAboveDisguises"));
|
||||
DisguiseConfig.setNameAboveHeadAlwaysVisible(getConfig().getBoolean("NameAboveHeadAlwaysVisible"));
|
||||
DisguiseConfig.setModifyBoundingBox(getConfig().getBoolean("ModifyBoundingBox"));
|
||||
DisguiseConfig.setMonstersIgnoreDisguises(getConfig().getBoolean("MonstersIgnoreDisguises"));
|
||||
DisguiseConfig.setDisguiseBlownOnAttack(getConfig().getBoolean("BlowDisguises"));
|
||||
DisguiseConfig.setDisguiseBlownMessage(ChatColor.translateAlternateColorCodes('&',
|
||||
getConfig().getString("BlownDisguiseMessage")));
|
||||
DisguiseConfig.setKeepDisguiseOnPlayerDeath(getConfig().getBoolean("KeepDisguises.PlayerDeath"));
|
||||
DisguiseConfig.setKeepDisguiseOnPlayerLogout(getConfig().getBoolean("KeepDisguises.PlayerLogout"));
|
||||
DisguiseConfig.setKeepDisguiseOnEntityDespawn(getConfig().getBoolean("KeepDisguises.EntityDespawn"));
|
||||
DisguiseConfig.setMiscDisguisesForLivingEnabled(getConfig().getBoolean("MiscDisguisesForLiving"));
|
||||
DisguiseConfig.setMovementPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Movement"));
|
||||
DisguiseConfig.setWitherSkullPacketsEnabled(getConfig().getBoolean("PacketsEnabled.WitherSkull"));
|
||||
DisguiseConfig.setEnquipmentPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Enquipment"));
|
||||
DisguiseConfig.setAnimationPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Animation"));
|
||||
DisguiseConfig.setBedPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Bed"));
|
||||
DisguiseConfig.setRidingPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Riding"));
|
||||
DisguiseConfig.setEntityStatusPacketsEnabled(getConfig().getBoolean("PacketsEnabled.EntityStatus"));
|
||||
DisguiseConfig.setCollectPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Collect"));
|
||||
DisguiseConfig.setMetadataPacketsEnabled(getConfig().getBoolean("PacketsEnabled.Metadata"));
|
||||
DisguiseConfig.setMaxHealthDeterminedByDisguisedEntity(getConfig().getBoolean("MaxHealthDeterminedByEntity"));
|
||||
DisguiseConfig.setDisguiseEntityExpire(getConfig().getInt("DisguiseEntityExpire"));
|
||||
DisguiseConfig.setDisguiseCloneExpire(getConfig().getInt("DisguiseCloneExpire"));
|
||||
DisguiseConfig.setMaxClonedDisguises(getConfig().getInt("DisguiseCloneSize"));
|
||||
DisguiseConfig.initConfig(getConfig());
|
||||
|
||||
try {
|
||||
// Here I use reflection to set the plugin for Disguise..
|
||||
// Kind of stupid but I don't want open API calls for a commonly used object.
|
||||
|
Loading…
Reference in New Issue
Block a user