Config Events
Configure PMMO's core systems through these server-side events.
Anti-Cheese Configuration
The anti-cheese system prevents XP exploitation through AFK farming and repetitive actions.
PmmoJS.antiCheese((event) => {event.setAfkCanSubtract(false);event.addAfkSetting(EventType.BREAK).minTime(600) // 30 seconds before penalties apply.reduction(0.1) // 10% reduction per half-second.cooloff(5) // Reduce AFK time by 5 ticks per half-second when not AFK.tolerance(3.0) // Distance tolerance for AFK detection.strictTolerance(true) // Consider camera movement.build();// Add diminishing returns for repeated actionsevent.addDiminishingSetting(EventType.KILL).retention(6000) // 5 minutes before reset.reduction(0.1) // 10% reduction per repeat.build();// Add normalization for extreme XP gainsevent.addNormalizationSetting(EventType.CRAFT).retention(1200) // 1 minute tracking.toleranceFlat(50) // Flat tolerance for small XP.tolerancePercent(0.2) // 20% tolerance for large XP.build();});
Auto Values
Configure automatic XP awards and requirement calculations.
PmmoJS.autoValues((event) => {// Global settingsevent.setAutoValuesEnabled(true).setRaritiesModifier(1.5).setHardnessModifier(2.0);// XP awardsevent.addItemXpAward(EventType.CRAFT, "smithing", 25);event.addBlockXpAward(EventType.BREAK, "mining", 50);event.addEntityXpAward(EventType.KILL, "combat", 100);// Remove skills from auto-calculationsevent.removeItemXpSkill(EventType.CRAFT, "agility");// Tool-specific overridesevent.setAxeOverride({woodcutting: 15,foraging: 5,});// Requirementsevent.addItemReq(ReqType.WEAR, "defense", 10);event.addBlockReq(ReqType.BREAK, "mining", 5);});
Perks Configuration
Define perks that players unlock at specific skill levels. For some variables, check here
PmmoJS.perksConfig((event) => {// Add a jump boost perk that increases with agility levelevent.addPerk(EventType.JUMPED, "pmmo:jump_boost", "agility").asJumpBoostPerk().withMinLevel(10).withBase(0.05).withPerLevel(0.01).withMaxBoost(0.5).build();// Add a damage boost for specific weaponsevent.addPerk(EventType.DEAL_DAMAGE, "pmmo:damage_boost", "combat").asDamageBoostPerk().forWeapons("minecraft:sword", "minecraft:axe").withBase(0.1).withPerLevel(0.01).withMaxBoost(1.0).withCooldown(100).build();// Add a potion effect perkevent.addPerk(EventType.KILL, "pmmo:regen_effect", "endurance").asEffectPerk().withEffect("minecraft:regeneration").withDuration(200).withModifier(0).withMinLevel(25).withChance(0.15).build();// Clear all perks of a specific typeevent.clearPerks(EventType.BLOCK_PLACE);// Remove a specific perk typeevent.removePerkType("pmmo:fireworks");});
Skills Configuration
Define skills and skill groups.
PmmoJS.skillsConfig((event) => {event.addSkill("test").withColor(0xa52a2a).withIcon(new ResourceLocation("pmmo", "textures/skills/archery.png")).withIconSize(32).withMaxLevel(100).build();event.addSkill("combat").withColor(0xff0000).withUseTotal(true).setGroupOf({swordsmanship: 0.6,archery: 0.4,}).build();// Use this to remove default Skills.event.removeDefaultSkill("swiming");// If you want to modfy them.const test = SKillHelper.getSkill("test");event.removeDefaultSkill("test");event.addSkill("test").withAfkExempt(test.afkExempt()).withColor(test.color()).withUseTotal(test.useTotalLevels()).withIcon(test.icon()).withIconSize(test.iconSize()).withDisplayName(test.displayGroupName()).withMaxLevel(test.maxLevel());});
Server Configuration
Modify core server settings.
PmmoJS.serverConfig((event) => {// All config values for server configs with docs.event.setCreativeReach(15.0).setSalvageBlock("minecraft:anvil").setTreasureEnabled(true);event.setMaxLevel(100).setLossOnDeath(0.1).setLoseLevelsOnDeath(false).setUseExponentialFormula(true);event.setExponentialBaseXp(100).setExponentialPowerBase(1.05).setExponentialLevelMod(1.15);event.setReqEnabled(ReqType.BREAK, true).setReqEnabled(ReqType.PLACE, false);event.addJumpXp("agility", 0.5).addSprintJumpXp("agility", 1.0).addSwimmingXp("swimming", 0.2);event.addDealDamageXp("minecraft:player", "combat", 5).addReceiveDamageXp("minecraft:fall", "endurance", 2);event.setVeinEnabled(true).setBaseChargeRate(0.5).setBaseChargeCap(1000);});
Globals Configuration
Define global paths and constants for data access.
PmmoJS.globalsConfig((event) => {event.addPath("durability", "Damage");event.addConstant("MAX_SKILL_LEVEL", "100");event.remove("unused_path");event.removeConstant("OLD_CONSTANT");});
Heads up!
Configuration events are applied during server startup and may require a restart to take effect.