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() { public void run() {
if (!isOnline() || getPlayer().getLocation().getBlockX() != x || getPlayer().getLocation().getBlockY() != y || getPlayer().getLocation().getBlockZ() != z) { if (!isOnline() || getPlayer().getLocation().getBlockX() != x || getPlayer().getLocation().getBlockY() != y || getPlayer().getLocation().getBlockZ() != z) {
if (isOnline()) {
MMOCore.plugin.soundManager.getSound(SoundEvent.WARP_CANCELLED).playTo(getPlayer()); MMOCore.plugin.soundManager.getSound(SoundEvent.WARP_CANCELLED).playTo(getPlayer());
ConfigMessage.fromKey("warping-canceled").send(getPlayer()); ConfigMessage.fromKey("warping-canceled").send(getPlayer());
}
giveStellium(cost, PlayerResourceUpdateEvent.UpdateReason.USE_WAYPOINT); giveStellium(cost, PlayerResourceUpdateEvent.UpdateReason.USE_WAYPOINT);
cancel(); cancel();
return; return;
} }
ConfigMessage.fromKey("warping-comencing", "left", String.valueOf((warpTime - t) / 20)).send(getPlayer());
if (hasPerm || t++ >= warpTime) { if (hasPerm || t++ >= warpTime) {
getPlayer().teleport(target.getLocation()); getPlayer().teleport(target.getLocation());
getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20, 1, false, false)); getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20, 1, false, false));
@ -794,6 +795,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD
return; 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)); 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); final double r = Math.sin((double) t / warpTime * Math.PI);
for (double j = 0; j < Math.PI * 2; j += Math.PI / 4) 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 long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
public double lootChestsChanceWeight, dropItemsChanceWeight, fishingDropsChanceWeight, partyMaxExpSplitRange, pvpModeToggleOnCooldown, pvpModeToggleOffCooldown, pvpModeCombatCooldown, public double lootChestsChanceWeight, dropItemsChanceWeight, fishingDropsChanceWeight, partyMaxExpSplitRange, pvpModeToggleOnCooldown, pvpModeToggleOffCooldown, pvpModeCombatCooldown,
pvpModeCombatTimeout, pvpModeInvulnerabilityTimeRegionChange, pvpModeInvulnerabilityTimeCommand, pvpModeRegionEnterCooldown, pvpModeRegionLeaveCooldown; 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<>(); public final List<EntityDamageEvent.DamageCause> combatLogDamageCauses = new ArrayList<>();
private final FileConfiguration messages; private final FileConfiguration messages;
@ -135,6 +135,7 @@ public class ConfigManager {
splitProfessionExp = MMOCore.plugin.getConfig().getBoolean("party.profession-exp-split"); splitProfessionExp = MMOCore.plugin.getConfig().getBoolean("party.profession-exp-split");
disableQuestBossBar = MMOCore.plugin.getConfig().getBoolean("mmocore-quests.disable-boss-bar"); disableQuestBossBar = MMOCore.plugin.getConfig().getBoolean("mmocore-quests.disable-boss-bar");
forceClassSelection = MMOCore.plugin.getConfig().getBoolean("force-class-selection"); forceClassSelection = MMOCore.plugin.getConfig().getBoolean("force-class-selection");
waypointWarpTime = MMOCore.plugin.getConfig().getInt("waypoints.default-warp-time");
// Combat // Combat
pvpModeEnabled = config.getBoolean("pvp_mode.enabled"); 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")); loc = readLocation(Objects.requireNonNull(config.getString("location"), "Could not read location"));
radiusSquared = Math.pow(config.getDouble("radius"), 2); 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"); dynamicCost = config.getDouble("cost.dynamic-use");
normalCost = config.getDouble("cost.normal-use"); normalCost = config.getDouble("cost.normal-use");

View File

@ -266,8 +266,11 @@ combat-log:
# skills, etc.) when selecting a new class # skills, etc.) when selecting a new class
save-default-class-info: false save-default-class-info: false
#Time taken in ticks to teleport using waypoints. waypoints:
waypoint-warp-time: 100
# 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 # Change this to the name of the color you want for
# the different resource bar placeholders # the different resource bar placeholders
@ -276,9 +279,10 @@ resource-bar-colors:
stamina-half: 'DARK_GREEN' stamina-half: 'DARK_GREEN'
stamina-empty: 'WHITE' stamina-empty: 'WHITE'
# Whether or not the admin commands should display # Whether the admin commands should display
# the result of the command when ran. # the result of the command when ran.
# For Example: "Players Level is now 10." # For Example: "Players Level is now 10."
#
# Accepted Values: # Accepted Values:
# true - Always verbose # true - Always verbose
# player - Only verbose when ran from a player # player - Only verbose when ran from a player

View File

@ -14,6 +14,10 @@ spawn:
lore: {} 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 for several specific actions
cost: cost:

View File

@ -26,7 +26,7 @@ permissions:
default: op default: op
mmocore.bypass-waypoint-wait: mmocore.bypass-waypoint-wait:
description: Bypass waypoint waiting time description: Bypass waypoint waiting time
default: op default: false
mmocore.class-select: mmocore.class-select:
description: Access to /class description: Access to /class
default: op default: op