New option for waypoints

This commit is contained in:
Jules 2024-10-06 16:17:33 +02:00
parent c4ae7bfed3
commit d54c314812
4 changed files with 8 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class ConfigManager {
public final CommandVerbose commandVerbose = new CommandVerbose();
public boolean overrideVanillaExp, canCreativeCast, passiveSkillsNeedBinding, cobbleGeneratorXP, saveDefaultClassInfo, splitMainExp, splitProfessionExp, disableQuestBossBar,
pvpModeEnabled, pvpModeInvulnerabilityCanDamage, forceClassSelection, enableGlobalSkillTreeGUI, enableSpecificSkillTreeGUI, waypointAutoPathCalculation;
pvpModeEnabled, pvpModeInvulnerabilityCanDamage, forceClassSelection, enableGlobalSkillTreeGUI, enableSpecificSkillTreeGUI, waypointAutoPathCalculation, waypointLinkReciprocity;
public String partyChatPrefix, noSkillBoundPlaceholder;
public ChatColor staminaFull, staminaHalf, staminaEmpty;
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
@ -152,6 +152,7 @@ public class ConfigManager {
forceClassSelection = MMOCore.plugin.getConfig().getBoolean("force-class-selection");
waypointWarpTime = MMOCore.plugin.getConfig().getInt("waypoints.default-warp-time");
waypointAutoPathCalculation = MMOCore.plugin.getConfig().getBoolean("waypoints.auto_path_calculation");
waypointLinkReciprocity = MMOCore.plugin.getConfig().getBoolean("waypoints.link_reciprocity");
// Combat
pvpModeEnabled = config.getBoolean("pvp_mode.enabled");

View File

@ -48,7 +48,6 @@ public class WaypointManager implements MMOCoreManager {
if (clearBefore)
waypoints.clear();
FileUtils.loadObjectsFromFolder(MMOCore.plugin, "waypoints", false, (key, config) -> {
register(new Waypoint(config));
}, "Could not load waypoint '%s' from file '%s': %s");

View File

@ -47,6 +47,10 @@ public class Waypoint implements Unlockable, PreloadedObject {
for (String key : section.getKeys(false))
destinations.put(MMOCore.plugin.waypointManager.get(key), section.getDouble(key));
}
// Link reciprocity
if (MMOCore.plugin.configManager.waypointLinkReciprocity)
destinations.forEach((neighbor, cost) -> neighbor.destinations.put(this, cost));
});
public Waypoint(ConfigurationSection config) {

View File

@ -274,6 +274,8 @@ waypoints:
# takes to use the waypoint and teleport to target location.
default-warp-time: 100
link_reciprocity: false
# By default, MMOCore runs path calculation to enable players
# to take shortcuts and directly teleport across distant waypoints.
#