Fixed waypoint default warp time not working. Waypoint warp time bypass permission is no longer a default op permission.

This commit is contained in:
Jules 2024-04-25 17:55:48 -07:00
parent 974dbe1eac
commit 7593226610
6 changed files with 25 additions and 14 deletions

View File

@ -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)

View File

@ -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<EntityDamageEvent.DamageCause> 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");

View File

@ -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);

View File

@ -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

View File

@ -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:

View File

@ -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