mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 01:03:44 +01:00 
			
		
		
		
	Better config file organization for exploit prevention config
This commit is contained in:
		| @@ -5,66 +5,46 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; | |||||||
|  |  | ||||||
| @ConfigSerializable | @ConfigSerializable | ||||||
| public class ConfigExploitPrevention { | public class ConfigExploitPrevention { | ||||||
|     private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true; |  | ||||||
|     private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true; |  | ||||||
|     public static final boolean SPAWNED_MOBS_DEFAULT = true; |  | ||||||
|     public static final boolean TAMED_MOB_DEFAULT = true; |  | ||||||
|  |  | ||||||
|     /* |     /* | ||||||
|      * CONFIG NODES |      * CONFIG NODES | ||||||
|      */ |      */ | ||||||
|  |  | ||||||
|     @Setting(value = "Endermen-Endermite-Fix", |     @Setting(value = "General", comment = "Exploit settings that don't fit into specific categories") | ||||||
|             comment = "Removes XP from Endermen that target endermite, this is a common exploit in The End because of how rapidly they can spawn." + |     private ConfigSectionGeneral configSectionGeneral = new ConfigSectionGeneral(); | ||||||
|                     "\nIt is recommended that you leave this on as it allows players to easily gain massive amounts of combat XP" + |  | ||||||
|                     "\nDefault value: "+ENDERMEN_ENDERMITE_DEFAULT) |  | ||||||
|     private boolean endermenEndermiteFix = ENDERMEN_ENDERMITE_DEFAULT; |  | ||||||
|  |  | ||||||
|     @Setting(value = "Pistons-Mark-Blocks-As-Unnatural", |     @Setting(value = "Skills", comment = "Exploit settings for specific skills") | ||||||
|             comment = "Unnatural blocks give no XP." + |     private ConfigSectionExploitSkills configSectionExploitSkills = new ConfigSectionExploitSkills(); | ||||||
|                     "This helps prevent complex automated stone farms that enable auto clickers to gain XP passively." + |  | ||||||
|                     "\nDefault value: "+PISTONS_MARK_BLOCKS_DEFAULT) |  | ||||||
|     private boolean pistonsMarkBlocksUnnatural = PISTONS_MARK_BLOCKS_DEFAULT; |  | ||||||
|  |  | ||||||
|     @Setting(value = "Spawned-Mobs-Have-Modified-XP-Values", |  | ||||||
|             comment =   "Spawned mobs will give different XP values than their naturally spawning counterparts" + |  | ||||||
|                         "\nBy default, spawned mob XP is reduced to zero, but you could change it in the experience config to whatever you want." + |  | ||||||
|                         "\nSpawned mobs include mobs spawned from a nether portal, mob spawner, or eggs." + |  | ||||||
|                         "\nThis will not include mobs spawned from commands, typically." + |  | ||||||
|                         "\nDefault value: "+SPAWNED_MOBS_DEFAULT) |  | ||||||
|     private boolean markSpawnedMobs = SPAWNED_MOBS_DEFAULT; |  | ||||||
|  |  | ||||||
|     @Setting(value = "Prevent-Tamed-Mob-XP", comment = "Prevents tamed entities from giving any XP" + |  | ||||||
|             "\nDefault value: "+TAMED_MOB_DEFAULT) |  | ||||||
|     private boolean preventTamedMobXp = TAMED_MOB_DEFAULT; |  | ||||||
|  |  | ||||||
|     @Setting(value = "Acrobatics", comment = "Exploit settings related to Acrobatics") |  | ||||||
|     private ConfigSectionExploitAcrobatics configSectionExploitAcrobatics = new ConfigSectionExploitAcrobatics(); |  | ||||||
|  |  | ||||||
|     @Setting(value = "Fishing", comment = "Exploit settings related to Fishing") |  | ||||||
|     private ConfigSectionExploitFishing configSectionExploitFishing = new ConfigSectionExploitFishing(); |  | ||||||
|  |  | ||||||
|     public boolean getEndermenEndermiteFix() { |     public boolean getEndermenEndermiteFix() { | ||||||
|         return endermenEndermiteFix; |         return configSectionGeneral.getEndermenEndermiteFix(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean doPistonsMarkBlocksUnnatural() { |     public boolean doPistonsMarkBlocksUnnatural() { | ||||||
|         return pistonsMarkBlocksUnnatural; |         return configSectionGeneral.doPistonsMarkBlocksUnnatural(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean doSpawnedEntitiesGiveModifiedXP() { |     public boolean doSpawnedEntitiesGiveModifiedXP() { | ||||||
|         return markSpawnedMobs; |         return configSectionGeneral.doSpawnedEntitiesGiveModifiedXP(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean doTamedEntitiesGiveXP() { |     public boolean doTamedEntitiesGiveXP() { | ||||||
|         return preventTamedMobXp; |         return configSectionGeneral.doTamedEntitiesGiveXP(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public ConfigSectionGeneral getConfigSectionGeneral() { | ||||||
|  |         return configSectionGeneral; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public ConfigSectionExploitSkills getConfigSectionExploitSkills() { | ||||||
|  |         return configSectionExploitSkills; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public ConfigSectionExploitAcrobatics getConfigSectionExploitAcrobatics() { |     public ConfigSectionExploitAcrobatics getConfigSectionExploitAcrobatics() { | ||||||
|         return configSectionExploitAcrobatics; |         return configSectionExploitSkills.getConfigSectionExploitAcrobatics(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public ConfigSectionExploitFishing getConfigSectionExploitFishing() { |     public ConfigSectionExploitFishing getConfigSectionExploitFishing() { | ||||||
|         return configSectionExploitFishing; |         return configSectionExploitSkills.getConfigSectionExploitFishing(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,21 @@ | |||||||
|  | package com.gmail.nossr50.config.hocon.antiexploit; | ||||||
|  |  | ||||||
|  | import ninja.leaping.configurate.objectmapping.Setting; | ||||||
|  | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; | ||||||
|  |  | ||||||
|  | @ConfigSerializable | ||||||
|  | public class ConfigSectionExploitSkills { | ||||||
|  |     @Setting(value = "Acrobatics", comment = "Exploit settings related to Acrobatics") | ||||||
|  |     private ConfigSectionExploitAcrobatics configSectionExploitAcrobatics = new ConfigSectionExploitAcrobatics(); | ||||||
|  |  | ||||||
|  |     @Setting(value = "Fishing", comment = "Exploit settings related to Fishing") | ||||||
|  |     private ConfigSectionExploitFishing configSectionExploitFishing = new ConfigSectionExploitFishing(); | ||||||
|  |  | ||||||
|  |     public ConfigSectionExploitAcrobatics getConfigSectionExploitAcrobatics() { | ||||||
|  |         return configSectionExploitAcrobatics; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public ConfigSectionExploitFishing getConfigSectionExploitFishing() { | ||||||
|  |         return configSectionExploitFishing; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,57 @@ | |||||||
|  | package com.gmail.nossr50.config.hocon.antiexploit; | ||||||
|  |  | ||||||
|  | import ninja.leaping.configurate.objectmapping.Setting; | ||||||
|  | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; | ||||||
|  |  | ||||||
|  | @ConfigSerializable | ||||||
|  | public class ConfigSectionGeneral { | ||||||
|  |  | ||||||
|  |     private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true; | ||||||
|  |     private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true; | ||||||
|  |     public static final boolean SPAWNED_MOBS_DEFAULT = true; | ||||||
|  |     public static final boolean TAMED_MOB_DEFAULT = true; | ||||||
|  |  | ||||||
|  |     @Setting(value = "Endermen-Endermite-Fix", | ||||||
|  |             comment = "Removes XP from Endermen that target endermite, this is a common exploit in The End because of how rapidly they can spawn." + | ||||||
|  |                     "\nIt is recommended that you leave this on as it allows players to easily gain massive amounts of combat XP" + | ||||||
|  |                     "\nDefault value: "+ENDERMEN_ENDERMITE_DEFAULT) | ||||||
|  |     private boolean endermenEndermiteFix = ENDERMEN_ENDERMITE_DEFAULT; | ||||||
|  |  | ||||||
|  |     @Setting(value = "Pistons-Mark-Blocks-As-Unnatural", | ||||||
|  |             comment = "Unnatural blocks give no XP." + | ||||||
|  |                     "This helps prevent complex automated stone farms that enable auto clickers to gain XP passively." + | ||||||
|  |                     "\nDefault value: "+PISTONS_MARK_BLOCKS_DEFAULT) | ||||||
|  |     private boolean pistonsMarkBlocksUnnatural = PISTONS_MARK_BLOCKS_DEFAULT; | ||||||
|  |  | ||||||
|  |     @Setting(value = "Spawned-Mobs-Have-Modified-XP-Values", | ||||||
|  |             comment =   "Spawned mobs will give different XP values than their naturally spawning counterparts" + | ||||||
|  |                     "\nBy default, spawned mob XP is reduced to zero, but you could change it in the experience config to whatever you want." + | ||||||
|  |                     "\nSpawned mobs include mobs spawned from a nether portal, mob spawner, or eggs." + | ||||||
|  |                     "\nThis will not include mobs spawned from commands, typically." + | ||||||
|  |                     "\nDefault value: "+SPAWNED_MOBS_DEFAULT) | ||||||
|  |     private boolean markSpawnedMobs = SPAWNED_MOBS_DEFAULT; | ||||||
|  |  | ||||||
|  |     @Setting(value = "Tamed-Entities-Have-Modified-XP-Values", | ||||||
|  |             comment = "Prevents tamed entities from giving combat XP when struck by players" + | ||||||
|  |                     "\nIt's hard to imagine this being abused, but we disable it anyways." + | ||||||
|  |                     "\nTamed entities get marked in the same way that spawned mobs do, so they are affected by the same XP modifiers." + | ||||||
|  |             "\nDefault value: "+TAMED_MOB_DEFAULT) | ||||||
|  |     private boolean preventTamedMobXp = TAMED_MOB_DEFAULT; | ||||||
|  |  | ||||||
|  |     public boolean getEndermenEndermiteFix() { | ||||||
|  |         return endermenEndermiteFix; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public boolean doPistonsMarkBlocksUnnatural() { | ||||||
|  |         return pistonsMarkBlocksUnnatural; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public boolean doSpawnedEntitiesGiveModifiedXP() { | ||||||
|  |         return markSpawnedMobs; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public boolean doTamedEntitiesGiveXP() { | ||||||
|  |         return preventTamedMobXp; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user
	 nossr50
					nossr50