diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 8fd652c4..3a058dfc 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -778,14 +778,15 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD public void run() { if (!isOnline() || getPlayer().getLocation().getBlockX() != x || getPlayer().getLocation().getBlockY() != y || getPlayer().getLocation().getBlockZ() != z) { - MMOCore.plugin.soundManager.getSound(SoundEvent.WARP_CANCELLED).playTo(getPlayer()); - ConfigMessage.fromKey("warping-canceled").send(getPlayer()); + if (isOnline()) { + MMOCore.plugin.soundManager.getSound(SoundEvent.WARP_CANCELLED).playTo(getPlayer()); + ConfigMessage.fromKey("warping-canceled").send(getPlayer()); + } giveStellium(cost, PlayerResourceUpdateEvent.UpdateReason.USE_WAYPOINT); cancel(); return; } - ConfigMessage.fromKey("warping-comencing", "left", String.valueOf((warpTime - t) / 20)).send(getPlayer()); if (hasPerm || t++ >= warpTime) { getPlayer().teleport(target.getLocation()); getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20, 1, false, false)); @@ -794,6 +795,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD return; } + ConfigMessage.fromKey("warping-comencing", "left", String.valueOf((warpTime - t) / 20)).send(getPlayer()); MMOCore.plugin.soundManager.getSound(SoundEvent.WARP_CHARGE).playTo(getPlayer(), 1, (float) (.5 + t * 1.5 / warpTime)); final double r = Math.sin((double) t / warpTime * Math.PI); for (double j = 0; j < Math.PI * 2; j += Math.PI / 4) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 6ceceed6..6d5ac805 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -34,7 +34,7 @@ public class ConfigManager { public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown; public double lootChestsChanceWeight, dropItemsChanceWeight, fishingDropsChanceWeight, partyMaxExpSplitRange, pvpModeToggleOnCooldown, pvpModeToggleOffCooldown, pvpModeCombatCooldown, pvpModeCombatTimeout, pvpModeInvulnerabilityTimeRegionChange, pvpModeInvulnerabilityTimeCommand, pvpModeRegionEnterCooldown, pvpModeRegionLeaveCooldown; - public int maxPartyLevelDifference, maxPartyPlayers, minCombatLevel, maxCombatLevelDifference, skillTreeScrollStepX, skillTreeScrollStepY; + public int maxPartyLevelDifference, maxPartyPlayers, minCombatLevel, maxCombatLevelDifference, skillTreeScrollStepX, skillTreeScrollStepY, waypointWarpTime; public final List combatLogDamageCauses = new ArrayList<>(); private final FileConfiguration messages; @@ -135,6 +135,7 @@ public class ConfigManager { splitProfessionExp = MMOCore.plugin.getConfig().getBoolean("party.profession-exp-split"); disableQuestBossBar = MMOCore.plugin.getConfig().getBoolean("mmocore-quests.disable-boss-bar"); forceClassSelection = MMOCore.plugin.getConfig().getBoolean("force-class-selection"); + waypointWarpTime = MMOCore.plugin.getConfig().getInt("waypoints.default-warp-time"); // Combat pvpModeEnabled = config.getBoolean("pvp_mode.enabled"); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java index 8a1c8ede..10fa00c3 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java @@ -50,7 +50,7 @@ public class Waypoint extends PostLoadObject implements Unlockable { loc = readLocation(Objects.requireNonNull(config.getString("location"), "Could not read location")); radiusSquared = Math.pow(config.getDouble("radius"), 2); - warpTime = config.getInt("warp-time", 100); + warpTime = Math.max(0, config.getInt("warp-time", MMOCore.plugin.configManager.waypointWarpTime)); dynamicCost = config.getDouble("cost.dynamic-use"); normalCost = config.getDouble("cost.normal-use"); @@ -126,7 +126,7 @@ public class Waypoint extends PostLoadObject implements Unlockable { /** * @return Integer.POSITIVE_INFINITY if the way point is not linked - * If it is, cost of the instant travel between the two waypoints. + * If it is, cost of the instant travel between the two waypoints. */ public double getDirectCost(Waypoint waypoint) { return destinations.isEmpty() ? normalCost : destinations.getOrDefault(waypoint, Double.POSITIVE_INFINITY); diff --git a/MMOCore-Dist/src/main/resources/config.yml b/MMOCore-Dist/src/main/resources/config.yml index ed82747c..ef773f43 100644 --- a/MMOCore-Dist/src/main/resources/config.yml +++ b/MMOCore-Dist/src/main/resources/config.yml @@ -266,8 +266,11 @@ combat-log: # skills, etc.) when selecting a new class save-default-class-info: false -#Time taken in ticks to teleport using waypoints. -waypoint-warp-time: 100 +waypoints: + + # Default value of waypoint warp time. This is the time it + # takes to use the waypoint and teleport to target location. + default-warp-time: 100 # Change this to the name of the color you want for # the different resource bar placeholders @@ -276,14 +279,15 @@ resource-bar-colors: stamina-half: 'DARK_GREEN' stamina-empty: 'WHITE' -# Whether or not the admin commands should display +# Whether the admin commands should display # the result of the command when ran. # For Example: "Players Level is now 10." +# # Accepted Values: -# true - Always verbose -# player - Only verbose when ran from a player -# console - Only verbose when ran from console -# false - Never verbose +# true - Always verbose +# player - Only verbose when ran from a player +# console - Only verbose when ran from console +# false - Never verbose command-verbose: attribute: true skill: true diff --git a/MMOCore-Dist/src/main/resources/default/waypoints.yml b/MMOCore-Dist/src/main/resources/default/waypoints.yml index cb57e8fc..6940597b 100644 --- a/MMOCore-Dist/src/main/resources/default/waypoints.yml +++ b/MMOCore-Dist/src/main/resources/default/waypoints.yml @@ -14,6 +14,10 @@ spawn: lore: {} + # Time it takes to warp to target location when using + # the waypoint through the GUI. + warp-time: 100 + # Cost for several specific actions cost: diff --git a/MMOCore-Dist/src/main/resources/plugin.yml b/MMOCore-Dist/src/main/resources/plugin.yml index 15f9782a..6220f536 100644 --- a/MMOCore-Dist/src/main/resources/plugin.yml +++ b/MMOCore-Dist/src/main/resources/plugin.yml @@ -26,7 +26,7 @@ permissions: default: op mmocore.bypass-waypoint-wait: description: Bypass waypoint waiting time - default: op + default: false mmocore.class-select: description: Access to /class default: op