mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Removing Static Abuse - WorldBlackList -> WorldBlackListManager
This commit is contained in:
parent
bd0a673838
commit
8b39224cbc
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party.teleport;
|
package com.gmail.nossr50.commands.party.teleport;
|
||||||
|
|
||||||
import com.gmail.nossr50.commands.CommandConstants;
|
import com.gmail.nossr50.commands.CommandConstants;
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||||
@ -53,7 +52,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(player.getWorld().getName()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!pluginRef.getUserManager().hasPlayerDataKey(player)) {
|
if (!pluginRef.getUserManager().hasPlayerDataKey(player)) {
|
||||||
|
@ -1,209 +0,0 @@
|
|||||||
package com.gmail.nossr50.config;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@ConfigSerializable
|
|
||||||
public class AdvancedConfig extends ConfigValidated {
|
|
||||||
|
|
||||||
public static final String SKILLS = "Skills";
|
|
||||||
public static final String GENERAL = "General";
|
|
||||||
public static final String ABILITY = "Ability";
|
|
||||||
public static final String LENGTH = "Length";
|
|
||||||
public static final String INCREASE_LEVEL = "IncreaseLevel";
|
|
||||||
public static final String ENCHANT_BUFF = "EnchantBuff";
|
|
||||||
public static final String ACROBATICS = "Acrobatics";
|
|
||||||
public static final String DODGE = "Dodge";
|
|
||||||
public static final String CHANCE = "Chance";
|
|
||||||
public static final String CHANCE_MAX = CHANCE + "Max";
|
|
||||||
public static final String BONUS = "Bonus";
|
|
||||||
public static final String MAX_BONUS_LEVEL = "Max" + BONUS + "Level";
|
|
||||||
public static final String MODIFIER = "Modifier";
|
|
||||||
public static final String DAMAGE_MODIFIER = "Damage" + MODIFIER;
|
|
||||||
public static final String DAMAGE_THRESHOLD = "DamageThreshold";
|
|
||||||
public static final String ALCHEMY = "Alchemy";
|
|
||||||
public static final String CATALYSIS = "Catalysis";
|
|
||||||
public static final String MIN_SPEED = "MinSpeed";
|
|
||||||
public static final String MAX_SPEED = "MaxSpeed";
|
|
||||||
public static final String ARCHERY = "Archery";
|
|
||||||
public static final String SKILL_SHOT = "SkillShot";
|
|
||||||
public static final String MULTIPLIER = "Multiplier";
|
|
||||||
public static final String RANK_DAMAGE_MULTIPLIER = "RankDamage" + MULTIPLIER;
|
|
||||||
public static final String BONUS_DAMAGE = BONUS + "Damage";
|
|
||||||
public static final String FORCE_MULTIPLIER = "Force" + MULTIPLIER;
|
|
||||||
public static final String AXES = "Axes";
|
|
||||||
public static final String STANDARD = "Standard";
|
|
||||||
public static final String RETRO_MODE = "RetroMode";
|
|
||||||
public static final String CAP_LEVEL = "CapLevel";
|
|
||||||
public static final String KNOCKBACK_MODIFIER = "Knockback" + MODIFIER;
|
|
||||||
public static final String PVP_MODIFIER = "PVP_" + MODIFIER;
|
|
||||||
public static final String PVE_MODIFIER = "PVE_" + MODIFIER;
|
|
||||||
public static final String FISHING = "Fishing";
|
|
||||||
public static final String MASTER_ANGLER = "MasterAngler";
|
|
||||||
public static final String BOAT_MODIFIER = "Boat" + MODIFIER;
|
|
||||||
public static final String BIOME_MODIFIER = "Biome" + MODIFIER;
|
|
||||||
public static final String XP = "XP";
|
|
||||||
public static final String VANILLA_XPMULTIPLIER = "Vanilla" + XP + MULTIPLIER;
|
|
||||||
public static final String RANK = "Rank_";
|
|
||||||
public static final String TAMING = "Taming";
|
|
||||||
public static final String CALL_OF_THE_WILD = "CallOfTheWild";
|
|
||||||
public static final String MIN_HORSE_JUMP_STRENGTH = "MinHorseJumpStrength";
|
|
||||||
public static final String MAX_HORSE_JUMP_STRENGTH = "MaxHorseJumpStrength";
|
|
||||||
public static final String SHOCK_PROOF = "ShockProof";
|
|
||||||
public static final String UNARMED = "Unarmed";
|
|
||||||
public static final String STARTING_LEVEL = "StartingLevel";
|
|
||||||
public static final String AXE_MASTERY = "AxeMastery";
|
|
||||||
public static final String CRITICAL_STRIKES = "CriticalStrikes";
|
|
||||||
public static final String GREATER_IMPACT = "GreaterImpact";
|
|
||||||
public static final String ARMOR_IMPACT = "ArmorImpact";
|
|
||||||
public static final String SKULL_SPLITTER = "SkullSplitter";
|
|
||||||
public static final String MAX_PERCENTAGE_DURABILITY_DAMAGE = "MaxPercentageDurabilityDamage";
|
|
||||||
public static final String SHAKE = "Shake";
|
|
||||||
public static final String MINING = "Mining";
|
|
||||||
public static final String BLAST_MINING = "BlastMining";
|
|
||||||
public static final String LEVELS = "Levels";
|
|
||||||
public static final String BLAST_DAMAGE_DECREASE = "BlastDamageDecrease";
|
|
||||||
public static final String ORE_BONUS = "Ore" + BONUS;
|
|
||||||
public static final String DEBRIS_REDUCTION = "DebrisReduction";
|
|
||||||
public static final String DROP_MULTIPLIER = "Drop" + MULTIPLIER;
|
|
||||||
public static final String BLAST_RADIUS = "BlastRadius";
|
|
||||||
public static final String REPAIR = "Repair";
|
|
||||||
public static final String REPAIR_MASTERY = "RepairMastery";
|
|
||||||
public static final String MAX_BONUS_PERCENTAGE = "Max" + BONUS + "Percentage";
|
|
||||||
public static final String ARCANE_FORGING = "ArcaneForging";
|
|
||||||
public static final String MAY_LOSE_ENCHANTS = "May_Lose_Enchants";
|
|
||||||
public static final String KEEP_ENCHANTS = "Keep_Enchants_";
|
|
||||||
public static final String DOWNGRADES = "Downgrades_";
|
|
||||||
public static final String ENABLED = "Enabled";
|
|
||||||
public static final String DOWNGRADES_ENABLED = DOWNGRADES + ENABLED;
|
|
||||||
public static final String SALVAGE = "Salvage";
|
|
||||||
public static final String ARCANE_SALVAGE = "ArcaneSalvage";
|
|
||||||
public static final String ENCHANT_DOWNGRADE_ENABLED = "EnchantDowngrade" + ENABLED;
|
|
||||||
public static final String ENCHANT_LOSS_ENABLED = "EnchantLoss" + ENABLED;
|
|
||||||
public static final String EXTRACT_FULL_ENCHANT = "ExtractFullEnchant";
|
|
||||||
public static final String EXTRACT_PARTIAL_ENCHANT = "ExtractPartialEnchant";
|
|
||||||
public static final String SMELTING = "Smelting";
|
|
||||||
public static final String FUEL_EFFICIENCY = "FuelEfficiency";
|
|
||||||
public static final String SWORDS = "Swords";
|
|
||||||
public static final String RUPTURE = "Rupture";
|
|
||||||
public static final String DAMAGE_PLAYER = "DamagePlayer";
|
|
||||||
public static final String DAMAGE_MOBS = "DamageMobs";
|
|
||||||
public static final String MAX_TICKS = "MaxTicks";
|
|
||||||
public static final String BASE_TICKS = "BaseTicks";
|
|
||||||
public static final String COUNTER_ATTACK = "CounterAttack";
|
|
||||||
public static final String SERRATED_STRIKES = "SerratedStrikes";
|
|
||||||
public static final String TICKS = "Ticks";
|
|
||||||
public static final String GORE = "Gore";
|
|
||||||
public static final String FAST_FOOD = "FastFood";
|
|
||||||
public static final String FAST_FOOD_SERVICE = FAST_FOOD + "Service";
|
|
||||||
public static final String PUMMEL = "Pummel";
|
|
||||||
public static final String THICK_FUR = "ThickFur";
|
|
||||||
public static final String SHARPENED_CLAWS = "SharpenedClaws";
|
|
||||||
public static final String DISARM = "Disarm";
|
|
||||||
public static final String ANTI_THEFT = "AntiTheft";
|
|
||||||
public static final String DAZE = "Daze";
|
|
||||||
public static final String MAX_DAMAGE = "MaxDamage";
|
|
||||||
public static final String ROLL = "Roll";
|
|
||||||
public static final String GRACEFUL_ROLL = "Graceful" + ROLL;
|
|
||||||
public static final String ARROW_DEFLECT = "ArrowDeflect";
|
|
||||||
public static final String IRON_GRIP = "IronGrip";
|
|
||||||
public static final String WOODCUTTING = "Woodcutting";
|
|
||||||
public static final String HARVEST_LUMBER = "HarvestLumber";
|
|
||||||
public static final String FEEDBACK = "Feedback";
|
|
||||||
public static final String SKILL_COMMAND = "SkillCommand";
|
|
||||||
public static final String BLANK_LINES_ABOVE_HEADER = "BlankLinesAboveHeader";
|
|
||||||
public static final String ACTION_BAR_NOTIFICATIONS = "ActionBarNotifications";
|
|
||||||
public static final String SEND_COPY_OF_MESSAGE_TO_CHAT = "SendCopyOfMessageToChat";
|
|
||||||
public static final String EVENTS = "Events";
|
|
||||||
public static final String SEND_TITLES = "SendTitles";
|
|
||||||
//private static AdvancedConfig instance;
|
|
||||||
|
|
||||||
public AdvancedConfig() {
|
|
||||||
//super(mcMMO.getDataFolderPath().getAbsoluteFile(), "advanced.yml", true);
|
|
||||||
super("advanced", pluginRef.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This grabs an instance of this config class from the Config Manager
|
|
||||||
* This method is deprecated and will be removed in the future
|
|
||||||
*
|
|
||||||
* @return the instance of this config
|
|
||||||
* @see mcMMO#getConfigManager()
|
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static AdvancedConfig getInstance() {
|
|
||||||
return pluginRef.getConfigManager().getAdvancedConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The version of this config
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public double getConfigVersion() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> validateKeys() {
|
|
||||||
// Validate all the settings!
|
|
||||||
List<String> reason = new ArrayList<>();
|
|
||||||
return reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GENERAL */
|
|
||||||
|
|
||||||
/* Notification Settings */
|
|
||||||
|
|
||||||
/* FISHING */
|
|
||||||
public double getShakeChance(int rank) {
|
|
||||||
return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank));
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMasterAnglerBoatModifier() {
|
|
||||||
return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMasterAnglerBiomeModifier() {
|
|
||||||
return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TAMING */
|
|
||||||
public double getGoreModifier() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getFastFoodChance() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, FAST_FOOD_SERVICE, CHANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPummelChance() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, PUMMEL, CHANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getThickFurModifier() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, THICK_FUR, MODIFIER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getShockProofModifier() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, SHOCK_PROOF, MODIFIER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getSharpenedClawsBonus() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, SHARPENED_CLAWS, BONUS);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMinHorseJumpStrength() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MIN_HORSE_JUMP_STRENGTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMaxHorseJumpStrength() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MAX_HORSE_JUMP_STRENGTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,481 +0,0 @@
|
|||||||
package com.gmail.nossr50.config;
|
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
|
||||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
|
||||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles loading and cacheing configuration settings from a configurable compatible config file
|
|
||||||
*/
|
|
||||||
public abstract class Config implements VersionedConfig {
|
|
||||||
|
|
||||||
public static final String HOCON_FILE_EXTENSION = ".conf";
|
|
||||||
public final File DIRECTORY_DATA_FOLDER; //Directory that the file is in
|
|
||||||
public final String FILE_RELATIVE_PATH; //Relative Path to the file
|
|
||||||
protected final String DIRECTORY_DEFAULTS = "defaults";
|
|
||||||
/* SETTINGS */
|
|
||||||
//private static final String FILE_EXTENSION = ".conf"; //HOCON
|
|
||||||
private boolean mergeNewKeys; //Whether or not to merge keys found in the default config
|
|
||||||
private boolean removeOldKeys; //Whether or not to remove unused keys form the config
|
|
||||||
|
|
||||||
/* PATH VARS */
|
|
||||||
private boolean copyDefaults; //Whether or not to copy the default config when first creating the file
|
|
||||||
private boolean generateDefaults; //Whether or not we use Configurate to generate a default file, if this is false we copy the file from the JAR
|
|
||||||
private String fileName; //The file name of the config
|
|
||||||
|
|
||||||
/* LOADERS */
|
|
||||||
private HoconConfigurationLoader defaultCopyLoader;
|
|
||||||
private HoconConfigurationLoader userCopyLoader;
|
|
||||||
|
|
||||||
//private ConfigurationLoader<CommentedCommentedConfigurationNode> defaultCopyLoader;
|
|
||||||
//private ConfigurationLoader<CommentedCommentedConfigurationNode> userCopyLoader;
|
|
||||||
|
|
||||||
/* CONFIG FILES */
|
|
||||||
|
|
||||||
private File resourceConfigCopy; //Copy of the default config from the JAR (file is copied so that admins can easily compare to defaults)
|
|
||||||
private File resourceUserCopy; //File in the /$MCMMO_ROOT/mcMMO/ directory that may contain user edited settings
|
|
||||||
|
|
||||||
/* ROOT NODES */
|
|
||||||
|
|
||||||
private CommentedConfigurationNode userRootNode = null;
|
|
||||||
private CommentedConfigurationNode defaultRootNode = null;
|
|
||||||
|
|
||||||
/* CONFIG MANAGER */
|
|
||||||
//private ConfigurationLoader<CommentedCommentedConfigurationNode> configManager;
|
|
||||||
|
|
||||||
/*public Config(String pathToParentFolder, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
|
||||||
//TODO: Check if this works...
|
|
||||||
this(new File(pathToParentFolder), relativePath, mergeNewKeys, copyDefaults, removeOldKeys);
|
|
||||||
System.out.println("mcMMO Debug: Don't forget to check if loading config file by string instead of File works...");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public Config(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
|
||||||
mkdirDefaults(); // Make our default config dir
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These must be at the top
|
|
||||||
*/
|
|
||||||
this.fileName = fileName;
|
|
||||||
this.generateDefaults = generateDefaults;
|
|
||||||
this.copyDefaults = copyDefaults;
|
|
||||||
this.mergeNewKeys = mergeNewKeys; //Whether or not we add new keys when they are found
|
|
||||||
this.removeOldKeys = removeOldKeys;
|
|
||||||
|
|
||||||
DIRECTORY_DATA_FOLDER = pathToParentFolder; //Data Folder for our plugin
|
|
||||||
FILE_RELATIVE_PATH = relativePath + fileName + HOCON_FILE_EXTENSION; //Relative path to config from a parent folder
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initFullConfig() {
|
|
||||||
//Attempt IO Operations
|
|
||||||
try {
|
|
||||||
//Makes sure we have valid Files corresponding to this config
|
|
||||||
initConfigFiles();
|
|
||||||
|
|
||||||
//Init MainConfig Loaders
|
|
||||||
initConfigLoaders();
|
|
||||||
|
|
||||||
//Load MainConfig Nodes
|
|
||||||
loadConfig();
|
|
||||||
|
|
||||||
//Attempt to update user file, and then load it into memory
|
|
||||||
readConfig();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Cleanup and backup registers
|
|
||||||
// registerUnload();
|
|
||||||
registerFileBackup();
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Registers with the config managers unloader
|
|
||||||
// * The unloader runs when the plugin gets disabled which cleans up registries to make reloading safe
|
|
||||||
// */
|
|
||||||
// private void registerUnload() {
|
|
||||||
// mcMMO.getConfigManager().registerUnloadable(this);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers with the config managers file list
|
|
||||||
* Used for backing up configs with our zip library
|
|
||||||
*/
|
|
||||||
private void registerFileBackup() {
|
|
||||||
pluginRef.getConfigManager().registerUserFile(getUserConfigFile());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the default copy File and the user config File
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private void initConfigFiles() throws IOException {
|
|
||||||
//Init our config copy
|
|
||||||
resourceConfigCopy = initDefaultConfig();
|
|
||||||
|
|
||||||
//Init the user file
|
|
||||||
resourceUserCopy = initUserConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the root node for the default config File and user config File
|
|
||||||
*/
|
|
||||||
private void loadConfig() {
|
|
||||||
try {
|
|
||||||
final CommentedConfigurationNode defaultConfig = this.defaultCopyLoader.load();
|
|
||||||
defaultRootNode = defaultConfig;
|
|
||||||
|
|
||||||
final CommentedConfigurationNode userConfig = this.userCopyLoader.load();
|
|
||||||
userRootNode = userConfig;
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the Configuration Loaders for this config
|
|
||||||
*/
|
|
||||||
private void initConfigLoaders() {
|
|
||||||
this.defaultCopyLoader = HoconConfigurationLoader.builder().setPath(resourceConfigCopy.toPath()).build();
|
|
||||||
this.userCopyLoader = HoconConfigurationLoader.builder().setPath(resourceUserCopy.toPath()).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copies a new file from the JAR to the defaults directory and uses that new file to initialize our resourceConfigCopy
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
* @see Config#resourceConfigCopy
|
|
||||||
*/
|
|
||||||
private File initDefaultConfig() throws IOException {
|
|
||||||
if (generateDefaults) {
|
|
||||||
return generateDefaultFile();
|
|
||||||
} else
|
|
||||||
return copyDefaultFromJar(getDefaultConfigCopyRelativePath(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a default config file using the Configurate library, makes use of @Setting and @ConfigSerializable annotations in the config file
|
|
||||||
* Assigns the default root node to the newly loaded default config if successful
|
|
||||||
*
|
|
||||||
* @return the File for the newly created config
|
|
||||||
*/
|
|
||||||
private File generateDefaultFile() {
|
|
||||||
pluginRef.getLogger().info("Attempting to create a default config for " + fileName);
|
|
||||||
|
|
||||||
//Not sure if this will work properly...
|
|
||||||
Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath());
|
|
||||||
ConfigurationLoader<CommentedConfigurationNode> generation_loader
|
|
||||||
= HoconConfigurationLoader.builder().setPath(potentialFile).build();
|
|
||||||
|
|
||||||
try {
|
|
||||||
pluginRef.getLogger().info("Config File Full Path: " + getDefaultConfigFile().getAbsolutePath());
|
|
||||||
//Delete any existing default config
|
|
||||||
if (getDefaultConfigFile().exists())
|
|
||||||
getDefaultConfigFile().delete();
|
|
||||||
|
|
||||||
//Make new file
|
|
||||||
getDefaultConfigFile().createNewFile();
|
|
||||||
|
|
||||||
//Load the config
|
|
||||||
defaultRootNode = generation_loader.load();
|
|
||||||
|
|
||||||
//Save to a new file
|
|
||||||
generation_loader.save(defaultRootNode);
|
|
||||||
|
|
||||||
pluginRef.getLogger().info("Generated a default file for " + fileName);
|
|
||||||
} catch (IOException e) {
|
|
||||||
pluginRef.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Return the default file
|
|
||||||
return getDefaultConfigFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attemps to load the config file if it exists, if it doesn't it copies a new one from within the JAR
|
|
||||||
*
|
|
||||||
* @return user config File
|
|
||||||
* @throws IOException
|
|
||||||
* @see Config#resourceUserCopy
|
|
||||||
*/
|
|
||||||
private File initUserConfig() throws IOException {
|
|
||||||
File userCopy = new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH); //Load the user file;
|
|
||||||
|
|
||||||
if (userCopy.exists()) {
|
|
||||||
// Yay
|
|
||||||
return userCopy;
|
|
||||||
} else {
|
|
||||||
//If it's gone we copy default files
|
|
||||||
//Note that we don't copy the values from the default copy put in /defaults/ that file exists only as a reference to admins and is unreliable
|
|
||||||
if (copyDefaults)
|
|
||||||
return copyDefaultFromJar(FILE_RELATIVE_PATH, false);
|
|
||||||
else {
|
|
||||||
//Make a new empty file
|
|
||||||
userCopy.createNewFile();
|
|
||||||
return userCopy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the File representation of the this users config
|
|
||||||
*
|
|
||||||
* @return the users config File
|
|
||||||
*/
|
|
||||||
public File getUserConfigFile() {
|
|
||||||
return new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to make a new config file at a specified relative output path inside the data directory by copying the matching file found in that same relative path within the JAR
|
|
||||||
*
|
|
||||||
* @param relativeOutputPath the path to the output file
|
|
||||||
* @param deleteOld whether or not to delete the existing output file on disk
|
|
||||||
* @return a copy of the default config within the JAR
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private File copyDefaultFromJar(String relativeOutputPath, boolean deleteOld) throws IOException {
|
|
||||||
/*
|
|
||||||
* Gen a Default config from inside the JAR
|
|
||||||
*/
|
|
||||||
pluginRef.getLogger().info("Preparing to copy internal resource file (in JAR) - " + FILE_RELATIVE_PATH);
|
|
||||||
//InputStream inputStream = McmmoCore.getResource(FILE_RELATIVE_PATH);
|
|
||||||
InputStream inputStream = pluginRef.getResource(FILE_RELATIVE_PATH);
|
|
||||||
|
|
||||||
byte[] buffer = new byte[inputStream.available()];
|
|
||||||
inputStream.read(buffer);
|
|
||||||
|
|
||||||
//This is a copy of the default file, which we will overwrite every time mcMMO loads
|
|
||||||
File targetFile = new File(DIRECTORY_DATA_FOLDER, relativeOutputPath);
|
|
||||||
|
|
||||||
//Wipe old default file on disk
|
|
||||||
if (targetFile.exists() && deleteOld) {
|
|
||||||
pluginRef.getLogger().info("Updating file " + relativeOutputPath);
|
|
||||||
targetFile.delete(); //Necessary?
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!targetFile.exists()) {
|
|
||||||
targetFile.getParentFile().mkdirs();
|
|
||||||
targetFile.createNewFile(); //New File Boys
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.write(buffer, targetFile);
|
|
||||||
pluginRef.getLogger().info("Created config file - " + relativeOutputPath);
|
|
||||||
|
|
||||||
inputStream.close(); //Close the input stream
|
|
||||||
|
|
||||||
return targetFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The path to the defaults directory
|
|
||||||
*
|
|
||||||
* @return the path to the defaults directory
|
|
||||||
*/
|
|
||||||
private String getDefaultConfigCopyRelativePath() {
|
|
||||||
return getDefaultConfigFile().getPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grabs the File representation of the default config, which is stored on disk in a defaults folder
|
|
||||||
* this file will be overwritten every time mcMMO starts to keep it up to date.
|
|
||||||
*
|
|
||||||
* @return the copy of the default config file, stored in the defaults directory
|
|
||||||
*/
|
|
||||||
private File getDefaultConfigFile() {
|
|
||||||
return new File(ConfigConstants.getDefaultsFolder(), FILE_RELATIVE_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the defaults directory
|
|
||||||
*/
|
|
||||||
private void mkdirDefaults() {
|
|
||||||
ConfigConstants.makeAllConfigDirectories();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configs are versioned based on when they had significant changes to keys
|
|
||||||
*
|
|
||||||
* @return current MainConfig Version String
|
|
||||||
*/
|
|
||||||
public String getVersion() {
|
|
||||||
return String.valueOf(getConfigVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to read the loaded config file
|
|
||||||
* MainConfig will have any necessary updates applied
|
|
||||||
* MainConfig will be compared to the default config to see if it is missing any nodes
|
|
||||||
* MainConfig will have any missing nodes inserted with their default value
|
|
||||||
*/
|
|
||||||
public void readConfig() {
|
|
||||||
pluginRef.getLogger().info("Attempting to read " + FILE_RELATIVE_PATH + ".");
|
|
||||||
|
|
||||||
int version = this.userRootNode.getNode("ConfigVersion").getInt();
|
|
||||||
pluginRef.getLogger().info(FILE_RELATIVE_PATH + " version is " + version);
|
|
||||||
|
|
||||||
//Update our config
|
|
||||||
updateConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compares the users config file to the default and adds any missing nodes and applies any necessary updates
|
|
||||||
*/
|
|
||||||
private void updateConfig() {
|
|
||||||
pluginRef.getLogger().info(defaultRootNode.getChildrenMap().size() + " items in default children map");
|
|
||||||
pluginRef.getLogger().info(userRootNode.getChildrenMap().size() + " items in default root map");
|
|
||||||
|
|
||||||
// Merge Values from default
|
|
||||||
if (mergeNewKeys)
|
|
||||||
userRootNode = userRootNode.mergeValuesFrom(defaultRootNode);
|
|
||||||
|
|
||||||
removeOldKeys();
|
|
||||||
|
|
||||||
// Update config version
|
|
||||||
updateConfigVersion();
|
|
||||||
|
|
||||||
//Attempt to save
|
|
||||||
try {
|
|
||||||
saveUserCopy();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds any keys in the users config that are not present in the default config and removes them
|
|
||||||
*/
|
|
||||||
//TODO: Finish this
|
|
||||||
private void removeOldKeys() {
|
|
||||||
if (!removeOldKeys)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (CommentedConfigurationNode CommentedConfigurationNode : defaultRootNode.getChildrenList()) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the current state information of the config to the users copy (which they may edit)
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private void saveUserCopy() throws IOException {
|
|
||||||
pluginRef.getLogger().info("Saving new node");
|
|
||||||
userCopyLoader.save(userRootNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs any necessary operations to update this config
|
|
||||||
*/
|
|
||||||
private void updateConfigVersion() {
|
|
||||||
// Set a version for our config
|
|
||||||
this.userRootNode.getNode("ConfigVersion").setValue(getConfigVersion());
|
|
||||||
pluginRef.getLogger().info("Updated config to [" + getConfigVersion() + "] - " + FILE_RELATIVE_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the root node of this config
|
|
||||||
*
|
|
||||||
* @return the root node of this config
|
|
||||||
*/
|
|
||||||
protected CommentedConfigurationNode getUserRootNode() {
|
|
||||||
return userRootNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an int from the config and casts it to short before returning
|
|
||||||
*
|
|
||||||
* @param path the path to the int
|
|
||||||
* @return the value of the int after being cast to short at the node, null references will zero initialize
|
|
||||||
*/
|
|
||||||
public short getShortValue(String... path) {
|
|
||||||
return (short) userRootNode.getNode(path).getInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grabs an int from the specified node
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* @return the int from the node, null references will zero initialize
|
|
||||||
*/
|
|
||||||
public int getIntValue(String... path) {
|
|
||||||
return userRootNode.getNode(path).getInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grabs a double from the specified node
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* @return the double from the node, null references will zero initialize
|
|
||||||
*/
|
|
||||||
public double getDoubleValue(String... path) {
|
|
||||||
return userRootNode.getNode(path).getDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grabs a long from the specified node
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* @return the long from the node, null references will zero initialize
|
|
||||||
*/
|
|
||||||
public long getLongValue(String... path) {
|
|
||||||
return userRootNode.getNode(path).getLong();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grabs a boolean from the specified node
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* @return the boolean from the node, null references will zero initialize
|
|
||||||
*/
|
|
||||||
public boolean getBooleanValue(String... path) {
|
|
||||||
return userRootNode.getNode(path).getBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grabs a string from the specified node
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* @return the string from the node, null references will zero initialize
|
|
||||||
*/
|
|
||||||
public String getStringValue(String... path) {
|
|
||||||
return userRootNode.getNode(path).getString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks to see if a node exists in the user's config file
|
|
||||||
*
|
|
||||||
* @param path path to the node
|
|
||||||
* @return true if the node exists
|
|
||||||
*/
|
|
||||||
public boolean hasNode(String... path) {
|
|
||||||
return (userRootNode.getNode(path) != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the children of a specific node
|
|
||||||
*
|
|
||||||
* @param path the path to the parent node
|
|
||||||
* @return the list of children for the target parent node
|
|
||||||
*/
|
|
||||||
public List<? extends CommentedConfigurationNode> getChildren(String... path) {
|
|
||||||
return userRootNode.getNode(path).getChildrenList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getListFromNode(String... path) throws ObjectMappingException {
|
|
||||||
return userRootNode.getNode(path).getList(TypeToken.of(String.class));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.gmail.nossr50.config;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is used for config files that validate their entries
|
|
||||||
*/
|
|
||||||
public abstract class ConfigValidated extends Config implements UnsafeValueValidation {
|
|
||||||
/**
|
|
||||||
* @param pathToParentFolder File for the "parent" folder on disk
|
|
||||||
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
|
|
||||||
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
|
|
||||||
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
|
||||||
*/
|
|
||||||
public ConfigValidated(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
|
||||||
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
|
|
||||||
validateEntries();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,269 +0,0 @@
|
|||||||
package com.gmail.nossr50.config;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@ConfigSerializable
|
|
||||||
public class MainConfig extends ConfigValidated {
|
|
||||||
|
|
||||||
public static final String METRICS = "Metrics";
|
|
||||||
public static final String BSTATS = "bstats";
|
|
||||||
public static final String GENERAL = "General";
|
|
||||||
public static final String RETRO_MODE = "RetroMode";
|
|
||||||
public static final String ENABLED = "Enabled";
|
|
||||||
public static final String LOCALE = "LocaleManager";
|
|
||||||
public static final String EN_US = "en_us";
|
|
||||||
public static final String SHOW_PROFILE_LOADED = "Show_Profile_Loaded";
|
|
||||||
public static final String DONATE_MESSAGE = "Donate_Message";
|
|
||||||
public static final String MCMMO = "mcmmo";
|
|
||||||
public static final String DATABASE_PREFIX = MCMMO + "_";
|
|
||||||
public static final String COMMANDS = "Commands";
|
|
||||||
public static final String SAVE_INTERVAL = "Save_Interval";
|
|
||||||
public static final String STATS = "Stats";
|
|
||||||
public static final String STATS_TRACKING = STATS + "_Tracking";
|
|
||||||
public static final String UPDATE_CHECK = "Update_Check";
|
|
||||||
public static final String PREFER_BETA = "Prefer_Beta";
|
|
||||||
public static final String VERBOSE_LOGGING = "Verbose_Logging";
|
|
||||||
public static final String PARTYCHAT = "partychat";
|
|
||||||
public static final String CHAT_PREFIX_FORMAT = "Chat_Prefix_Format";
|
|
||||||
public static final String NAME = "Name";
|
|
||||||
public static final String GOLD_LEADER_NAME = "Gold_Leader_" + NAME;
|
|
||||||
public static final String USE_DISPLAY_NAMES = "Use_Display_" + NAME + "s";
|
|
||||||
public static final String ALLY = "_Ally";
|
|
||||||
public static final String ADMINCHAT = "adminchat";
|
|
||||||
public static final String GENERIC = "Generic";
|
|
||||||
public static final String MATCH_OFFLINE_PLAYERS = "Match_OfflinePlayers";
|
|
||||||
public static final String DATABASE = "Database";
|
|
||||||
public static final String COOLDOWN = "Cooldown";
|
|
||||||
public static final String PLAYER_COOLDOWN = "Player_" + COOLDOWN;
|
|
||||||
public static final String LEVEL_UP = "LevelUp_";
|
|
||||||
public static final String SOUND = "Sound";
|
|
||||||
public static final String LEVEL_UP_SOUNDS = "LevelUp_Sounds";
|
|
||||||
public static final String REFRESH_CHUNKS = "Refresh_Chunks";
|
|
||||||
public static final String MOB_HEALTHBAR = "Mob_Healthbar";
|
|
||||||
public static final String DISPLAY_TYPE = "Display_Type";
|
|
||||||
public static final String HEARTS = "HEARTS";
|
|
||||||
public static final String DISPLAY_TIME = "Display_Time";
|
|
||||||
public static final String SCOREBOARD = "ConfigScoreboard";
|
|
||||||
public static final String USE_SCOREBOARDS = "UseScoreboards";
|
|
||||||
public static final String POWER = "Power_";
|
|
||||||
public static final String POWER_LEVEL_TAGS = POWER + "Level_Tags";
|
|
||||||
public static final String KEEP = "Keep";
|
|
||||||
public static final String ALLOW_KEEP = "Allow_" + KEEP;
|
|
||||||
public static final String TIPS_AMOUNT = "Tips_Amount";
|
|
||||||
public static final String SHOW_STATS_AFTER_LOGIN = "Show_" + STATS + "_After_Login";
|
|
||||||
public static final String RAINBOWS = "Rainbows";
|
|
||||||
public static final String ABILITY_NAMES = "Ability_" + NAME + "s";
|
|
||||||
public static final String TYPES = "Types";
|
|
||||||
public static final String RANK = "Rank";
|
|
||||||
public static final String PRINT = "Print";
|
|
||||||
public static final String BOARD = "Board";
|
|
||||||
public static final String TOP = "Top";
|
|
||||||
public static final String INSPECT = "Inspect";
|
|
||||||
public static final String SKILL = "Skill";
|
|
||||||
public static final String TIME = "Time";
|
|
||||||
public static final String PURGING = "_Purging";
|
|
||||||
public static final String PURGE_INTERVAL = "Purge_Interval";
|
|
||||||
public static final String OLD_USER_CUTOFF = "Old_User_Cutoff";
|
|
||||||
public static final String BACKUPS = "Backups";
|
|
||||||
public static final String KEEP_LAST_24_HOURS = KEEP + ".Last_24_Hours";
|
|
||||||
public static final String DAILY_LAST_WEEK = "Daily_Last_Week";
|
|
||||||
public static final String WEEKLY_PAST_MONTHS = "Weekly_Past_Months";
|
|
||||||
public static final String MY_SQL = "MySQL";
|
|
||||||
public static final String TABLE_PREFIX = "TablePrefix";
|
|
||||||
public static final String USER_NAME = "User_" + NAME;
|
|
||||||
public static final String SERVER = "Server";
|
|
||||||
public static final String PORT = "Port";
|
|
||||||
public static final String ADDRESS = "Address";
|
|
||||||
public static final String LOCALHOST = "localhost";
|
|
||||||
public static final String USER_PASSWORD = "User_Password";
|
|
||||||
public static final String MAX_CONNECTIONS = "MaxConnections";
|
|
||||||
public static final String MAX_POOL_SIZE = "MaxPoolSize";
|
|
||||||
public static final String SSL = "SSL";
|
|
||||||
public static final String HARDCORE = "Hardcore";
|
|
||||||
public static final String DEATH_STAT_LOSS = "Death_Stat_Loss";
|
|
||||||
public static final String PENALTY_PERCENTAGE = "Penalty_Percentage";
|
|
||||||
public static final String LEVEL_THRESHOLD = "Level_Threshold";
|
|
||||||
public static final String VAMPIRISM = "Vampirism";
|
|
||||||
public static final String LEECH_PERCENTAGE = "Leech_Percentage";
|
|
||||||
public static final String ITEMS = "Items";
|
|
||||||
public static final String CHIMAERA_WING = "Chimaera_Wing";
|
|
||||||
public static final String USE_COST = "Use_Cost";
|
|
||||||
public static final String RECIPE_COST = "Recipe_Cost";
|
|
||||||
public static final String ITEM = "Item_";
|
|
||||||
public static final String FEATHER = "Feather";
|
|
||||||
public static final String PREVENT = "Prevent_";
|
|
||||||
public static final String PREVENT_USE_UNDERGROUND = PREVENT + "Use_Underground";
|
|
||||||
public static final String USE_BED_SPAWN = "Use_Bed_Spawn";
|
|
||||||
public static final String WARMUP = "Warmup";
|
|
||||||
public static final String RECENTLY_HURT = "RecentlyHurt_";
|
|
||||||
public static final String PARTICLES = "Particles";
|
|
||||||
public static final String ACTIVATION = "Activation";
|
|
||||||
public static final String ABILITY_ACTIVATION = "Ability_" + ACTIVATION;
|
|
||||||
public static final String ABILITY_DEACTIVATION = "Ability_Deactivation";
|
|
||||||
public static final String BLEED = "Bleed";
|
|
||||||
public static final String DODGE = "Dodge";
|
|
||||||
public static final String FLUX = "Flux";
|
|
||||||
public static final String GREATER_IMPACT = "Greater_Impact";
|
|
||||||
public static final String CALL_OF_THE_WILD = "Call_of_the_Wild";
|
|
||||||
public static final String TIER = "Tier";
|
|
||||||
public static final String LARGE_FIREWORKS = "LargeFireworks";
|
|
||||||
public static final String PARTY = "Party";
|
|
||||||
public static final String FRIENDLY_FIRE = "FriendlyFire";
|
|
||||||
public static final String MAX_SIZE = "MaxSize";
|
|
||||||
public static final String AUTO_KICK_INTERVAL = "AutoKick_Interval";
|
|
||||||
public static final String OLD_PARTY_MEMBER_CUTOFF = "Old_Party_Member_Cutoff";
|
|
||||||
public static final String SHARING = "Sharing";
|
|
||||||
public static final String SHARING_EXP_SHARE_BONUS_BASE = SHARING + "ExpShare_bonus_base";
|
|
||||||
public static final String EXP_SHARE_BONUS_INCREASE = "ExpShare_bonus_increase";
|
|
||||||
public static final String EXP_SHARE_BONUS_CAP = "ExpShare_bonus_cap";
|
|
||||||
public static final String RANGE = "Range";
|
|
||||||
public static final String LEVELING = "Leveling";
|
|
||||||
public static final String LEVEL_CAP = "Level_Cap";
|
|
||||||
public static final String XP_CURVE_MODIFIER = "Xp_Curve_Modifier";
|
|
||||||
public static final String NEAR_MEMBERS_NEEDED = "Near_Members_Needed";
|
|
||||||
public static final String INFORM_ALL_PARTY_MEMBERS_ON_LEVEL_UP = "Inform_All_Party_Members_On_LevelUp";
|
|
||||||
public static final String UNLOCK_LEVEL = "_UnlockLevel";
|
|
||||||
public static final String PTP = "ptp";
|
|
||||||
public static final String ACCEPT_REQUIRED = "Accept_Required";
|
|
||||||
public static final String REQUEST_TIMEOUT = "Request_Timeout";
|
|
||||||
public static final String WORLD_BASED_PERMISSIONS = "World_Based_Permissions";
|
|
||||||
public static final String INSPECT1 = "inspect";
|
|
||||||
public static final String MAX_DISTANCE = "Max_Distance";
|
|
||||||
public static final String SKILLS = "Skills";
|
|
||||||
public static final String URL_LINKS = "URL_Links";
|
|
||||||
public static final String ABILITIES = "Abilities";
|
|
||||||
public static final String MESSAGES = "Messages";
|
|
||||||
public static final String ONLY_ACTIVATE_WHEN_SNEAKING = "Only_Activate_When_Sneaking";
|
|
||||||
public static final String LEVEL_GATE_ABILITIES = "Level_Gate_Abilities";
|
|
||||||
public static final String COOLDOWNS = "Cooldowns";
|
|
||||||
public static final String MAX_SECONDS = "Max_Seconds";
|
|
||||||
public static final String TOOLS = "Tools";
|
|
||||||
public static final String DURABILITY_LOSS = "Durability_Loss";
|
|
||||||
public static final String LIMITS = "Limits";
|
|
||||||
public static final String TREE_FELLER = "Tree_Feller_";
|
|
||||||
public static final String TREE_FELLER_THRESHOLD = TREE_FELLER + "Threshold";
|
|
||||||
public static final String DOUBLE_DROPS = "Double_Drops";
|
|
||||||
public static final String AXES = "Axes";
|
|
||||||
public static final String TRUNCATE = "Truncate";
|
|
||||||
public static final String FOR_PVP = "_For_PVP";
|
|
||||||
public static final String FOR_PVE = "_For_PVE";
|
|
||||||
public static final String ACROBATICS = "Acrobatics";
|
|
||||||
public static final String PREVENT_AFK = PREVENT + "AFK_";
|
|
||||||
public static final String WOODCUTTING = "Woodcutting";
|
|
||||||
public static final String SOUNDS = "Sounds";
|
|
||||||
public static final String MAX_TRIES_AT_SAME_LOCATION = "Max_Tries_At_Same_Location";
|
|
||||||
public static final String HERBALISM = "Herbalism";
|
|
||||||
public static final String TAMING = "Taming";
|
|
||||||
public static final String CALL_OF_THE_WILD1 = "Call_Of_The_Wild";
|
|
||||||
public static final String SUMMON_AMOUNT = "Summon_Amount";
|
|
||||||
public static final String SUMMON_LENGTH = "Summon_Length";
|
|
||||||
public static final String SUMMON_MAX_AMOUNT = "Summon_Max_Amount";
|
|
||||||
public static final String AMOUNT = "Amount";
|
|
||||||
public static final String MATERIAL = "Material";
|
|
||||||
public static final String REPAIR = "Repair";
|
|
||||||
public static final String CONFIRM_REQUIRED = "Confirm_Required";
|
|
||||||
public static final String ANVIL = "Anvil_";
|
|
||||||
public static final String ANVIL_MATERIAL = ANVIL + "Material";
|
|
||||||
public static final String IRON_BLOCK = "IRON_BLOCK";
|
|
||||||
public static final String ANVIL_USE = ANVIL + "Use_";
|
|
||||||
public static final String ANVIL_PLACED = ANVIL + "Placed_";
|
|
||||||
public static final String SALVAGE = "Salvage";
|
|
||||||
public static final String UNARMED = "Unarmed";
|
|
||||||
public static final String BLOCK_CRACKER = "Block_Cracker";
|
|
||||||
public static final String SMOOTH_BRICK_TO_CRACKED_BRICK = "SmoothBrick_To_CrackedBrick";
|
|
||||||
public static final String PICKUP_DISABLED_FULL_INVENTORY = "Pickup_Disabled_Full_Inventory";
|
|
||||||
public static final String AS = "_As_";
|
|
||||||
public static final String MINING = "Mining";
|
|
||||||
public static final String DETONATOR = "Detonator_";
|
|
||||||
public static final String FLINT_AND_STEEL = "FLINT_AND_STEEL";
|
|
||||||
public static final String FISHING = "Fishing";
|
|
||||||
public static final String LURE_MODIFIER = "Lure_Modifier";
|
|
||||||
public static final String EXTRA_FISH = "Extra_Fish";
|
|
||||||
public static final String OVERRIDE_VANILLA_TREASURES = "Override_Vanilla_Treasures";
|
|
||||||
public static final String DROPS = "Drops_";
|
|
||||||
public static final String ALCHEMY = "Alchemy";
|
|
||||||
public static final String PREVENT_HOPPER_TRANSFER_BOTTLES = PREVENT + "Hopper_Transfer_Bottles";
|
|
||||||
public static final String PREVENT_HOPPER_TRANSFER_INGREDIENTS = PREVENT + "Hopper_Transfer_Ingredients";
|
|
||||||
public static final String FOR_HOPPERS = "_for_Hoppers";
|
|
||||||
public static final String XP_AFTER_TELEPORT = "XP_After_Teleport_";
|
|
||||||
public static final String LIGHTNING = "_Lightning";
|
|
||||||
public static final String GOLD_BLOCK = "GOLD_BLOCK";
|
|
||||||
public static final String PICKAXE = "_Pickaxe";
|
|
||||||
public static final String EXP_SHARE_BONUS_BASE = "ExpShare_bonus_base";
|
|
||||||
|
|
||||||
public MainConfig() {
|
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "config.yml", true);
|
|
||||||
super("main", pluginRef.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This grabs an instance of this config class from the Config Manager
|
|
||||||
* This method is deprecated and will be removed in the future
|
|
||||||
*
|
|
||||||
* @return the instance of this config
|
|
||||||
* @see mcMMO#getConfigManager()
|
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static MainConfig getInstance() {
|
|
||||||
return pluginRef.getConfigManager().getMainConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The version of this config
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public double getConfigVersion() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> validateKeys() {
|
|
||||||
// Validate all the settings!
|
|
||||||
List<String> reason = new ArrayList<>();
|
|
||||||
return reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getPreventHopperTransferIngredients() {
|
|
||||||
return getBooleanValue(SKILLS, ALCHEMY, PREVENT_HOPPER_TRANSFER_INGREDIENTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getPreventHopperTransferBottles() {
|
|
||||||
return getBooleanValue(SKILLS, ALCHEMY, PREVENT_HOPPER_TRANSFER_BOTTLES);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Taming */
|
|
||||||
public Material getTamingCOTWMaterial(EntityType type) {
|
|
||||||
return Material.matchMaterial(getStringValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), ITEM + MATERIAL));
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTamingCOTWCost(EntityType type) {
|
|
||||||
return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), ITEM + AMOUNT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTamingCOTWAmount(EntityType type) {
|
|
||||||
return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_AMOUNT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTamingCOTWLength(EntityType type) {
|
|
||||||
return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_LENGTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTamingCOTWMaxAmount(EntityType type) {
|
|
||||||
return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_MAX_AMOUNT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getTamingCOTWRange() {
|
|
||||||
return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD1, RANGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.gmail.nossr50.config;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is for config validation
|
|
||||||
*/
|
|
||||||
public interface UnsafeValueValidation {
|
|
||||||
List<String> validateKeys();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints all errors found when validating the config
|
|
||||||
*/
|
|
||||||
default void validateEntries() {
|
|
||||||
/*
|
|
||||||
* Print Errors about Keys
|
|
||||||
*/
|
|
||||||
|
|
||||||
List<String> validKeyErrors = validateKeys(); // Validate Keys
|
|
||||||
|
|
||||||
if (validKeyErrors != null && validKeyErrors.size() > 0) {
|
|
||||||
for (String error : validKeyErrors) {
|
|
||||||
pluginRef.getLogger().severe(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.gmail.nossr50.config;
|
|
||||||
|
|
||||||
public interface Validation {
|
|
||||||
void validate();
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package com.gmail.nossr50.config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a config that is version checked
|
|
||||||
*/
|
|
||||||
public interface VersionedConfig {
|
|
||||||
/**
|
|
||||||
* The version of this config
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
double getConfigVersion();
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package com.gmail.nossr50.config;
|
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Blacklist certain features in certain worlds
|
|
||||||
*/
|
|
||||||
public class WorldBlacklist {
|
|
||||||
|
|
||||||
public static boolean isWorldBlacklisted(World world) {
|
|
||||||
for (String s : pluginRef.getConfigManager().getConfigWorldBlacklist().getBlackListedWorlds()) {
|
|
||||||
if (world.getName().equalsIgnoreCase(s))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,274 +1,274 @@
|
|||||||
package com.gmail.nossr50.config.treasure;
|
//package com.gmail.nossr50.config.treasure;
|
||||||
|
//
|
||||||
import com.gmail.nossr50.config.Config;
|
//import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.ConfigConstants;
|
//import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.config.UnsafeValueValidation;
|
//import com.gmail.nossr50.config.UnsafeValueValidation;
|
||||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
//import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
||||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
//import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||||
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
//import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
//import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||||
import com.gmail.nossr50.mcMMO;
|
//import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.EnchantmentUtils;
|
//import com.gmail.nossr50.util.EnchantmentUtils;
|
||||||
import com.google.common.reflect.TypeToken;
|
//import com.google.common.reflect.TypeToken;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
//import ninja.leaping.configurate.ConfigurationNode;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
//import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
import org.bukkit.Material;
|
//import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
//import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.EntityType;
|
//import org.bukkit.entity.EntityType;
|
||||||
|
//
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
//import java.util.HashMap;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
public class FishingTreasureConfig extends Config implements UnsafeValueValidation {
|
//public class FishingTreasureConfig extends Config implements UnsafeValueValidation {
|
||||||
public static final String PLAYER = "PLAYER";
|
// public static final String PLAYER = "PLAYER";
|
||||||
public static final String INVENTORY = "INVENTORY";
|
// public static final String INVENTORY = "INVENTORY";
|
||||||
public static final String WHOLE_STACKS = "Whole_Stacks";
|
// public static final String WHOLE_STACKS = "Whole_Stacks";
|
||||||
public static final String DROP_CHANCE = "Drop_Chance";
|
// public static final String DROP_CHANCE = "Drop_Chance";
|
||||||
public static final String DROP_LEVEL = "Drop_Level";
|
// public static final String DROP_LEVEL = "Drop_Level";
|
||||||
public static final String TIER = "Tier_";
|
// public static final String TIER = "Tier_";
|
||||||
public static final String ENCHANTMENTS_RARITY = "Enchantments_Rarity";
|
// public static final String ENCHANTMENTS_RARITY = "Enchantments_Rarity";
|
||||||
public static final String ITEM_DROP_RATES = "Item_Drop_Rates";
|
// public static final String ITEM_DROP_RATES = "Item_Drop_Rates";
|
||||||
public static final String FISHING = "Fishing";
|
// public static final String FISHING = "Fishing";
|
||||||
public static final String ENCHANTMENT_DROP_RATES = "Enchantment_Drop_Rates";
|
// public static final String ENCHANTMENT_DROP_RATES = "Enchantment_Drop_Rates";
|
||||||
public static final String SHAKE = "Shake";
|
// public static final String SHAKE = "Shake";
|
||||||
public static final String AMOUNT = "Amount";
|
// public static final String AMOUNT = "Amount";
|
||||||
public static final String XP = "XP";
|
// public static final String XP = "XP";
|
||||||
public static final String CUSTOM_NAME = "Custom_Name";
|
// public static final String CUSTOM_NAME = "Custom_Name";
|
||||||
public static final String LORE = "Lore";
|
// public static final String LORE = "Lore";
|
||||||
public static final String RARITY = "Rarity";
|
// public static final String RARITY = "Rarity";
|
||||||
public static final String DROPS_FROM = "Drops_From";
|
// public static final String DROPS_FROM = "Drops_From";
|
||||||
|
//
|
||||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<>();
|
// public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<>();
|
||||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
|
// public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
|
||||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<>();
|
// public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<>();
|
||||||
|
//
|
||||||
public FishingTreasureConfig() {
|
// public FishingTreasureConfig() {
|
||||||
super("fishing_drops", pluginRef.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
// super("fishing_drops", pluginRef.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* This grabs an instance of this config class from the Config Manager
|
// * This grabs an instance of this config class from the Config Manager
|
||||||
* This method is deprecated and will be removed in the future
|
// * This method is deprecated and will be removed in the future
|
||||||
*
|
// *
|
||||||
* @return the instance of this config
|
// * @return the instance of this config
|
||||||
* @see mcMMO#getConfigManager()
|
// * @see mcMMO#getConfigManager()
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
// * @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
*/
|
// */
|
||||||
@Deprecated
|
// @Deprecated
|
||||||
public static FishingTreasureConfig getInstance() {
|
// public static FishingTreasureConfig getInstance() {
|
||||||
return pluginRef.getConfigManager().getFishingTreasureConfig();
|
// return pluginRef.getConfigManager().getFishingTreasureConfig();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void loadShake(EntityType entityType) {
|
// private void loadShake(EntityType entityType) {
|
||||||
ConfigurationNode shakeTreasureNode = getUserRootNode().getNode(SHAKE, entityType.toString());
|
// ConfigurationNode shakeTreasureNode = getUserRootNode().getNode(SHAKE, entityType.toString());
|
||||||
|
//
|
||||||
if (shakeTreasureNode != null)
|
// if (shakeTreasureNode != null)
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
for (ConfigurationNode treasureNode : shakeTreasureNode.getChildrenList()) {
|
// for (ConfigurationNode treasureNode : shakeTreasureNode.getChildrenList()) {
|
||||||
|
//
|
||||||
String treasureName = treasureNode.getString();
|
// String treasureName = treasureNode.getString();
|
||||||
//Treasure Material Definition
|
// //Treasure Material Definition
|
||||||
Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
|
// Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
|
||||||
|
//
|
||||||
if (treasureMaterial != null) {
|
// if (treasureMaterial != null) {
|
||||||
ConfigurationNode currentTreasure = shakeTreasureNode.getNode(treasureName);
|
// ConfigurationNode currentTreasure = shakeTreasureNode.getNode(treasureName);
|
||||||
|
//
|
||||||
//TODO: Rewrite the entire treasure system because it sucks
|
// //TODO: Rewrite the entire treasure system because it sucks
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* TREASURE PARAMETERS
|
// * TREASURE PARAMETERS
|
||||||
*/
|
// */
|
||||||
int amount = currentTreasure.getNode(AMOUNT).getInt();
|
// int amount = currentTreasure.getNode(AMOUNT).getInt();
|
||||||
int xp = currentTreasure.getNode(XP).getInt();
|
// int xp = currentTreasure.getNode(XP).getInt();
|
||||||
double dropChance = currentTreasure.getNode(DROP_CHANCE).getDouble();
|
// double dropChance = currentTreasure.getNode(DROP_CHANCE).getDouble();
|
||||||
int dropLevel = currentTreasure.getNode(DROP_LEVEL).getInt();
|
// int dropLevel = currentTreasure.getNode(DROP_LEVEL).getInt();
|
||||||
String customName = null;
|
// String customName = null;
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* PARAMETER INIT
|
// * PARAMETER INIT
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode(DROPS_FROM).getList(TypeToken.of(String.class)));
|
// ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode(DROPS_FROM).getList(TypeToken.of(String.class)));
|
||||||
|
//
|
||||||
//VALIDATE AMOUNT
|
// //VALIDATE AMOUNT
|
||||||
if (amount <= 0) {
|
// if (amount <= 0) {
|
||||||
pluginRef.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
|
// pluginRef.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
|
||||||
pluginRef.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
// pluginRef.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//VALIDATE XP
|
// //VALIDATE XP
|
||||||
if (xp <= 0) {
|
// if (xp <= 0) {
|
||||||
pluginRef.getLogger().info("Excavation Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
|
// pluginRef.getLogger().info("Excavation Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
|
||||||
xp = 0;
|
// xp = 0;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//VALIDATE DROP CHANCE
|
// //VALIDATE DROP CHANCE
|
||||||
if (dropChance <= 0) {
|
// if (dropChance <= 0) {
|
||||||
pluginRef.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has a drop chance of 0 or below, is this intentional?");
|
// pluginRef.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has a drop chance of 0 or below, is this intentional?");
|
||||||
pluginRef.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
// pluginRef.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//VALIDATE DROP LEVEL
|
// //VALIDATE DROP LEVEL
|
||||||
if (dropLevel < 0) {
|
// if (dropLevel < 0) {
|
||||||
pluginRef.getLogger().info("Excavation Treasure named " + treasureName + " in the config has a drop level below 0, is this intentional?");
|
// pluginRef.getLogger().info("Excavation Treasure named " + treasureName + " in the config has a drop level below 0, is this intentional?");
|
||||||
dropLevel = 0;
|
// dropLevel = 0;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//VALIDATE DROP SOURCES
|
// //VALIDATE DROP SOURCES
|
||||||
if (dropsFrom == null || dropsFrom.isEmpty()) {
|
// if (dropsFrom == null || dropsFrom.isEmpty()) {
|
||||||
pluginRef.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
|
// pluginRef.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
|
||||||
pluginRef.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
// pluginRef.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* OPTIONAL PARAMETERS */
|
// /* OPTIONAL PARAMETERS */
|
||||||
|
//
|
||||||
//Custom Name
|
// //Custom Name
|
||||||
|
//
|
||||||
if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
|
// if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
|
||||||
customName = currentTreasure.getNode(CUSTOM_NAME).getString();
|
// customName = currentTreasure.getNode(CUSTOM_NAME).getString();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* REGISTER TREASURE
|
// * REGISTER TREASURE
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
ShakeTreasure shakeTreasure = TreasureFactory.makeShakeTreasure(treasureMaterial, amount, xp, dropChance, dropLevel, customName, currentTreasure.getNode(LORE));
|
// ShakeTreasure shakeTreasure = TreasureFactory.makeShakeTreasure(treasureMaterial, amount, xp, dropChance, dropLevel, customName, currentTreasure.getNode(LORE));
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* Add to map
|
// * Add to map
|
||||||
*/
|
// */
|
||||||
shakeMap.computeIfAbsent(entityType, k -> new ArrayList<>());
|
// shakeMap.computeIfAbsent(entityType, k -> new ArrayList<>());
|
||||||
|
//
|
||||||
shakeMap.get(entityType).add(shakeTreasure);
|
// shakeMap.get(entityType).add(shakeTreasure);
|
||||||
|
//
|
||||||
} else {
|
// } else {
|
||||||
pluginRef.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
|
// pluginRef.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (ObjectMappingException e) {
|
// } catch (ObjectMappingException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void loadEnchantments() {
|
// private void loadEnchantments() {
|
||||||
for (Rarity rarity : Rarity.values()) {
|
// for (Rarity rarity : Rarity.values()) {
|
||||||
if (rarity == Rarity.RECORD) {
|
// if (rarity == Rarity.RECORD) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (!fishingEnchantments.containsKey(rarity)) {
|
// if (!fishingEnchantments.containsKey(rarity)) {
|
||||||
fishingEnchantments.put(rarity, (new ArrayList<>()));
|
// fishingEnchantments.put(rarity, (new ArrayList<>()));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
ConfigurationNode enchantmentSection = getUserRootNode().getNode(ENCHANTMENTS_RARITY, rarity.toString());
|
// ConfigurationNode enchantmentSection = getUserRootNode().getNode(ENCHANTMENTS_RARITY, rarity.toString());
|
||||||
|
//
|
||||||
if (enchantmentSection == null) {
|
// if (enchantmentSection == null) {
|
||||||
pluginRef.getLogger().info("No enchantment information for fishing treasures, is this intentional?");
|
// pluginRef.getLogger().info("No enchantment information for fishing treasures, is this intentional?");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
for (ConfigurationNode enchantmentNode : enchantmentSection.getChildrenList()) {
|
// for (ConfigurationNode enchantmentNode : enchantmentSection.getChildrenList()) {
|
||||||
|
//
|
||||||
String enchantmentName = enchantmentNode.getString();
|
// String enchantmentName = enchantmentNode.getString();
|
||||||
int level = getIntValue(ENCHANTMENTS_RARITY, rarity.toString(), enchantmentName);
|
// int level = getIntValue(ENCHANTMENTS_RARITY, rarity.toString(), enchantmentName);
|
||||||
Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
// Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
||||||
|
//
|
||||||
if (enchantment == null) {
|
// if (enchantment == null) {
|
||||||
pluginRef.getLogger().severe("Skipping invalid enchantment in treasures.yml: " + enchantmentName);
|
// pluginRef.getLogger().severe("Skipping invalid enchantment in treasures.yml: " + enchantmentName);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
fishingEnchantments.get(rarity).add(new EnchantmentTreasure(enchantment, level));
|
// fishingEnchantments.get(rarity).add(new EnchantmentTreasure(enchantment, level));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public List<String> validateKeys() {
|
// public List<String> validateKeys() {
|
||||||
// Validate all the settings!
|
// // Validate all the settings!
|
||||||
List<String> errorMessages = new ArrayList<>();
|
// List<String> errorMessages = new ArrayList<>();
|
||||||
try {
|
// try {
|
||||||
for (String tier : getUserRootNode().getNode(ENCHANTMENT_DROP_RATES).getList(TypeToken.of(String.class))) {
|
// for (String tier : getUserRootNode().getNode(ENCHANTMENT_DROP_RATES).getList(TypeToken.of(String.class))) {
|
||||||
/*double totalEnchantDropRate = 0;
|
// /*double totalEnchantDropRate = 0;
|
||||||
double totalItemDropRate = 0;*/
|
// double totalItemDropRate = 0;*/
|
||||||
|
//
|
||||||
for (Rarity rarity : Rarity.values()) {
|
// for (Rarity rarity : Rarity.values()) {
|
||||||
double enchantDropRate = getDoubleValue(ENCHANTMENT_DROP_RATES, tier, rarity.toString());
|
// double enchantDropRate = getDoubleValue(ENCHANTMENT_DROP_RATES, tier, rarity.toString());
|
||||||
double itemDropRate = getDoubleValue(ITEM_DROP_RATES, tier, rarity.toString());
|
// double itemDropRate = getDoubleValue(ITEM_DROP_RATES, tier, rarity.toString());
|
||||||
|
//
|
||||||
if ((enchantDropRate < 0.0 || enchantDropRate > 100.0) && rarity != Rarity.RECORD) {
|
// if ((enchantDropRate < 0.0 || enchantDropRate > 100.0) && rarity != Rarity.RECORD) {
|
||||||
errorMessages.add("The enchant drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
// errorMessages.add("The enchant drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
||||||
|
//
|
||||||
//Bound Values
|
// //Bound Values
|
||||||
/*enchantDropRate = boundValues(enchantDropRate, 0.0D, 100.0D);*/
|
// /*enchantDropRate = boundValues(enchantDropRate, 0.0D, 100.0D);*/
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (itemDropRate < 0.0 || itemDropRate > 100.0) {
|
// if (itemDropRate < 0.0 || itemDropRate > 100.0) {
|
||||||
errorMessages.add("The item drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
// errorMessages.add("The item drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
||||||
|
//
|
||||||
//Bound Values
|
// //Bound Values
|
||||||
/*itemDropRate = boundValues(itemDropRate, 0.0D, 100.0D);*/
|
// /*itemDropRate = boundValues(itemDropRate, 0.0D, 100.0D);*/
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/*totalEnchantDropRate += enchantDropRate;
|
// /*totalEnchantDropRate += enchantDropRate;
|
||||||
totalItemDropRate += itemDropRate;*/
|
// totalItemDropRate += itemDropRate;*/
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//TODO: Why does it matter what the total item/enchant drop rate is?
|
// //TODO: Why does it matter what the total item/enchant drop rate is?
|
||||||
|
//
|
||||||
/*if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
|
// /*if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
|
||||||
errorMessages.add("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!");
|
// errorMessages.add("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (totalItemDropRate < 0 || totalItemDropRate > 100.0) {
|
// if (totalItemDropRate < 0 || totalItemDropRate > 100.0) {
|
||||||
errorMessages.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!");
|
// errorMessages.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!");
|
||||||
}*/
|
// }*/
|
||||||
}
|
// }
|
||||||
} catch (ObjectMappingException e) {
|
// } catch (ObjectMappingException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return errorMessages;
|
// return errorMessages;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* The version of this config
|
// * The version of this config
|
||||||
*
|
// *
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
public double getConfigVersion() {
|
// public double getConfigVersion() {
|
||||||
return 1;
|
// return 1;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean getInventoryStealEnabled() {
|
// public boolean getInventoryStealEnabled() {
|
||||||
return hasNode(SHAKE, PLAYER, INVENTORY);
|
// return hasNode(SHAKE, PLAYER, INVENTORY);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean getInventoryStealStacks() {
|
// public boolean getInventoryStealStacks() {
|
||||||
return getBooleanValue(SHAKE, PLAYER, INVENTORY, WHOLE_STACKS);
|
// return getBooleanValue(SHAKE, PLAYER, INVENTORY, WHOLE_STACKS);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public double getInventoryStealDropChance() {
|
// public double getInventoryStealDropChance() {
|
||||||
return getDoubleValue(SHAKE, PLAYER, INVENTORY, DROP_CHANCE);
|
// return getDoubleValue(SHAKE, PLAYER, INVENTORY, DROP_CHANCE);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public int getInventoryStealDropLevel() {
|
// public int getInventoryStealDropLevel() {
|
||||||
return getIntValue(SHAKE, PLAYER, INVENTORY, DROP_LEVEL);
|
// return getIntValue(SHAKE, PLAYER, INVENTORY, DROP_LEVEL);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public double getItemDropRate(int tier, Rarity rarity) {
|
// public double getItemDropRate(int tier, Rarity rarity) {
|
||||||
return getDoubleValue(ITEM_DROP_RATES, TIER + tier, rarity.toString());
|
// return getDoubleValue(ITEM_DROP_RATES, TIER + tier, rarity.toString());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public double getEnchantmentDropRate(int tier, Rarity rarity) {
|
// public double getEnchantmentDropRate(int tier, Rarity rarity) {
|
||||||
return getDoubleValue(ENCHANTMENT_DROP_RATES, TIER + tier, rarity.toString());
|
// return getDoubleValue(ENCHANTMENT_DROP_RATES, TIER + tier, rarity.toString());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -37,6 +37,7 @@ public class DynamicSettingsManager {
|
|||||||
/* Platform Ready Managers */
|
/* Platform Ready Managers */
|
||||||
private BonusDropManager bonusDropManager;
|
private BonusDropManager bonusDropManager;
|
||||||
private ExperienceManager experienceManager;
|
private ExperienceManager experienceManager;
|
||||||
|
private WorldBlackListManager worldBlackListManager;
|
||||||
|
|
||||||
/* Party Settings */
|
/* Party Settings */
|
||||||
private HashMap<Material, Integer> partyItemWeights;
|
private HashMap<Material, Integer> partyItemWeights;
|
||||||
@ -79,6 +80,17 @@ public class DynamicSettingsManager {
|
|||||||
//Init Skill Behaviour Manager
|
//Init Skill Behaviour Manager
|
||||||
skillBehaviourManager = new SkillBehaviourManager(pluginRef);
|
skillBehaviourManager = new SkillBehaviourManager(pluginRef);
|
||||||
|
|
||||||
|
initExperienceManager();
|
||||||
|
|
||||||
|
initWorldBlackList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initWorldBlackList() {
|
||||||
|
worldBlackListManager = new WorldBlackListManager();
|
||||||
|
worldBlackListManager.addBlackListedWorlds(pluginRef.getConfigManager().getConfigWorldBlacklist().getBlackListedWorlds());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initExperienceManager() {
|
||||||
experienceManager = new ExperienceManager(pluginRef);
|
experienceManager = new ExperienceManager(pluginRef);
|
||||||
//Set the global XP val
|
//Set the global XP val
|
||||||
experienceManager.setGlobalXpMult(pluginRef.getConfigManager().getConfigExperience().getGlobalXPMultiplier());
|
experienceManager.setGlobalXpMult(pluginRef.getConfigManager().getConfigExperience().getGlobalXPMultiplier());
|
||||||
@ -173,4 +185,12 @@ public class DynamicSettingsManager {
|
|||||||
public SkillBehaviourManager getSkillBehaviourManager() {
|
public SkillBehaviourManager getSkillBehaviourManager() {
|
||||||
return skillBehaviourManager;
|
return skillBehaviourManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorldBlackListManager getWorldBlackListManager() {
|
||||||
|
return worldBlackListManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWorldBlacklisted(String worldName) {
|
||||||
|
return getWorldBlackListManager().isWorldBlacklisted(worldName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.gmail.nossr50.core;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs various duties relating to black listed worlds
|
||||||
|
*
|
||||||
|
* A world is identified solely by its name
|
||||||
|
* The blacklist is simply a hash set of world names
|
||||||
|
*/
|
||||||
|
public class WorldBlackListManager {
|
||||||
|
private HashSet<String> blackListedWorlds;
|
||||||
|
|
||||||
|
public WorldBlackListManager() {
|
||||||
|
this.blackListedWorlds = new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a world to the blacklist
|
||||||
|
* @param worldName target world's name
|
||||||
|
*/
|
||||||
|
public void addBlackListedWorld(String worldName) {
|
||||||
|
blackListedWorlds.add(worldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a collection of world names to the black list
|
||||||
|
* @param worldNames collection of target world names to black list
|
||||||
|
*/
|
||||||
|
public void addBlackListedWorlds(Collection<String> worldNames) {
|
||||||
|
blackListedWorlds.addAll(worldNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a world is blacklisted
|
||||||
|
* @param worldName target world's name
|
||||||
|
* @return true if the world is blacklisted
|
||||||
|
*/
|
||||||
|
public boolean isWorldBlacklisted(String worldName) {
|
||||||
|
return blackListedWorlds.contains(worldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the hash set of blacklisted worlds
|
||||||
|
* @return the blacklisted worlds
|
||||||
|
*/
|
||||||
|
public HashSet<String> getBlackListedWorlds() {
|
||||||
|
return blackListedWorlds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace the hash set of blacklisted worlds
|
||||||
|
* @param blackListedWorlds replacement hashset
|
||||||
|
*/
|
||||||
|
public void setBlackListedWorlds(HashSet<String> blackListedWorlds) {
|
||||||
|
this.blackListedWorlds = blackListedWorlds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear worlds from the blacklist
|
||||||
|
*/
|
||||||
|
public void clearBlackList() {
|
||||||
|
this.blackListedWorlds.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.datatypes.player;
|
package com.gmail.nossr50.datatypes.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
|
||||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
@ -813,7 +812,7 @@ public class McMMOPlayer {
|
|||||||
|
|
||||||
public void checkGodMode() {
|
public void checkGodMode() {
|
||||||
if (godMode && !Permissions.mcgod(player)
|
if (godMode && !Permissions.mcgod(player)
|
||||||
|| godMode && WorldBlacklist.isWorldBlacklisted(player.getWorld())) {
|
|| godMode && pluginRef.getDynamicSettingsManager().isWorldBlacklisted(player.getWorld().getName())) {
|
||||||
toggleGodMode();
|
toggleGodMode();
|
||||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.GodMode.Forbidden"));
|
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.GodMode.Forbidden"));
|
||||||
}
|
}
|
||||||
|
209
src/main/java/com/gmail/nossr50/dumpster/AdvancedConfig.java
Normal file
209
src/main/java/com/gmail/nossr50/dumpster/AdvancedConfig.java
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
//package com.gmail.nossr50.config;
|
||||||
|
//
|
||||||
|
//import com.gmail.nossr50.mcMMO;
|
||||||
|
//import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
//
|
||||||
|
//import java.util.ArrayList;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//@ConfigSerializable
|
||||||
|
//public class AdvancedConfig extends ConfigValidated {
|
||||||
|
//
|
||||||
|
// public static final String SKILLS = "Skills";
|
||||||
|
// public static final String GENERAL = "General";
|
||||||
|
// public static final String ABILITY = "Ability";
|
||||||
|
// public static final String LENGTH = "Length";
|
||||||
|
// public static final String INCREASE_LEVEL = "IncreaseLevel";
|
||||||
|
// public static final String ENCHANT_BUFF = "EnchantBuff";
|
||||||
|
// public static final String ACROBATICS = "Acrobatics";
|
||||||
|
// public static final String DODGE = "Dodge";
|
||||||
|
// public static final String CHANCE = "Chance";
|
||||||
|
// public static final String CHANCE_MAX = CHANCE + "Max";
|
||||||
|
// public static final String BONUS = "Bonus";
|
||||||
|
// public static final String MAX_BONUS_LEVEL = "Max" + BONUS + "Level";
|
||||||
|
// public static final String MODIFIER = "Modifier";
|
||||||
|
// public static final String DAMAGE_MODIFIER = "Damage" + MODIFIER;
|
||||||
|
// public static final String DAMAGE_THRESHOLD = "DamageThreshold";
|
||||||
|
// public static final String ALCHEMY = "Alchemy";
|
||||||
|
// public static final String CATALYSIS = "Catalysis";
|
||||||
|
// public static final String MIN_SPEED = "MinSpeed";
|
||||||
|
// public static final String MAX_SPEED = "MaxSpeed";
|
||||||
|
// public static final String ARCHERY = "Archery";
|
||||||
|
// public static final String SKILL_SHOT = "SkillShot";
|
||||||
|
// public static final String MULTIPLIER = "Multiplier";
|
||||||
|
// public static final String RANK_DAMAGE_MULTIPLIER = "RankDamage" + MULTIPLIER;
|
||||||
|
// public static final String BONUS_DAMAGE = BONUS + "Damage";
|
||||||
|
// public static final String FORCE_MULTIPLIER = "Force" + MULTIPLIER;
|
||||||
|
// public static final String AXES = "Axes";
|
||||||
|
// public static final String STANDARD = "Standard";
|
||||||
|
// public static final String RETRO_MODE = "RetroMode";
|
||||||
|
// public static final String CAP_LEVEL = "CapLevel";
|
||||||
|
// public static final String KNOCKBACK_MODIFIER = "Knockback" + MODIFIER;
|
||||||
|
// public static final String PVP_MODIFIER = "PVP_" + MODIFIER;
|
||||||
|
// public static final String PVE_MODIFIER = "PVE_" + MODIFIER;
|
||||||
|
// public static final String FISHING = "Fishing";
|
||||||
|
// public static final String MASTER_ANGLER = "MasterAngler";
|
||||||
|
// public static final String BOAT_MODIFIER = "Boat" + MODIFIER;
|
||||||
|
// public static final String BIOME_MODIFIER = "Biome" + MODIFIER;
|
||||||
|
// public static final String XP = "XP";
|
||||||
|
// public static final String VANILLA_XPMULTIPLIER = "Vanilla" + XP + MULTIPLIER;
|
||||||
|
// public static final String RANK = "Rank_";
|
||||||
|
// public static final String TAMING = "Taming";
|
||||||
|
// public static final String CALL_OF_THE_WILD = "CallOfTheWild";
|
||||||
|
// public static final String MIN_HORSE_JUMP_STRENGTH = "MinHorseJumpStrength";
|
||||||
|
// public static final String MAX_HORSE_JUMP_STRENGTH = "MaxHorseJumpStrength";
|
||||||
|
// public static final String SHOCK_PROOF = "ShockProof";
|
||||||
|
// public static final String UNARMED = "Unarmed";
|
||||||
|
// public static final String STARTING_LEVEL = "StartingLevel";
|
||||||
|
// public static final String AXE_MASTERY = "AxeMastery";
|
||||||
|
// public static final String CRITICAL_STRIKES = "CriticalStrikes";
|
||||||
|
// public static final String GREATER_IMPACT = "GreaterImpact";
|
||||||
|
// public static final String ARMOR_IMPACT = "ArmorImpact";
|
||||||
|
// public static final String SKULL_SPLITTER = "SkullSplitter";
|
||||||
|
// public static final String MAX_PERCENTAGE_DURABILITY_DAMAGE = "MaxPercentageDurabilityDamage";
|
||||||
|
// public static final String SHAKE = "Shake";
|
||||||
|
// public static final String MINING = "Mining";
|
||||||
|
// public static final String BLAST_MINING = "BlastMining";
|
||||||
|
// public static final String LEVELS = "Levels";
|
||||||
|
// public static final String BLAST_DAMAGE_DECREASE = "BlastDamageDecrease";
|
||||||
|
// public static final String ORE_BONUS = "Ore" + BONUS;
|
||||||
|
// public static final String DEBRIS_REDUCTION = "DebrisReduction";
|
||||||
|
// public static final String DROP_MULTIPLIER = "Drop" + MULTIPLIER;
|
||||||
|
// public static final String BLAST_RADIUS = "BlastRadius";
|
||||||
|
// public static final String REPAIR = "Repair";
|
||||||
|
// public static final String REPAIR_MASTERY = "RepairMastery";
|
||||||
|
// public static final String MAX_BONUS_PERCENTAGE = "Max" + BONUS + "Percentage";
|
||||||
|
// public static final String ARCANE_FORGING = "ArcaneForging";
|
||||||
|
// public static final String MAY_LOSE_ENCHANTS = "May_Lose_Enchants";
|
||||||
|
// public static final String KEEP_ENCHANTS = "Keep_Enchants_";
|
||||||
|
// public static final String DOWNGRADES = "Downgrades_";
|
||||||
|
// public static final String ENABLED = "Enabled";
|
||||||
|
// public static final String DOWNGRADES_ENABLED = DOWNGRADES + ENABLED;
|
||||||
|
// public static final String SALVAGE = "Salvage";
|
||||||
|
// public static final String ARCANE_SALVAGE = "ArcaneSalvage";
|
||||||
|
// public static final String ENCHANT_DOWNGRADE_ENABLED = "EnchantDowngrade" + ENABLED;
|
||||||
|
// public static final String ENCHANT_LOSS_ENABLED = "EnchantLoss" + ENABLED;
|
||||||
|
// public static final String EXTRACT_FULL_ENCHANT = "ExtractFullEnchant";
|
||||||
|
// public static final String EXTRACT_PARTIAL_ENCHANT = "ExtractPartialEnchant";
|
||||||
|
// public static final String SMELTING = "Smelting";
|
||||||
|
// public static final String FUEL_EFFICIENCY = "FuelEfficiency";
|
||||||
|
// public static final String SWORDS = "Swords";
|
||||||
|
// public static final String RUPTURE = "Rupture";
|
||||||
|
// public static final String DAMAGE_PLAYER = "DamagePlayer";
|
||||||
|
// public static final String DAMAGE_MOBS = "DamageMobs";
|
||||||
|
// public static final String MAX_TICKS = "MaxTicks";
|
||||||
|
// public static final String BASE_TICKS = "BaseTicks";
|
||||||
|
// public static final String COUNTER_ATTACK = "CounterAttack";
|
||||||
|
// public static final String SERRATED_STRIKES = "SerratedStrikes";
|
||||||
|
// public static final String TICKS = "Ticks";
|
||||||
|
// public static final String GORE = "Gore";
|
||||||
|
// public static final String FAST_FOOD = "FastFood";
|
||||||
|
// public static final String FAST_FOOD_SERVICE = FAST_FOOD + "Service";
|
||||||
|
// public static final String PUMMEL = "Pummel";
|
||||||
|
// public static final String THICK_FUR = "ThickFur";
|
||||||
|
// public static final String SHARPENED_CLAWS = "SharpenedClaws";
|
||||||
|
// public static final String DISARM = "Disarm";
|
||||||
|
// public static final String ANTI_THEFT = "AntiTheft";
|
||||||
|
// public static final String DAZE = "Daze";
|
||||||
|
// public static final String MAX_DAMAGE = "MaxDamage";
|
||||||
|
// public static final String ROLL = "Roll";
|
||||||
|
// public static final String GRACEFUL_ROLL = "Graceful" + ROLL;
|
||||||
|
// public static final String ARROW_DEFLECT = "ArrowDeflect";
|
||||||
|
// public static final String IRON_GRIP = "IronGrip";
|
||||||
|
// public static final String WOODCUTTING = "Woodcutting";
|
||||||
|
// public static final String HARVEST_LUMBER = "HarvestLumber";
|
||||||
|
// public static final String FEEDBACK = "Feedback";
|
||||||
|
// public static final String SKILL_COMMAND = "SkillCommand";
|
||||||
|
// public static final String BLANK_LINES_ABOVE_HEADER = "BlankLinesAboveHeader";
|
||||||
|
// public static final String ACTION_BAR_NOTIFICATIONS = "ActionBarNotifications";
|
||||||
|
// public static final String SEND_COPY_OF_MESSAGE_TO_CHAT = "SendCopyOfMessageToChat";
|
||||||
|
// public static final String EVENTS = "Events";
|
||||||
|
// public static final String SEND_TITLES = "SendTitles";
|
||||||
|
// //private static AdvancedConfig instance;
|
||||||
|
//
|
||||||
|
// public AdvancedConfig() {
|
||||||
|
// //super(mcMMO.getDataFolderPath().getAbsoluteFile(), "advanced.yml", true);
|
||||||
|
// super("advanced", pluginRef.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * This grabs an instance of this config class from the Config Manager
|
||||||
|
// * This method is deprecated and will be removed in the future
|
||||||
|
// *
|
||||||
|
// * @return the instance of this config
|
||||||
|
// * @see mcMMO#getConfigManager()
|
||||||
|
// * @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
|
// */
|
||||||
|
// @Deprecated
|
||||||
|
// public static AdvancedConfig getInstance() {
|
||||||
|
// return pluginRef.getConfigManager().getAdvancedConfig();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * The version of this config
|
||||||
|
// *
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// public double getConfigVersion() {
|
||||||
|
// return 1;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public List<String> validateKeys() {
|
||||||
|
// // Validate all the settings!
|
||||||
|
// List<String> reason = new ArrayList<>();
|
||||||
|
// return reason;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* GENERAL */
|
||||||
|
//
|
||||||
|
// /* Notification Settings */
|
||||||
|
//
|
||||||
|
// /* FISHING */
|
||||||
|
// public double getShakeChance(int rank) {
|
||||||
|
// return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getMasterAnglerBoatModifier() {
|
||||||
|
// return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getMasterAnglerBiomeModifier() {
|
||||||
|
// return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* TAMING */
|
||||||
|
// public double getGoreModifier() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getFastFoodChance() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, FAST_FOOD_SERVICE, CHANCE);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getPummelChance() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, PUMMEL, CHANCE);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getThickFurModifier() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, THICK_FUR, MODIFIER);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getShockProofModifier() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, SHOCK_PROOF, MODIFIER);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getSharpenedClawsBonus() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, SHARPENED_CLAWS, BONUS);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getMinHorseJumpStrength() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MIN_HORSE_JUMP_STRENGTH);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getMaxHorseJumpStrength() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MAX_HORSE_JUMP_STRENGTH);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
481
src/main/java/com/gmail/nossr50/dumpster/Config.java
Normal file
481
src/main/java/com/gmail/nossr50/dumpster/Config.java
Normal file
@ -0,0 +1,481 @@
|
|||||||
|
//package com.gmail.nossr50.config;
|
||||||
|
//
|
||||||
|
//import com.google.common.io.Files;
|
||||||
|
//import com.google.common.reflect.TypeToken;
|
||||||
|
//import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||||
|
//import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
||||||
|
//import ninja.leaping.configurate.loader.ConfigurationLoader;
|
||||||
|
//import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
|
//
|
||||||
|
//import java.io.File;
|
||||||
|
//import java.io.IOException;
|
||||||
|
//import java.io.InputStream;
|
||||||
|
//import java.nio.file.Path;
|
||||||
|
//import java.nio.file.Paths;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * Handles loading and cacheing configuration settings from a configurable compatible config file
|
||||||
|
// */
|
||||||
|
//public abstract class Config implements VersionedConfig {
|
||||||
|
//
|
||||||
|
// public static final String HOCON_FILE_EXTENSION = ".conf";
|
||||||
|
// public final File DIRECTORY_DATA_FOLDER; //Directory that the file is in
|
||||||
|
// public final String FILE_RELATIVE_PATH; //Relative Path to the file
|
||||||
|
// protected final String DIRECTORY_DEFAULTS = "defaults";
|
||||||
|
// /* SETTINGS */
|
||||||
|
// //private static final String FILE_EXTENSION = ".conf"; //HOCON
|
||||||
|
// private boolean mergeNewKeys; //Whether or not to merge keys found in the default config
|
||||||
|
// private boolean removeOldKeys; //Whether or not to remove unused keys form the config
|
||||||
|
//
|
||||||
|
// /* PATH VARS */
|
||||||
|
// private boolean copyDefaults; //Whether or not to copy the default config when first creating the file
|
||||||
|
// private boolean generateDefaults; //Whether or not we use Configurate to generate a default file, if this is false we copy the file from the JAR
|
||||||
|
// private String fileName; //The file name of the config
|
||||||
|
//
|
||||||
|
// /* LOADERS */
|
||||||
|
// private HoconConfigurationLoader defaultCopyLoader;
|
||||||
|
// private HoconConfigurationLoader userCopyLoader;
|
||||||
|
//
|
||||||
|
// //private ConfigurationLoader<CommentedCommentedConfigurationNode> defaultCopyLoader;
|
||||||
|
// //private ConfigurationLoader<CommentedCommentedConfigurationNode> userCopyLoader;
|
||||||
|
//
|
||||||
|
// /* CONFIG FILES */
|
||||||
|
//
|
||||||
|
// private File resourceConfigCopy; //Copy of the default config from the JAR (file is copied so that admins can easily compare to defaults)
|
||||||
|
// private File resourceUserCopy; //File in the /$MCMMO_ROOT/mcMMO/ directory that may contain user edited settings
|
||||||
|
//
|
||||||
|
// /* ROOT NODES */
|
||||||
|
//
|
||||||
|
// private CommentedConfigurationNode userRootNode = null;
|
||||||
|
// private CommentedConfigurationNode defaultRootNode = null;
|
||||||
|
//
|
||||||
|
// /* CONFIG MANAGER */
|
||||||
|
// //private ConfigurationLoader<CommentedCommentedConfigurationNode> configManager;
|
||||||
|
//
|
||||||
|
// /*public Config(String pathToParentFolder, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
||||||
|
// //TODO: Check if this works...
|
||||||
|
// this(new File(pathToParentFolder), relativePath, mergeNewKeys, copyDefaults, removeOldKeys);
|
||||||
|
// System.out.println("mcMMO Debug: Don't forget to check if loading config file by string instead of File works...");
|
||||||
|
// }*/
|
||||||
|
//
|
||||||
|
// public Config(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
||||||
|
// mkdirDefaults(); // Make our default config dir
|
||||||
|
//
|
||||||
|
// /*
|
||||||
|
// * These must be at the top
|
||||||
|
// */
|
||||||
|
// this.fileName = fileName;
|
||||||
|
// this.generateDefaults = generateDefaults;
|
||||||
|
// this.copyDefaults = copyDefaults;
|
||||||
|
// this.mergeNewKeys = mergeNewKeys; //Whether or not we add new keys when they are found
|
||||||
|
// this.removeOldKeys = removeOldKeys;
|
||||||
|
//
|
||||||
|
// DIRECTORY_DATA_FOLDER = pathToParentFolder; //Data Folder for our plugin
|
||||||
|
// FILE_RELATIVE_PATH = relativePath + fileName + HOCON_FILE_EXTENSION; //Relative path to config from a parent folder
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void initFullConfig() {
|
||||||
|
// //Attempt IO Operations
|
||||||
|
// try {
|
||||||
|
// //Makes sure we have valid Files corresponding to this config
|
||||||
|
// initConfigFiles();
|
||||||
|
//
|
||||||
|
// //Init MainConfig Loaders
|
||||||
|
// initConfigLoaders();
|
||||||
|
//
|
||||||
|
// //Load MainConfig Nodes
|
||||||
|
// loadConfig();
|
||||||
|
//
|
||||||
|
// //Attempt to update user file, and then load it into memory
|
||||||
|
// readConfig();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //Cleanup and backup registers
|
||||||
|
//// registerUnload();
|
||||||
|
// registerFileBackup();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// /**
|
||||||
|
//// * Registers with the config managers unloader
|
||||||
|
//// * The unloader runs when the plugin gets disabled which cleans up registries to make reloading safe
|
||||||
|
//// */
|
||||||
|
//// private void registerUnload() {
|
||||||
|
//// mcMMO.getConfigManager().registerUnloadable(this);
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Registers with the config managers file list
|
||||||
|
// * Used for backing up configs with our zip library
|
||||||
|
// */
|
||||||
|
// private void registerFileBackup() {
|
||||||
|
// pluginRef.getConfigManager().registerUserFile(getUserConfigFile());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Initializes the default copy File and the user config File
|
||||||
|
// *
|
||||||
|
// * @throws IOException
|
||||||
|
// */
|
||||||
|
// private void initConfigFiles() throws IOException {
|
||||||
|
// //Init our config copy
|
||||||
|
// resourceConfigCopy = initDefaultConfig();
|
||||||
|
//
|
||||||
|
// //Init the user file
|
||||||
|
// resourceUserCopy = initUserConfig();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Loads the root node for the default config File and user config File
|
||||||
|
// */
|
||||||
|
// private void loadConfig() {
|
||||||
|
// try {
|
||||||
|
// final CommentedConfigurationNode defaultConfig = this.defaultCopyLoader.load();
|
||||||
|
// defaultRootNode = defaultConfig;
|
||||||
|
//
|
||||||
|
// final CommentedConfigurationNode userConfig = this.userCopyLoader.load();
|
||||||
|
// userRootNode = userConfig;
|
||||||
|
//
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Initializes the Configuration Loaders for this config
|
||||||
|
// */
|
||||||
|
// private void initConfigLoaders() {
|
||||||
|
// this.defaultCopyLoader = HoconConfigurationLoader.builder().setPath(resourceConfigCopy.toPath()).build();
|
||||||
|
// this.userCopyLoader = HoconConfigurationLoader.builder().setPath(resourceUserCopy.toPath()).build();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Copies a new file from the JAR to the defaults directory and uses that new file to initialize our resourceConfigCopy
|
||||||
|
// *
|
||||||
|
// * @throws IOException
|
||||||
|
// * @see Config#resourceConfigCopy
|
||||||
|
// */
|
||||||
|
// private File initDefaultConfig() throws IOException {
|
||||||
|
// if (generateDefaults) {
|
||||||
|
// return generateDefaultFile();
|
||||||
|
// } else
|
||||||
|
// return copyDefaultFromJar(getDefaultConfigCopyRelativePath(), true);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Generates a default config file using the Configurate library, makes use of @Setting and @ConfigSerializable annotations in the config file
|
||||||
|
// * Assigns the default root node to the newly loaded default config if successful
|
||||||
|
// *
|
||||||
|
// * @return the File for the newly created config
|
||||||
|
// */
|
||||||
|
// private File generateDefaultFile() {
|
||||||
|
// pluginRef.getLogger().info("Attempting to create a default config for " + fileName);
|
||||||
|
//
|
||||||
|
// //Not sure if this will work properly...
|
||||||
|
// Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath());
|
||||||
|
// ConfigurationLoader<CommentedConfigurationNode> generation_loader
|
||||||
|
// = HoconConfigurationLoader.builder().setPath(potentialFile).build();
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// pluginRef.getLogger().info("Config File Full Path: " + getDefaultConfigFile().getAbsolutePath());
|
||||||
|
// //Delete any existing default config
|
||||||
|
// if (getDefaultConfigFile().exists())
|
||||||
|
// getDefaultConfigFile().delete();
|
||||||
|
//
|
||||||
|
// //Make new file
|
||||||
|
// getDefaultConfigFile().createNewFile();
|
||||||
|
//
|
||||||
|
// //Load the config
|
||||||
|
// defaultRootNode = generation_loader.load();
|
||||||
|
//
|
||||||
|
// //Save to a new file
|
||||||
|
// generation_loader.save(defaultRootNode);
|
||||||
|
//
|
||||||
|
// pluginRef.getLogger().info("Generated a default file for " + fileName);
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// pluginRef.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath());
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //Return the default file
|
||||||
|
// return getDefaultConfigFile();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Attemps to load the config file if it exists, if it doesn't it copies a new one from within the JAR
|
||||||
|
// *
|
||||||
|
// * @return user config File
|
||||||
|
// * @throws IOException
|
||||||
|
// * @see Config#resourceUserCopy
|
||||||
|
// */
|
||||||
|
// private File initUserConfig() throws IOException {
|
||||||
|
// File userCopy = new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH); //Load the user file;
|
||||||
|
//
|
||||||
|
// if (userCopy.exists()) {
|
||||||
|
// // Yay
|
||||||
|
// return userCopy;
|
||||||
|
// } else {
|
||||||
|
// //If it's gone we copy default files
|
||||||
|
// //Note that we don't copy the values from the default copy put in /defaults/ that file exists only as a reference to admins and is unreliable
|
||||||
|
// if (copyDefaults)
|
||||||
|
// return copyDefaultFromJar(FILE_RELATIVE_PATH, false);
|
||||||
|
// else {
|
||||||
|
// //Make a new empty file
|
||||||
|
// userCopy.createNewFile();
|
||||||
|
// return userCopy;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the File representation of the this users config
|
||||||
|
// *
|
||||||
|
// * @return the users config File
|
||||||
|
// */
|
||||||
|
// public File getUserConfigFile() {
|
||||||
|
// return new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Used to make a new config file at a specified relative output path inside the data directory by copying the matching file found in that same relative path within the JAR
|
||||||
|
// *
|
||||||
|
// * @param relativeOutputPath the path to the output file
|
||||||
|
// * @param deleteOld whether or not to delete the existing output file on disk
|
||||||
|
// * @return a copy of the default config within the JAR
|
||||||
|
// * @throws IOException
|
||||||
|
// */
|
||||||
|
// private File copyDefaultFromJar(String relativeOutputPath, boolean deleteOld) throws IOException {
|
||||||
|
// /*
|
||||||
|
// * Gen a Default config from inside the JAR
|
||||||
|
// */
|
||||||
|
// pluginRef.getLogger().info("Preparing to copy internal resource file (in JAR) - " + FILE_RELATIVE_PATH);
|
||||||
|
// //InputStream inputStream = McmmoCore.getResource(FILE_RELATIVE_PATH);
|
||||||
|
// InputStream inputStream = pluginRef.getResource(FILE_RELATIVE_PATH);
|
||||||
|
//
|
||||||
|
// byte[] buffer = new byte[inputStream.available()];
|
||||||
|
// inputStream.read(buffer);
|
||||||
|
//
|
||||||
|
// //This is a copy of the default file, which we will overwrite every time mcMMO loads
|
||||||
|
// File targetFile = new File(DIRECTORY_DATA_FOLDER, relativeOutputPath);
|
||||||
|
//
|
||||||
|
// //Wipe old default file on disk
|
||||||
|
// if (targetFile.exists() && deleteOld) {
|
||||||
|
// pluginRef.getLogger().info("Updating file " + relativeOutputPath);
|
||||||
|
// targetFile.delete(); //Necessary?
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!targetFile.exists()) {
|
||||||
|
// targetFile.getParentFile().mkdirs();
|
||||||
|
// targetFile.createNewFile(); //New File Boys
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Files.write(buffer, targetFile);
|
||||||
|
// pluginRef.getLogger().info("Created config file - " + relativeOutputPath);
|
||||||
|
//
|
||||||
|
// inputStream.close(); //Close the input stream
|
||||||
|
//
|
||||||
|
// return targetFile;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * The path to the defaults directory
|
||||||
|
// *
|
||||||
|
// * @return the path to the defaults directory
|
||||||
|
// */
|
||||||
|
// private String getDefaultConfigCopyRelativePath() {
|
||||||
|
// return getDefaultConfigFile().getPath();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Grabs the File representation of the default config, which is stored on disk in a defaults folder
|
||||||
|
// * this file will be overwritten every time mcMMO starts to keep it up to date.
|
||||||
|
// *
|
||||||
|
// * @return the copy of the default config file, stored in the defaults directory
|
||||||
|
// */
|
||||||
|
// private File getDefaultConfigFile() {
|
||||||
|
// return new File(ConfigConstants.getDefaultsFolder(), FILE_RELATIVE_PATH);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Creates the defaults directory
|
||||||
|
// */
|
||||||
|
// private void mkdirDefaults() {
|
||||||
|
// ConfigConstants.makeAllConfigDirectories();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Configs are versioned based on when they had significant changes to keys
|
||||||
|
// *
|
||||||
|
// * @return current MainConfig Version String
|
||||||
|
// */
|
||||||
|
// public String getVersion() {
|
||||||
|
// return String.valueOf(getConfigVersion());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Attempts to read the loaded config file
|
||||||
|
// * MainConfig will have any necessary updates applied
|
||||||
|
// * MainConfig will be compared to the default config to see if it is missing any nodes
|
||||||
|
// * MainConfig will have any missing nodes inserted with their default value
|
||||||
|
// */
|
||||||
|
// public void readConfig() {
|
||||||
|
// pluginRef.getLogger().info("Attempting to read " + FILE_RELATIVE_PATH + ".");
|
||||||
|
//
|
||||||
|
// int version = this.userRootNode.getNode("ConfigVersion").getInt();
|
||||||
|
// pluginRef.getLogger().info(FILE_RELATIVE_PATH + " version is " + version);
|
||||||
|
//
|
||||||
|
// //Update our config
|
||||||
|
// updateConfig();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Compares the users config file to the default and adds any missing nodes and applies any necessary updates
|
||||||
|
// */
|
||||||
|
// private void updateConfig() {
|
||||||
|
// pluginRef.getLogger().info(defaultRootNode.getChildrenMap().size() + " items in default children map");
|
||||||
|
// pluginRef.getLogger().info(userRootNode.getChildrenMap().size() + " items in default root map");
|
||||||
|
//
|
||||||
|
// // Merge Values from default
|
||||||
|
// if (mergeNewKeys)
|
||||||
|
// userRootNode = userRootNode.mergeValuesFrom(defaultRootNode);
|
||||||
|
//
|
||||||
|
// removeOldKeys();
|
||||||
|
//
|
||||||
|
// // Update config version
|
||||||
|
// updateConfigVersion();
|
||||||
|
//
|
||||||
|
// //Attempt to save
|
||||||
|
// try {
|
||||||
|
// saveUserCopy();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Finds any keys in the users config that are not present in the default config and removes them
|
||||||
|
// */
|
||||||
|
// //TODO: Finish this
|
||||||
|
// private void removeOldKeys() {
|
||||||
|
// if (!removeOldKeys)
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// for (CommentedConfigurationNode CommentedConfigurationNode : defaultRootNode.getChildrenList()) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Saves the current state information of the config to the users copy (which they may edit)
|
||||||
|
// *
|
||||||
|
// * @throws IOException
|
||||||
|
// */
|
||||||
|
// private void saveUserCopy() throws IOException {
|
||||||
|
// pluginRef.getLogger().info("Saving new node");
|
||||||
|
// userCopyLoader.save(userRootNode);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Performs any necessary operations to update this config
|
||||||
|
// */
|
||||||
|
// private void updateConfigVersion() {
|
||||||
|
// // Set a version for our config
|
||||||
|
// this.userRootNode.getNode("ConfigVersion").setValue(getConfigVersion());
|
||||||
|
// pluginRef.getLogger().info("Updated config to [" + getConfigVersion() + "] - " + FILE_RELATIVE_PATH);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Returns the root node of this config
|
||||||
|
// *
|
||||||
|
// * @return the root node of this config
|
||||||
|
// */
|
||||||
|
// protected CommentedConfigurationNode getUserRootNode() {
|
||||||
|
// return userRootNode;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets an int from the config and casts it to short before returning
|
||||||
|
// *
|
||||||
|
// * @param path the path to the int
|
||||||
|
// * @return the value of the int after being cast to short at the node, null references will zero initialize
|
||||||
|
// */
|
||||||
|
// public short getShortValue(String... path) {
|
||||||
|
// return (short) userRootNode.getNode(path).getInt();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Grabs an int from the specified node
|
||||||
|
// *
|
||||||
|
// * @param path
|
||||||
|
// * @return the int from the node, null references will zero initialize
|
||||||
|
// */
|
||||||
|
// public int getIntValue(String... path) {
|
||||||
|
// return userRootNode.getNode(path).getInt();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Grabs a double from the specified node
|
||||||
|
// *
|
||||||
|
// * @param path
|
||||||
|
// * @return the double from the node, null references will zero initialize
|
||||||
|
// */
|
||||||
|
// public double getDoubleValue(String... path) {
|
||||||
|
// return userRootNode.getNode(path).getDouble();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Grabs a long from the specified node
|
||||||
|
// *
|
||||||
|
// * @param path
|
||||||
|
// * @return the long from the node, null references will zero initialize
|
||||||
|
// */
|
||||||
|
// public long getLongValue(String... path) {
|
||||||
|
// return userRootNode.getNode(path).getLong();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Grabs a boolean from the specified node
|
||||||
|
// *
|
||||||
|
// * @param path
|
||||||
|
// * @return the boolean from the node, null references will zero initialize
|
||||||
|
// */
|
||||||
|
// public boolean getBooleanValue(String... path) {
|
||||||
|
// return userRootNode.getNode(path).getBoolean();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Grabs a string from the specified node
|
||||||
|
// *
|
||||||
|
// * @param path
|
||||||
|
// * @return the string from the node, null references will zero initialize
|
||||||
|
// */
|
||||||
|
// public String getStringValue(String... path) {
|
||||||
|
// return userRootNode.getNode(path).getString();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Checks to see if a node exists in the user's config file
|
||||||
|
// *
|
||||||
|
// * @param path path to the node
|
||||||
|
// * @return true if the node exists
|
||||||
|
// */
|
||||||
|
// public boolean hasNode(String... path) {
|
||||||
|
// return (userRootNode.getNode(path) != null);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Returns the children of a specific node
|
||||||
|
// *
|
||||||
|
// * @param path the path to the parent node
|
||||||
|
// * @return the list of children for the target parent node
|
||||||
|
// */
|
||||||
|
// public List<? extends CommentedConfigurationNode> getChildren(String... path) {
|
||||||
|
// return userRootNode.getNode(path).getChildrenList();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<String> getListFromNode(String... path) throws ObjectMappingException {
|
||||||
|
// return userRootNode.getNode(path).getList(TypeToken.of(String.class));
|
||||||
|
// }
|
||||||
|
//}
|
@ -0,0 +1,20 @@
|
|||||||
|
//package com.gmail.nossr50.config;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//import java.io.File;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * This class is used for config files that validate their entries
|
||||||
|
// */
|
||||||
|
//public abstract class ConfigValidated extends Config implements UnsafeValueValidation {
|
||||||
|
// /**
|
||||||
|
// * @param pathToParentFolder File for the "parent" folder on disk
|
||||||
|
// * @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
|
||||||
|
// * @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
|
||||||
|
// * @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
||||||
|
// */
|
||||||
|
// public ConfigValidated(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
||||||
|
// super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
|
||||||
|
// validateEntries();
|
||||||
|
// }
|
||||||
|
//}
|
269
src/main/java/com/gmail/nossr50/dumpster/MainConfig.java
Normal file
269
src/main/java/com/gmail/nossr50/dumpster/MainConfig.java
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
//package com.gmail.nossr50.config;
|
||||||
|
//
|
||||||
|
//import com.gmail.nossr50.mcMMO;
|
||||||
|
//import com.gmail.nossr50.util.StringUtils;
|
||||||
|
//import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
//import org.bukkit.Material;
|
||||||
|
//import org.bukkit.entity.EntityType;
|
||||||
|
//
|
||||||
|
//import java.util.ArrayList;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//@ConfigSerializable
|
||||||
|
//public class MainConfig extends ConfigValidated {
|
||||||
|
//
|
||||||
|
// public static final String METRICS = "Metrics";
|
||||||
|
// public static final String BSTATS = "bstats";
|
||||||
|
// public static final String GENERAL = "General";
|
||||||
|
// public static final String RETRO_MODE = "RetroMode";
|
||||||
|
// public static final String ENABLED = "Enabled";
|
||||||
|
// public static final String LOCALE = "LocaleManager";
|
||||||
|
// public static final String EN_US = "en_us";
|
||||||
|
// public static final String SHOW_PROFILE_LOADED = "Show_Profile_Loaded";
|
||||||
|
// public static final String DONATE_MESSAGE = "Donate_Message";
|
||||||
|
// public static final String MCMMO = "mcmmo";
|
||||||
|
// public static final String DATABASE_PREFIX = MCMMO + "_";
|
||||||
|
// public static final String COMMANDS = "Commands";
|
||||||
|
// public static final String SAVE_INTERVAL = "Save_Interval";
|
||||||
|
// public static final String STATS = "Stats";
|
||||||
|
// public static final String STATS_TRACKING = STATS + "_Tracking";
|
||||||
|
// public static final String UPDATE_CHECK = "Update_Check";
|
||||||
|
// public static final String PREFER_BETA = "Prefer_Beta";
|
||||||
|
// public static final String VERBOSE_LOGGING = "Verbose_Logging";
|
||||||
|
// public static final String PARTYCHAT = "partychat";
|
||||||
|
// public static final String CHAT_PREFIX_FORMAT = "Chat_Prefix_Format";
|
||||||
|
// public static final String NAME = "Name";
|
||||||
|
// public static final String GOLD_LEADER_NAME = "Gold_Leader_" + NAME;
|
||||||
|
// public static final String USE_DISPLAY_NAMES = "Use_Display_" + NAME + "s";
|
||||||
|
// public static final String ALLY = "_Ally";
|
||||||
|
// public static final String ADMINCHAT = "adminchat";
|
||||||
|
// public static final String GENERIC = "Generic";
|
||||||
|
// public static final String MATCH_OFFLINE_PLAYERS = "Match_OfflinePlayers";
|
||||||
|
// public static final String DATABASE = "Database";
|
||||||
|
// public static final String COOLDOWN = "Cooldown";
|
||||||
|
// public static final String PLAYER_COOLDOWN = "Player_" + COOLDOWN;
|
||||||
|
// public static final String LEVEL_UP = "LevelUp_";
|
||||||
|
// public static final String SOUND = "Sound";
|
||||||
|
// public static final String LEVEL_UP_SOUNDS = "LevelUp_Sounds";
|
||||||
|
// public static final String REFRESH_CHUNKS = "Refresh_Chunks";
|
||||||
|
// public static final String MOB_HEALTHBAR = "Mob_Healthbar";
|
||||||
|
// public static final String DISPLAY_TYPE = "Display_Type";
|
||||||
|
// public static final String HEARTS = "HEARTS";
|
||||||
|
// public static final String DISPLAY_TIME = "Display_Time";
|
||||||
|
// public static final String SCOREBOARD = "ConfigScoreboard";
|
||||||
|
// public static final String USE_SCOREBOARDS = "UseScoreboards";
|
||||||
|
// public static final String POWER = "Power_";
|
||||||
|
// public static final String POWER_LEVEL_TAGS = POWER + "Level_Tags";
|
||||||
|
// public static final String KEEP = "Keep";
|
||||||
|
// public static final String ALLOW_KEEP = "Allow_" + KEEP;
|
||||||
|
// public static final String TIPS_AMOUNT = "Tips_Amount";
|
||||||
|
// public static final String SHOW_STATS_AFTER_LOGIN = "Show_" + STATS + "_After_Login";
|
||||||
|
// public static final String RAINBOWS = "Rainbows";
|
||||||
|
// public static final String ABILITY_NAMES = "Ability_" + NAME + "s";
|
||||||
|
// public static final String TYPES = "Types";
|
||||||
|
// public static final String RANK = "Rank";
|
||||||
|
// public static final String PRINT = "Print";
|
||||||
|
// public static final String BOARD = "Board";
|
||||||
|
// public static final String TOP = "Top";
|
||||||
|
// public static final String INSPECT = "Inspect";
|
||||||
|
// public static final String SKILL = "Skill";
|
||||||
|
// public static final String TIME = "Time";
|
||||||
|
// public static final String PURGING = "_Purging";
|
||||||
|
// public static final String PURGE_INTERVAL = "Purge_Interval";
|
||||||
|
// public static final String OLD_USER_CUTOFF = "Old_User_Cutoff";
|
||||||
|
// public static final String BACKUPS = "Backups";
|
||||||
|
// public static final String KEEP_LAST_24_HOURS = KEEP + ".Last_24_Hours";
|
||||||
|
// public static final String DAILY_LAST_WEEK = "Daily_Last_Week";
|
||||||
|
// public static final String WEEKLY_PAST_MONTHS = "Weekly_Past_Months";
|
||||||
|
// public static final String MY_SQL = "MySQL";
|
||||||
|
// public static final String TABLE_PREFIX = "TablePrefix";
|
||||||
|
// public static final String USER_NAME = "User_" + NAME;
|
||||||
|
// public static final String SERVER = "Server";
|
||||||
|
// public static final String PORT = "Port";
|
||||||
|
// public static final String ADDRESS = "Address";
|
||||||
|
// public static final String LOCALHOST = "localhost";
|
||||||
|
// public static final String USER_PASSWORD = "User_Password";
|
||||||
|
// public static final String MAX_CONNECTIONS = "MaxConnections";
|
||||||
|
// public static final String MAX_POOL_SIZE = "MaxPoolSize";
|
||||||
|
// public static final String SSL = "SSL";
|
||||||
|
// public static final String HARDCORE = "Hardcore";
|
||||||
|
// public static final String DEATH_STAT_LOSS = "Death_Stat_Loss";
|
||||||
|
// public static final String PENALTY_PERCENTAGE = "Penalty_Percentage";
|
||||||
|
// public static final String LEVEL_THRESHOLD = "Level_Threshold";
|
||||||
|
// public static final String VAMPIRISM = "Vampirism";
|
||||||
|
// public static final String LEECH_PERCENTAGE = "Leech_Percentage";
|
||||||
|
// public static final String ITEMS = "Items";
|
||||||
|
// public static final String CHIMAERA_WING = "Chimaera_Wing";
|
||||||
|
// public static final String USE_COST = "Use_Cost";
|
||||||
|
// public static final String RECIPE_COST = "Recipe_Cost";
|
||||||
|
// public static final String ITEM = "Item_";
|
||||||
|
// public static final String FEATHER = "Feather";
|
||||||
|
// public static final String PREVENT = "Prevent_";
|
||||||
|
// public static final String PREVENT_USE_UNDERGROUND = PREVENT + "Use_Underground";
|
||||||
|
// public static final String USE_BED_SPAWN = "Use_Bed_Spawn";
|
||||||
|
// public static final String WARMUP = "Warmup";
|
||||||
|
// public static final String RECENTLY_HURT = "RecentlyHurt_";
|
||||||
|
// public static final String PARTICLES = "Particles";
|
||||||
|
// public static final String ACTIVATION = "Activation";
|
||||||
|
// public static final String ABILITY_ACTIVATION = "Ability_" + ACTIVATION;
|
||||||
|
// public static final String ABILITY_DEACTIVATION = "Ability_Deactivation";
|
||||||
|
// public static final String BLEED = "Bleed";
|
||||||
|
// public static final String DODGE = "Dodge";
|
||||||
|
// public static final String FLUX = "Flux";
|
||||||
|
// public static final String GREATER_IMPACT = "Greater_Impact";
|
||||||
|
// public static final String CALL_OF_THE_WILD = "Call_of_the_Wild";
|
||||||
|
// public static final String TIER = "Tier";
|
||||||
|
// public static final String LARGE_FIREWORKS = "LargeFireworks";
|
||||||
|
// public static final String PARTY = "Party";
|
||||||
|
// public static final String FRIENDLY_FIRE = "FriendlyFire";
|
||||||
|
// public static final String MAX_SIZE = "MaxSize";
|
||||||
|
// public static final String AUTO_KICK_INTERVAL = "AutoKick_Interval";
|
||||||
|
// public static final String OLD_PARTY_MEMBER_CUTOFF = "Old_Party_Member_Cutoff";
|
||||||
|
// public static final String SHARING = "Sharing";
|
||||||
|
// public static final String SHARING_EXP_SHARE_BONUS_BASE = SHARING + "ExpShare_bonus_base";
|
||||||
|
// public static final String EXP_SHARE_BONUS_INCREASE = "ExpShare_bonus_increase";
|
||||||
|
// public static final String EXP_SHARE_BONUS_CAP = "ExpShare_bonus_cap";
|
||||||
|
// public static final String RANGE = "Range";
|
||||||
|
// public static final String LEVELING = "Leveling";
|
||||||
|
// public static final String LEVEL_CAP = "Level_Cap";
|
||||||
|
// public static final String XP_CURVE_MODIFIER = "Xp_Curve_Modifier";
|
||||||
|
// public static final String NEAR_MEMBERS_NEEDED = "Near_Members_Needed";
|
||||||
|
// public static final String INFORM_ALL_PARTY_MEMBERS_ON_LEVEL_UP = "Inform_All_Party_Members_On_LevelUp";
|
||||||
|
// public static final String UNLOCK_LEVEL = "_UnlockLevel";
|
||||||
|
// public static final String PTP = "ptp";
|
||||||
|
// public static final String ACCEPT_REQUIRED = "Accept_Required";
|
||||||
|
// public static final String REQUEST_TIMEOUT = "Request_Timeout";
|
||||||
|
// public static final String WORLD_BASED_PERMISSIONS = "World_Based_Permissions";
|
||||||
|
// public static final String INSPECT1 = "inspect";
|
||||||
|
// public static final String MAX_DISTANCE = "Max_Distance";
|
||||||
|
// public static final String SKILLS = "Skills";
|
||||||
|
// public static final String URL_LINKS = "URL_Links";
|
||||||
|
// public static final String ABILITIES = "Abilities";
|
||||||
|
// public static final String MESSAGES = "Messages";
|
||||||
|
// public static final String ONLY_ACTIVATE_WHEN_SNEAKING = "Only_Activate_When_Sneaking";
|
||||||
|
// public static final String LEVEL_GATE_ABILITIES = "Level_Gate_Abilities";
|
||||||
|
// public static final String COOLDOWNS = "Cooldowns";
|
||||||
|
// public static final String MAX_SECONDS = "Max_Seconds";
|
||||||
|
// public static final String TOOLS = "Tools";
|
||||||
|
// public static final String DURABILITY_LOSS = "Durability_Loss";
|
||||||
|
// public static final String LIMITS = "Limits";
|
||||||
|
// public static final String TREE_FELLER = "Tree_Feller_";
|
||||||
|
// public static final String TREE_FELLER_THRESHOLD = TREE_FELLER + "Threshold";
|
||||||
|
// public static final String DOUBLE_DROPS = "Double_Drops";
|
||||||
|
// public static final String AXES = "Axes";
|
||||||
|
// public static final String TRUNCATE = "Truncate";
|
||||||
|
// public static final String FOR_PVP = "_For_PVP";
|
||||||
|
// public static final String FOR_PVE = "_For_PVE";
|
||||||
|
// public static final String ACROBATICS = "Acrobatics";
|
||||||
|
// public static final String PREVENT_AFK = PREVENT + "AFK_";
|
||||||
|
// public static final String WOODCUTTING = "Woodcutting";
|
||||||
|
// public static final String SOUNDS = "Sounds";
|
||||||
|
// public static final String MAX_TRIES_AT_SAME_LOCATION = "Max_Tries_At_Same_Location";
|
||||||
|
// public static final String HERBALISM = "Herbalism";
|
||||||
|
// public static final String TAMING = "Taming";
|
||||||
|
// public static final String CALL_OF_THE_WILD1 = "Call_Of_The_Wild";
|
||||||
|
// public static final String SUMMON_AMOUNT = "Summon_Amount";
|
||||||
|
// public static final String SUMMON_LENGTH = "Summon_Length";
|
||||||
|
// public static final String SUMMON_MAX_AMOUNT = "Summon_Max_Amount";
|
||||||
|
// public static final String AMOUNT = "Amount";
|
||||||
|
// public static final String MATERIAL = "Material";
|
||||||
|
// public static final String REPAIR = "Repair";
|
||||||
|
// public static final String CONFIRM_REQUIRED = "Confirm_Required";
|
||||||
|
// public static final String ANVIL = "Anvil_";
|
||||||
|
// public static final String ANVIL_MATERIAL = ANVIL + "Material";
|
||||||
|
// public static final String IRON_BLOCK = "IRON_BLOCK";
|
||||||
|
// public static final String ANVIL_USE = ANVIL + "Use_";
|
||||||
|
// public static final String ANVIL_PLACED = ANVIL + "Placed_";
|
||||||
|
// public static final String SALVAGE = "Salvage";
|
||||||
|
// public static final String UNARMED = "Unarmed";
|
||||||
|
// public static final String BLOCK_CRACKER = "Block_Cracker";
|
||||||
|
// public static final String SMOOTH_BRICK_TO_CRACKED_BRICK = "SmoothBrick_To_CrackedBrick";
|
||||||
|
// public static final String PICKUP_DISABLED_FULL_INVENTORY = "Pickup_Disabled_Full_Inventory";
|
||||||
|
// public static final String AS = "_As_";
|
||||||
|
// public static final String MINING = "Mining";
|
||||||
|
// public static final String DETONATOR = "Detonator_";
|
||||||
|
// public static final String FLINT_AND_STEEL = "FLINT_AND_STEEL";
|
||||||
|
// public static final String FISHING = "Fishing";
|
||||||
|
// public static final String LURE_MODIFIER = "Lure_Modifier";
|
||||||
|
// public static final String EXTRA_FISH = "Extra_Fish";
|
||||||
|
// public static final String OVERRIDE_VANILLA_TREASURES = "Override_Vanilla_Treasures";
|
||||||
|
// public static final String DROPS = "Drops_";
|
||||||
|
// public static final String ALCHEMY = "Alchemy";
|
||||||
|
// public static final String PREVENT_HOPPER_TRANSFER_BOTTLES = PREVENT + "Hopper_Transfer_Bottles";
|
||||||
|
// public static final String PREVENT_HOPPER_TRANSFER_INGREDIENTS = PREVENT + "Hopper_Transfer_Ingredients";
|
||||||
|
// public static final String FOR_HOPPERS = "_for_Hoppers";
|
||||||
|
// public static final String XP_AFTER_TELEPORT = "XP_After_Teleport_";
|
||||||
|
// public static final String LIGHTNING = "_Lightning";
|
||||||
|
// public static final String GOLD_BLOCK = "GOLD_BLOCK";
|
||||||
|
// public static final String PICKAXE = "_Pickaxe";
|
||||||
|
// public static final String EXP_SHARE_BONUS_BASE = "ExpShare_bonus_base";
|
||||||
|
//
|
||||||
|
// public MainConfig() {
|
||||||
|
// //super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "config.yml", true);
|
||||||
|
// super("main", pluginRef.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * This grabs an instance of this config class from the Config Manager
|
||||||
|
// * This method is deprecated and will be removed in the future
|
||||||
|
// *
|
||||||
|
// * @return the instance of this config
|
||||||
|
// * @see mcMMO#getConfigManager()
|
||||||
|
// * @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
|
// */
|
||||||
|
// @Deprecated
|
||||||
|
// public static MainConfig getInstance() {
|
||||||
|
// return pluginRef.getConfigManager().getMainConfig();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * The version of this config
|
||||||
|
// *
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// public double getConfigVersion() {
|
||||||
|
// return 1;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public List<String> validateKeys() {
|
||||||
|
// // Validate all the settings!
|
||||||
|
// List<String> reason = new ArrayList<>();
|
||||||
|
// return reason;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public boolean getPreventHopperTransferIngredients() {
|
||||||
|
// return getBooleanValue(SKILLS, ALCHEMY, PREVENT_HOPPER_TRANSFER_INGREDIENTS);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public boolean getPreventHopperTransferBottles() {
|
||||||
|
// return getBooleanValue(SKILLS, ALCHEMY, PREVENT_HOPPER_TRANSFER_BOTTLES);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* Taming */
|
||||||
|
// public Material getTamingCOTWMaterial(EntityType type) {
|
||||||
|
// return Material.matchMaterial(getStringValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), ITEM + MATERIAL));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public int getTamingCOTWCost(EntityType type) {
|
||||||
|
// return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), ITEM + AMOUNT);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public int getTamingCOTWAmount(EntityType type) {
|
||||||
|
// return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_AMOUNT);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public int getTamingCOTWLength(EntityType type) {
|
||||||
|
// return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_LENGTH);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public int getTamingCOTWMaxAmount(EntityType type) {
|
||||||
|
// return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_MAX_AMOUNT);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public double getTamingCOTWRange() {
|
||||||
|
// return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD1, RANGE);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
@ -0,0 +1,27 @@
|
|||||||
|
//package com.gmail.nossr50.config;
|
||||||
|
//
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * This is for config validation
|
||||||
|
// */
|
||||||
|
//public interface UnsafeValueValidation {
|
||||||
|
// List<String> validateKeys();
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Prints all errors found when validating the config
|
||||||
|
// */
|
||||||
|
// default void validateEntries() {
|
||||||
|
// /*
|
||||||
|
// * Print Errors about Keys
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
// List<String> validKeyErrors = validateKeys(); // Validate Keys
|
||||||
|
//
|
||||||
|
// if (validKeyErrors != null && validKeyErrors.size() > 0) {
|
||||||
|
// for (String error : validKeyErrors) {
|
||||||
|
// pluginRef.getLogger().severe(error);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
|
||||||
import com.gmail.nossr50.core.MetadataConstants;
|
import com.gmail.nossr50.core.MetadataConstants;
|
||||||
import com.gmail.nossr50.datatypes.meta.BonusDropMeta;
|
import com.gmail.nossr50.datatypes.meta.BonusDropMeta;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -81,7 +80,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockFace direction = event.getDirection();
|
BlockFace direction = event.getDirection();
|
||||||
@ -106,7 +105,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get opposite direction so we get correct block
|
// Get opposite direction so we get correct block
|
||||||
@ -128,7 +127,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityBlockFormEvent(EntityBlockFormEvent event) {
|
public void onEntityBlockFormEvent(EntityBlockFormEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (BlockUtils.shouldBeWatched(event.getBlock().getState())) {
|
if (BlockUtils.shouldBeWatched(event.getBlock().getState())) {
|
||||||
@ -139,7 +138,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockFormEvent(BlockFormEvent event) {
|
public void onBlockFormEvent(BlockFormEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block newBlock = event.getNewState().getBlock();
|
Block newBlock = event.getNewState().getBlock();
|
||||||
@ -162,7 +161,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -205,7 +204,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockMultiPlace(BlockMultiPlaceEvent event) {
|
public void onBlockMultiPlace(BlockMultiPlaceEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -227,7 +226,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockGrow(BlockGrowEvent event) {
|
public void onBlockGrow(BlockGrowEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockState blockState = event.getBlock().getState();
|
BlockState blockState = event.getBlock().getState();
|
||||||
@ -247,7 +246,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
@ -341,7 +340,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockBreakHigher(BlockBreakEvent event) {
|
public void onBlockBreakHigher(BlockBreakEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
@ -410,7 +409,7 @@ public class BlockListener implements Listener {
|
|||||||
BlockState blockState = event.getBlock().getState();
|
BlockState blockState = event.getBlock().getState();
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
@ -480,7 +479,7 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockDamageHigher(BlockDamageEvent event) {
|
public void onBlockDamageHigher(BlockDamageEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
|
||||||
import com.gmail.nossr50.core.MetadataConstants;
|
import com.gmail.nossr50.core.MetadataConstants;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
@ -79,7 +78,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityShootBow(EntityShootBowEvent event) {
|
public void onEntityShootBow(EntityShootBowEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
@ -115,7 +114,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event.getEntity().getShooter() instanceof Player)
|
if(event.getEntity().getShooter() instanceof Player)
|
||||||
@ -155,7 +154,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
@ -305,7 +304,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event instanceof FakeEntityDamageByEntityEvent) {
|
if (event instanceof FakeEntityDamageByEntityEvent) {
|
||||||
@ -454,7 +453,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
@ -621,7 +620,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onEntityDeathLowest(EntityDeathEvent event) {
|
public void onEntityDeathLowest(EntityDeathEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LivingEntity entity = event.getEntity();
|
LivingEntity entity = event.getEntity();
|
||||||
@ -653,7 +652,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onEntityDeath(EntityDeathEvent event) {
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LivingEntity entity = event.getEntity();
|
LivingEntity entity = event.getEntity();
|
||||||
@ -673,7 +672,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LivingEntity entity = event.getEntity();
|
LivingEntity entity = event.getEntity();
|
||||||
@ -709,7 +708,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -752,7 +751,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEnitityExplode(EntityExplodeEvent event) {
|
public void onEnitityExplode(EntityExplodeEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -796,7 +795,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onEntityExplodeMonitor(EntityExplodeEvent event) {
|
public void onEntityExplodeMonitor(EntityExplodeEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -816,7 +815,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -924,7 +923,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityTame(EntityTameEvent event) {
|
public void onEntityTame(EntityTameEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event instanceof FakeEntityTameEvent) {
|
if (event instanceof FakeEntityTameEvent) {
|
||||||
@ -967,7 +966,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityTarget(EntityTargetEvent event) {
|
public void onEntityTarget(EntityTargetEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -1008,7 +1007,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPotionSplash(PotionSplashEvent event) {
|
public void onPotionSplash(PotionSplashEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (PotionEffect effect : ((PotionMeta) event.getPotion().getItem().getItemMeta()).getCustomEffects()) {
|
for (PotionEffect effect : ((PotionMeta) event.getPotion().getItem().getItemMeta()).getCustomEffects()) {
|
||||||
@ -1026,7 +1025,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPigZapEvent(PigZapEvent event) {
|
public void onPigZapEvent(PigZapEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getEntity().hasMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY)) {
|
if (event.getEntity().hasMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY)) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.MainConfig;
|
import com.gmail.nossr50.config.MainConfig;
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
|
||||||
import com.gmail.nossr50.core.MetadataConstants;
|
import com.gmail.nossr50.core.MetadataConstants;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
@ -37,7 +36,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||||
@ -64,7 +63,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onInventoryClose(InventoryCloseEvent event) {
|
public void onInventoryClose(InventoryCloseEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||||
@ -85,7 +84,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onFurnaceBurnEvent(FurnaceBurnEvent event) {
|
public void onFurnaceBurnEvent(FurnaceBurnEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block furnaceBlock = event.getBlock();
|
Block furnaceBlock = event.getBlock();
|
||||||
@ -119,7 +118,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
|
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block furnaceBlock = event.getBlock();
|
Block furnaceBlock = event.getBlock();
|
||||||
@ -152,7 +151,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block furnaceBlock = event.getBlock();
|
Block furnaceBlock = event.getBlock();
|
||||||
@ -186,7 +185,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryClickEventNormal(InventoryClickEvent event) {
|
public void onInventoryClickEventNormal(InventoryClickEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getWhoClicked().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Inventory inventory = event.getInventory();
|
Inventory inventory = event.getInventory();
|
||||||
@ -313,7 +312,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryDragEvent(InventoryDragEvent event) {
|
public void onInventoryDragEvent(InventoryDragEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getWhoClicked().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Inventory inventory = event.getInventory();
|
Inventory inventory = event.getInventory();
|
||||||
@ -369,7 +368,7 @@ public class InventoryListener implements Listener {
|
|||||||
// @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
// @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
// public void onBrew(BrewEvent event) {
|
// public void onBrew(BrewEvent event) {
|
||||||
// /* WORLD BLACKLIST CHECK */
|
// /* WORLD BLACKLIST CHECK */
|
||||||
// if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
// if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// if (event instanceof FakeBrewEvent)
|
// if (event instanceof FakeBrewEvent)
|
||||||
@ -387,7 +386,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
//Location can be null here
|
//Location can be null here
|
||||||
if (event.getSource().getLocation() != null)
|
if (event.getSource().getLocation() != null)
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getSource().getLocation().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Inventory inventory = event.getDestination();
|
Inventory inventory = event.getDestination();
|
||||||
@ -435,7 +434,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onCraftItem(CraftItemEvent event) {
|
public void onCraftItem(CraftItemEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getWhoClicked().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final HumanEntity whoClicked = event.getWhoClicked();
|
final HumanEntity whoClicked = event.getWhoClicked();
|
||||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.listeners;
|
|||||||
|
|
||||||
import com.gmail.nossr50.chat.ChatManager;
|
import com.gmail.nossr50.chat.ChatManager;
|
||||||
import com.gmail.nossr50.config.MainConfig;
|
import com.gmail.nossr50.config.MainConfig;
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
|
||||||
import com.gmail.nossr50.core.MetadataConstants;
|
import com.gmail.nossr50.core.MetadataConstants;
|
||||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
@ -63,7 +62,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -102,7 +101,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPlayerDeathLowest(PlayerDeathEvent event) {
|
public void onPlayerDeathLowest(PlayerDeathEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String deathMessage = event.getDeathMessage();
|
String deathMessage = event.getDeathMessage();
|
||||||
@ -134,7 +133,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerDeathMonitor(PlayerDeathEvent event) {
|
public void onPlayerDeathMonitor(PlayerDeathEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean statLossEnabled = HardcoreManager.isStatLossEnabled();
|
boolean statLossEnabled = HardcoreManager.isStatLossEnabled();
|
||||||
@ -213,7 +212,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
@ -243,7 +242,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerFishHighest(PlayerFishEvent event) {
|
public void onPlayerFishHighest(PlayerFishEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -318,7 +317,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -410,7 +409,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
@ -510,7 +509,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
//Delay loading for 3 seconds in case the player has a save task running, its hacky but it should do the trick
|
//Delay loading for 3 seconds in case the player has a save task running, its hacky but it should do the trick
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(pluginRef, 60);
|
new PlayerProfileLoadingTask(pluginRef, player).runTaskLaterAsynchronously(pluginRef, 60);
|
||||||
|
|
||||||
if (pluginRef.getConfigManager().getConfigMOTD().isEnableMOTD()) {
|
if (pluginRef.getConfigManager().getConfigMOTD().isEnableMOTD()) {
|
||||||
Motd.displayAll(player);
|
Motd.displayAll(player);
|
||||||
@ -563,7 +562,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -676,7 +675,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
|
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -736,7 +735,9 @@ public class PlayerListener implements Listener {
|
|||||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING);
|
mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChimaeraWing.activationCheck(player);
|
//TODO: Something needs to be done about this
|
||||||
|
ChimaeraWing chimaeraWing = new ChimaeraWing(pluginRef, mcMMOPlayer);
|
||||||
|
chimaeraWing.activationCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GREEN THUMB CHECK */
|
/* GREEN THUMB CHECK */
|
||||||
@ -789,7 +790,9 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ITEM CHECKS */
|
/* ITEM CHECKS */
|
||||||
ChimaeraWing.activationCheck(player);
|
//TODO: Something needs to be done about this
|
||||||
|
ChimaeraWing chimaeraWing = new ChimaeraWing(pluginRef, mcMMOPlayer);
|
||||||
|
chimaeraWing.activationCheck();
|
||||||
|
|
||||||
/* BLAST MINING CHECK */
|
/* BLAST MINING CHECK */
|
||||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||||
@ -897,7 +900,7 @@ public class PlayerListener implements Listener {
|
|||||||
/*@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
/*@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerStatisticIncrementEvent(PlayerStatisticIncrementEvent event) {
|
public void onPlayerStatisticIncrementEvent(PlayerStatisticIncrementEvent event) {
|
||||||
*//* WORLD BLACKLIST CHECK *//*
|
*//* WORLD BLACKLIST CHECK *//*
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if(pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getPlayer().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!mcMMO.getHolidayManager().isAprilFirst()) {
|
if (!mcMMO.getHolidayManager().isAprilFirst()) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -30,7 +29,7 @@ public class WorldListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onStructureGrow(StructureGrowEvent event) {
|
public void onStructureGrow(StructureGrowEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pluginRef.getPlaceStore().isTrue(event.getLocation().getBlock())) {
|
if (!pluginRef.getPlaceStore().isTrue(event.getLocation().getBlock())) {
|
||||||
@ -50,7 +49,7 @@ public class WorldListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onWorldInit(WorldInitEvent event) {
|
public void onWorldInit(WorldInitEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
@ -72,7 +71,7 @@ public class WorldListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onWorldUnload(WorldUnloadEvent event) {
|
public void onWorldUnload(WorldUnloadEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pluginRef.getPlaceStore().unloadWorld(event.getWorld());
|
pluginRef.getPlaceStore().unloadWorld(event.getWorld());
|
||||||
@ -86,7 +85,7 @@ public class WorldListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Chunk chunk = event.getChunk();
|
Chunk chunk = event.getChunk();
|
||||||
|
Loading…
Reference in New Issue
Block a user